Deploying Django II.Setting up Heroku may be easier than the whole preparation process, but if something went wrong during the Part I. you could have problems now. Normally, after taking the steps below you can say in the end "I have a real Django app on the web!"
Sign in/up to Heroku!
Open your command-line interface or shell!
$ heroku login
$ heroku create /your-heroku-app-name/
Add your Heroku app to allowed hosts!
ALLOWED_HOSTS = [
'127.0.0.1',
'localhost',
'your-heroku-app-name.herokuapp.com'
]
Add files + commit + push to github!
$ git push heroku main
Push your app's repository to Heroku as well!
$ heroku run python manage.py createsuperuser
In the same way you create superuser locally, you have to add your username, email and password. After this you can sign in as superuser.
$ heroku run python manage.py makemigrations /your-heroku-app-name/
$ heroku run python manage.py migrate /your-heroku-app-name/
You should migrate your data models also on Heroku!
$ heroku open
The last step is to open your new application on the web! Hurrah!