Django 6 cheatsheet

Django 6: Static files and deployment

4 common Django 6 tasks.

Collect static files

Copy static files into STATIC_ROOT for the web server to serve.

python manage.py collectstatic --noinput

Generate a secret key

Print a new random value for SECRET_KEY.

python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"

See changed settings

Show settings that differ from Django's defaults.

python manage.py diffsettings

Run with Gunicorn

Serve the project with a production WSGI server.

gunicorn config.wsgi:application --bind 0.0.0.0:8000 --workers 3

Was this page helpful?