Skip to main content

Deploy django project on heroku

Deploying your Flask Application to Heroku | by Emmanuel King Kasulani |  The Andela Way | Medium

 check heroku

-------------------------------------

heroku --version

----------------------------------------

In django project 

$ pip3 install gunicorn

$ pip install django-heroku

$ pip install  python-decouple

then,

$ touch Procfile

 edit this procfile

--------------------------------------------------

web: gunicorn sample.wsgi

sample means very first project wsgi.py file

$ pip freeze > requirements.txt

----------------------------------------------------

import those things in settings.py file 

---------------------

import django_heroku
import dj_database_url
from decouple import config

Add middleware

'whitenoise.middleware.WhiteNoiseMiddleware',
 --------------------------------------------------
 bottom of settings.py file
 
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
----------------------------
then,
django_heroku.settings(locals())
 
push github
-------------
login heroku 
$heroku login
 
----------------------
$ heroku keys:add
 
----------------------
$ heroku create 

rename 
-------------
heroku rename app_name

-----------------

$ heroku config:set DISABLE_COLLECTSTATIC=1
---------------
$ git push heroku master
 
 
 
after push make migrate
-------------------------------
heroku run python manage.py migrate 
heroku run python manage.py createsuperuser


 
 

Comments

Popular posts from this blog

Data visualize with matplotlib(solid line)

Nominal GDP      from matplotlib import pyplot as plt      years = [1950, 1960, 1970, 1980, 1990, 2000, 2010]      gdp = [300.2, 543.3, 1075.9, 2862.5, 5979.6, 10289.7, 14958.3]      plt.title('GDP')      plt.ylabel('Billios of $')      plt.plot(years,gdp,color='red',marker='o',linestyle='solid')      plt.show() * plt.plot(x,y,color,marker per year,linestyle) there are several line style '-', '--', '-.', ':', 'None', ' ', '', 'solid', 'dashed', 'dashdot', 'dotted' fig-