The Test Database in Django

When developing with Django it’s good practice to have several settings files in a settings directory like so:

You may want a ci.py file for use in a CI environment.

Each settings file can have the correct db connection settings for each environment.

You then run in each environment by specifying the relevant settings, e.g:

python manage.py runserver --settings=yourapp.settings.local

If you don’t want to manually specify this every time you can set the DJANGO_SETTINGS_MODULE and PYTHONPATH env vars in each environment.

1 Like