views:

37

answers:

1

Since I don't have a hundred bazillion dollars, my Django app lives on a shared host, where all kinds of crazy rules are in effect. Fortunately, they gave me shell access, which has allowed me to kick butts and take names. However I can't do anything about not having CREATE DATABASE rights.

I'm using postgresql and have a killer test suite, but am unable to run it due to the code not being able to create a new database. However I am able to create said database beforehand via cPanel and use it with Django. I just don't have CREATE DATABASE rights.

Is there a way I can still run my test suite?

+1  A: 

You could maybe workaround this using sqlite3 engine to create a SQLite database. You can even create it in memory and drastically improve tests runtime.

To set it up just edit your database settings like this:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': ':memory:',
        ... # other settings (HOST, USER etc.)
    },
}
rebus
I agree that using sqlite might be an acceptable workaround, but shared hosts typically have limited memory, so loading the entire test suite DB into memory might not be a good idea.
Chris Lawlor
@Chris but you can still use sqlite on your file system, memory database is just a speed boost.
rebus
This is a great idea, and I tried this, and it worked with most of my tests, but then it crashed, I'm guessing due to memory like Chris said.
superjoe30