wsvincent / djangoforprofessionals

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

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

Open machib77 opened 10 months ago

machib77 commented 10 months 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 2 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