Framework recipes

Django (Python)

settings.pypython
import os

APP_DOMAIN = os.environ.get('APP_DOMAIN', 'localhost')

ALLOWED_HOSTS = ['localhost', '127.0.0.1', APP_DOMAIN]

CSRF_TRUSTED_ORIGINS = [
    f'https://{APP_DOMAIN}',
    f'http://{APP_DOMAIN}',
]

CORS_ALLOWED_ORIGINS = [
    f'https://{APP_DOMAIN}',
]

# Static & media
STATIC_ROOT = BASE_DIR / 'staticfiles'
MEDIA_ROOT  = os.environ.get('APP_STORAGE', BASE_DIR / 'media')
MEDIA_URL   = '/media/'

Build & run commands

Dashboard → Build commandsbash
# BUILD_COMMANDS
pip install -r requirements.txt && python manage.py collectstatic --noinput

# RUN_COMMAND
python manage.py migrate && gunicorn core.wsgi:application --bind 0.0.0.0:8000
SECRET_KEY must be set in your user env vars. Never commit it to your repository. Django will raise an error if it is absent or left as the default.