4

GOAL: Run the DJANGO development server, using the TestCase database.

Case: DJANGO produces this database when running a TestCase. Now I'm filling the database using DJANGO-autofixture. It would be really nice to start the DJANGO testserver using this database, so I can checkout how the website presents it. Unfortunately, I can't find anywhere how to do this.

Writing the test database to sqlite would make sense, but I don't see an options for this.

Any hints are appreciated! Thanks!

DA--
  • 723
  • 1
  • 8
  • 20

1 Answers1

2

The testcase database only lives within the context of a test. It is created, migrated, and loaded with fixtures before you run your tests. Default behavior is that after your test suite runs (fail or succeed), the database is dropped.

I recommend just loading your fixtures via the django-admin testserver yourfixture.json command

If you really wanted to but I think it is a not a good idea.

You have the option to provide a --keepdb argument to your test command. This will keep your test database after your test case runs. The name of that db will your actual dbs name prefixed with test_ You can then connect to that database via the database settings.

test keep alive and test database

look at database settings

Dap
  • 2,309
  • 5
  • 32
  • 44
  • Hm Ok so maybe I should just switch to MySQL and keep the db, then run the development server using the generated tables (of course change the settings file)...? – DA-- May 05 '18 at 17:34