Question

I'm new to django and I wonder if there is anyway to use initial data without reinstalling custom sql each time. My initial data is almost 100MB and it's kind of painful to wait for database import for each test. I'm trying to find a way to do it without truncating my initial data.

Was it helpful?

Solution

OTHER TIPS

Why don't you cache your data? You can either do that in process as a global variable. Depending on how you are running your server - multithreaded, multiprocessed, both - WSGI/Embedded - this may be easy or hard.

Another option is to use memcached.

Django caching is described here

  1. https://docs.djangoproject.com/en/dev/topics/cache/
  2. http://www.jeffknupp.com/blog/2012/02/24/django-memcached-optimizing-django-through-caching/

It's very easy to use it. The interface is simply a get(key) and set(key,value). You can use various kinds of caches:

  1. Filesystem (you should probably use this with multiple processes)
  2. In memory (for single process and single thread try this - will be faster)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top