How do I run Django tests on a copy of my production database?

后端 未结 2 2164
执笔经年
执笔经年 2021-02-13 13:08

I\'ve written a series of tests for my Django app, and would like to run them on a copy of my production database.

As far as I can tell, the best way to do this is using

2条回答
  •  情深已故
    2021-02-13 13:38

    You didn't mention which version of Django you're using, but looking at the 1.11 documentation:

    • dumpdata can dump the data for all the apps from a particular database, rather than needing to do them individually.
    • loaddata can load data for multiple apps, and as well as looking in individual app directories for fixtures subdirectories, it can also look in directories defined in FIXTURE_DIRS.

    It's not clear from the 1.11 docs about fixture loading for tests whether they would also look in FIXTURE_DIRS, though. So this might not solve your problem entirely.

提交回复
热议问题