I currently have a sizable django project. In the view, I do a large computation that is shared between views to save time on later requests. To activate the site, I have a python script that kicks off a number of scripts through manage.py for things like creating symlinks, collecting static files, etc. When each of the commands runs, it loads all the apps in the project, which does this large computation. I want to prevent this. Ideally, I'd like the precomputation to happen only once when I activate. I think I need to either:
- Prevent manage.py from actually loading the view (not sure this is possible)
- Lazily initialize the computation (not ideal since the first person to request a resouce will take multiple minutes)
What are my options? Any help is appreciated!