Java, .NET, PHP, PYTHON, ANGULAR, ML, Data Science, Testing, CI Tutorials in Easy Languages.

"Best Software Training, Internship, Project Development center of Indore India, Helpline 780506-3968"

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.

What is Git?

It is a tool to provide integration for the version control systems, it can be GitHub or bitbucket.


Step1st:-

 Create Project and app under localhost 

 Step2nd:- 
 Create requirements.txt file under a project directory

 asgiref==3.4.1
Django==3.2.5 
gunicorn==20.1.0 
pytz==2021.1 
sqlparse==0.4.1 
whitenoise==5.3.0 

 Step3rd:- 

 create Procfile under a project directory web: gunicorn .wsgi 

 Step4th:- 

 change setting.py 
 1) import os 
 2) append whitenoise library 

 MIDDLEWARE = [ 
 'django.middleware.security.SecurityMiddleware', 
 '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', 

 3)
 write static directory under

 STATIC_URL = '/static/'
 STATIC_ROOT = os.path.join(BASE_DIR, 'static') 

 4) go into heroku.com web application

 https://heroku.com/ 

 5) create app

 6) go into setting and copy app link 
 eg https://eroomrent.herokuapp.com/ 
 again go into 
setting.py and change eg 

ALLOWED_HOSTS = ['review-args.herokuapp.com', 'localhost', '127.0.0.1']

 7) install gitbash if you are new to git https://git-scm.com/download/win

 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

If you have any doubt in programming or join online classes then you can contact us by comment .

Previous Post Next Post