Oct. 27, 2019, 9:39 p.m.
The simplest way to deploy your django app in the heroku sky.
Deploying in heroku is super easy now. I have almost 10 running applications surve by heroku.
Here is the most simplified steps that i did follow everytime.
Create a Procfile in your project root(linux: touch Procfile)
add this inside the Procfile.
web: gunicorn project_name.wsgi
Add this in your app/settings.py
# add this under import os import django_heroku # Then all the way at the bottom of the file # ... django_heroku.settings(locals())
add this in your requirements.txt:
django gunicorn django-heroku psycopg2 psycopg2-binary
psycopg2 will be need for postgres db setup in production.
login to your heroku cli
create new app if one doesn’t yet exist
heroku create my-app-name
create a new postgres database for your app
heroku addons:create heroku-postgresql:hobby-dev
You never need to makemigrations on the heroku server. You should always makemigrations locally then push them to the server. You should only have to migrate on the server.
git add . git commit -m "My application gonna fly in the heroku sky" pit push heroku master
After successfull deploy, run:
heroku run python manage.py migrate
heroku run python manage.py createsuperuser
Here you go. Your app is live now. Yaaaayy....
If you got something helpful here hit on the
star button for this project.
And if there has any issue with your deploying, feel free to Create an Issue. Cheers!