wsvincent / djangoforprofessionals

Source code for Django for Professionals 4.0
https://djangoforprofessionals.com/
MIT License
640 stars 265 forks source link

Ch17, Page 256: "DJANGO_DEBUG=False" creates bugs #309

Open machib77 opened 1 year ago

machib77 commented 1 year ago

After changing to "DJANGO_DEBUG=False" on the new file docker-compose-prod.yml, I spin down the Docker container and start it up again as instructed, and the page http://127.0.0.1:8000/debug behaves as expected, but the rest of the existing pages show problems:

Images won't load and on the books page the list looks cut off.

HBarotov commented 4 months ago

Hi,

Kind of late to respond, but this is the expectted behavior. When DEBUG=False, Django does not serve static and media files. One possible way is to create staticfiles and mediafiles volumes inside Docker.

You can learn more about them in this tutorial: Dockerizing Django with Postgres, Gunicorn, and Nginx