line / promgen

Promgen is a configuration file generator for Prometheus
https://line.github.io/promgen/
MIT License
1.04k stars 150 forks source link

Fix "make run" without debug mode #458

Closed vincent-olivert-riera closed 7 months ago

vincent-olivert-riera commented 7 months ago

Just a confirmation, but if we assume a django only developer that wrote DEBUG=1 into their ./.env file then this would not have any effect, only if a user runs export DEBUG=1 (or similar) into their shell. Is this something we're worried about confusing the user with ? I'm not aware of there being a simple way to have make pick up a .env file for this edge case.

If you have DEBUG=1 either in the .env file or defined in your shell, you will be fine because make run will end up running the development server, where the manifests for static files are not necessary.

If you don't have DEBUG=1 in the .env file or defined in the shell, then make run will end up running the production server, where the manifests for static files are necessary. For that, you need to run collectstatic to ensure all the manifests are in place.

So, if you want to run the production server using make run instead of Docker, then you need the Makefile to detect that situation and run collectstatic. This is what this patch does.

Alternatively is there some setting we could be using here that would avoid the need for collectstatic when running with dev ?

There must have been some misunderstanding here. collectstatic is not needed "when running with dev". I assume by "dev" you mean DEBUG=1.


If there was a misunderstanding caused by the lack of detail (or a poorly written) commit message, let me know and I will try to improve it.