Question

I deploy Django apps using a fabric script that checks out a copy of my project and when everything is in place the source is symlinked and the web server is reloaded (guessing this is a typical approach).

My concern is that the first time the site gets hit after deployment all the python scripts need to be re-interpreted.

I have some bright ideas about how I might force the code to get processed before any clients hit it but I'm looking for any high-level strategies people might use to accomplish this.

Any suggestions are welcome. Thanks in advance for any advice you can offer.

-Mike

Was it helpful?

Solution

python -m compileall /path/to/django/site

Will precompile any .py files under the directory recursively.

How are you running django? If you're using WSGI the interpreter or interpreters are already running and would have already compiled a lot of your django site. What is being dynamically loaded?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top