How do I access the database created in python manage.py testserver?

Go To StackoverFlow.com

0

I recently discovered the testserver database which I've been using to run my Selenium tests against.

I'm having some weird issues with the database, so I wanted to inspect it.

When I terminate the server with ctrl-c, this is displayed:

^C  
Server stopped.  
Note that the test database, ':memory:', has not been deleted. You can explore it on your own.  

However, the file is not created:

$ ls -la :memory
ls: :memory: No such file or directory

I'm using SQLite3 and Django 1.3.

How can I access the test database?

2012-04-03 21:38
by BryanWheelock


3

This is just a default error message in django. SQLLite wipes the database from memory as soon as the database connection is closed. From the docs:

When this is done, no disk file is opened. Instead, a new database is created purely in memory. The database ceases to exist as soon as the database connection is closed. Every :memory: database is distinct from every other. So, opening two database connections each with the filename ":memory:" will create two independent in-memory databases.

Change it to an on-disk database while you figure out your issue, then switch it back for the speed once you're finished.

2012-04-03 21:43
by Sam Dolan