Django·Django from project to API

Static files and deployment

Collect static assets, configure production settings and deploy safely.

Intermediate 14 min read Lesson 9 of 300 Challenge included
What you will be able to do
  • Run collectstatic before deploying.
  • Set DEBUG=False in production.
  • Serve media and static from a proper server.
  • Run migrations in the release step.

In plain English

Development serves static files automatically; production needs collectstatic and a real web server or CDN. Set DEBUG=False, configure ALLOWED_HOSTS, use environment secrets and run migrations as part of the release.

release.shTerminal
python manage.py collectstatic --noinput
python manage.py migrate --noinput
gunicorn config.wsgi:application
Your turn

Disable debug

Easy

Set DEBUG from an environment variable with a safe default of False.

PYTHON · starter
DEBUG =
Check your understanding before moving on.
Knowledge checkQuestion 1

What does collectstatic do?

Select an answer to continue
Study tools

Make it yours.

Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.

Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign in
Finished reading?

Lock in what you just learned.

Mark this lesson complete to save your place and move one step closer to the certificate.

Next: Build a REST API
Lesson 9 of 300 · 0% of course