Loading a pickled list just once - Django\Python
Question: I have a pickle file that contains a list of compiled regexes and other data.

It takes about 1-1.5 seconds to load.

**What could a good way of using this list into my views, but have pickle work
on the file just once?**

## Edit:

would importing into settings.py be considered ok?

* * *

Any ideas?


Answer: I'd write a python module - a singleton class with an init method that reads
the pickled data into a python object, and then whatever 'get' methods you
need to get the info out.

Then in your settings.py you just call the initialisation method. Anything
that needs to get info from it just imports the module and uses the get
methods.

