Gunicorn # Webserver
Django
django-on-heroku
django-dbfiles # Only when using file uploads
Pillow # Only when using ImageField
START: This part is only needed when you use uploads.
https://pypi.org/project/django-dbfiles/
# Add 'dbfiles' to INSTALLED_APPS
INSTALLED_APPS = [
'dbfiles',
]
# Optionally set DEFAULT_FILE_STORAGE
DEFAULT_FILE_STORAGE = 'dbfiles.storage.DBStorage'
# Choose a root url for uploaded files
MEDIA_URL = '/media/'
from dbfiles.urls import dbfiles_url
urlpatterns = [
...
dbfiles_url(),
]
END: Only for uploads.
https://pypi.org/project/django-on-heroku/
At the very bottom:
# Configure Django App for Heroku.
import django_on_heroku
django_on_heroku.settings(locals())
https://devcenter.heroku.com/articles/heroku-cli
Procfile
release: python ./app/manage.py migrate
web: gunicorn --chdir ./app -w 2 commerce.wsgi
$ python3 -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"
$ heroku run bash
A heroku shell opens
$ python manage.py createsuperuser