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.
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 projectname.wsgi 2) append whitenoise library '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', write static directory under STATIC_ROOT = os.path.join(BASE_DIR, 'static') 4) go into heroku.com web application 6) go into setting and copy app link eg https://eroomrent.herokuapp.com/ ALLOWED_HOSTS = ['appname.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) $ heroku git: remote -a remoteappname $ git commit -am "make it better" 10) go into setting menu and launch app URL
Post a Comment
POST Answer of Questions and ASK to Doubt