I am in the process of moving my kegbot setup from the beta cloud back to my on premise environment and I am running into an odd issue. For the base kegbot server setup (pre nginx) when I run my setup with DEBUG = False in local_settings.py the website is “broken”. All the text is there but the formatting is gone and my logging is filled with 404 errors. When I set it to DEBUG = True, everything looks and functions properly. What am I missing here?
I’ve run into the same issue, but I can’t yet tell you how to fix it, but I can tell you why it happens. Django doesn’t serve files from /static/ because it’s insecure. When you set it to DEBUG = True, it serves up the files, but DEBUG = False means it stops serving the static files because users can see it. I think.
All of this may as well be Cantonese to me, but I’m learning it.
I’m honestly considering moving the static files to the templates folder, and just changing the {{STATIC_URL}} markers in the html templates to point to the new folders. (probably a terrible idea.)
I know there’s a better solution, though. I’m not yet terribly familiar with linux as this is my first foray into it.
I realize this is reviving a very old thread, but I spent some time researching today and wanted to note what I learned for someone who may be more skilled than me in Django / Python in the future.
Although the default image is served from the static directory, any user saved images come from the media directory, and I cannot find a conversion function anywhere in the code to collect user-uploaded images and copy them to the static folder location (and to update the links on pages like these). As a result, user generated images break when KEGBOT_ENV=production.
Summary… don’t turn off debug mode if you want custom images to work in the web UI…
If anyone knows of another solution, I’d be happy to hear how you figured it out.