Configuring and Pushing the Project to Heroku
Follow step-by-step instructions to deploy the project to Heroku.
Heroku is a software platform that allows users to run and operate web applications in the cloud. We will be using the Heroku CLI in the following terminal. We have set the platform up by following the instructions in this guide so that you don’t have to install it in this lesson. However, you do need a Heroku account. If you don’t have one already, go to https://www.heroku.com and create one.
""" ASGI config for example project. It exposes the ASGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/ """ import os from django.core.asgi import get_asgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'example.settings') application = get_asgi_application()
Setting up the project
The Django web app needs the following changes before getting deployed to Heroku:
1. A requirements.txt file which lets Heroku know which packages the web application requires so that it can run properly on Heroku. This file has been generated using the following command:
pip freeze > requirements.txt
2. A runtime.txt file which contains the system’s present version of Python. The version of the Python can be checked using the following command:
python --version
3. The last additional file that it needs in the project directory is the Procfile (no file extension). The Procfile file lets Heroku know which processes are needed to serve ...