Django - Testing with parts of original database
-
20-09-2019 - |
Question
My database has two types of entries: The very dynamic (users, comments, etc) and the more static (email templates, flat-pages).
During testing I want a clean DB but with the real 'semi-static' data.
Is there a way to make Django's testing system to load parts of the original DB ?
Thanks
Solution
Use fixtures. See the documentation or the (wiki page](https://code.djangoproject.com/wiki/Fixtures)
Put data you need into fixtures and they will be loaded every time test database is built.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow