Header Ads

Header ADS

Bitbucket && Heroku


                                                       


Git: 

git config --global user.name "Your Name"
git config --global user.email "yourname@email.com"git init #only once
git remote add origin git@bitbucket.org:<USER>/hello-world.git #only once for a project
git add -A
git commit -m 'initial commit'
git push -u origin master


Heroku:

heroku login
-------modify pipfile------
pipenv lock

pipenv install gunicorn
git add -A
git commit -m "New updates for Heroku deployment
git push -u origin master
heroku create
heroku git:remote -a fathomless-hamlet-121298 #name obtain from heroku create
heroku ps:scale web=ǐ
heroku open

------Procfile-------
web: gunicorn pages_project.wsgi --log-file -

-------settings.py------
ALLOWED_HOSTS = ['*' ]

git status
heroku config:set DISABLE_COLLECTSTATIC=1
git push heroku master



For supporting statics files on Heroku:

-----------------------------------------settings.py-------------------------------------

1.pipenv install whitenoise

2.INSTALLED_APPS=[
... ... ... ... ... ... ... ... ... ... ... ... 
'whitenoise.runserver_nostatic',
'django.contrib.staticfiles',

]
3. MIDDLEWARE = [
.......................................................
'django.contrib.sessions.middleware.SessionMiddleware', 'whitenoise.middleware.WhiteNoiseMiddleware', #new
...................................................
]

4. STATIC_ROOT = os.path.join(BASE_DIR,'staticfiles') 

STATIC_URL = '/static/' 

STATICFILES_DIRS = [ os.path.join(BASE_DIR,'static'), ] 

STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' #new





 Collage made with FotoJet

No comments

Theme images by centauria. Powered by Blogger.