This section covers the common operations performed when deploying a django application. The table below lists the most common steps in order in this process. Please remember that each deployment is a unique process, and you should consult the deployment section of the Django docs if you have further questions.
Please note that this is site provides the most commonly used django features. It is by no means intended to be an exhaustive documentation of the Django framework. You can always use the official django documentation by clicking the big green button below.
Django Deployment Docs| Description | |
|---|---|
| 1 |
settings.py - Obscure the SECRET_KEY. There are many options to do this.
|
| 2 |
settings.py - Set DEBUG=False
|
| 3 |
settings.py - Configure ALLOWED_HOSTS list so that it lists the domains of the django application
|
| 4 |
settings.py - If you have static files, create a variable named STATIC_ROOT and assign it to BASE_DIR /'staticfiles'
|
| 5 |
Terminal - Run python manage.py collectstatic
|
| 6 |
- Add from django.conf.urls.static import static
|
| 7 |
- Add from django.conf.urls.static import settings
|
| 8 |
- Add '+ static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) to the end of the urlpatterns list
|
| 9 |
Terminal - Run python manage.py makemigrations |
| 10 |
Terminal - Run python manage.py migrate
|
| 11 |
Terminal - If you haven't already, run |
| 12 |
Terminal - If you haven't already, run python pip freeze > requirements.txt to lock the dependencies
|