How to host Django application under heroku platform, Django hosting


How to host Django application under Heroku platform:- 
Heroku is the best cloud platform, where you can host data freely for up to five applications and 512 MB webspace, it is the most secure and reliable platform.
Download Heroku CLI and Git Software Tools.
What is Git?
It is a tool to provide integration for the version control systems, it can be GitHub or bitbucket.
 Create Project and app under localhost 
 Create requirements.txt file under a project directory
 create Procfile under a project directory 
 web: gunicorn projectname.wsgi
 1) import os 
 2) append whitenoise library 
 'whitenoise.middleware.WhiteNoiseMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 
 write static directory under
 STATIC_URL = '/static/'
 STATIC_ROOT = os.path.join(BASE_DIR, 'static') 
 4) go into web application 
 5) create app
 6) go into setting and copy app link 
 again go into and change eg 
ALLOWED_HOSTS = ['', 'localhost', '']
 7) install gitbash if you are new to git
 8) Install it and write the following code cd project path eg cd d:/eroomrent 
 9) Implement the following git command (this command is also available in the deploy menu in heroku) 
 $ git init 
 $ heroku git: remote -a remoteappname 
 $ git add . 
 $ git commit -am "make it better" 
 $ git push heroku master 
 10) go into setting menu and launch app URL

Post a Comment


POST Answer of Questions and ASK to Doubt

Post a Comment (0)