Specify PostgreSQL Schema in Django
django, postgresql
Solution
I suppose you are familiar with the concept of PostgreSQL schemas.
Your app is looking for the `django` schema in your database (which presumably isn’t there) because you have specifically told it so.
'options': '-c search_path=django'
For each application, create a suitably named schema and specify it in the `search_path`.
Problem
I am trying to build some DB front-ends using Django since I like the general MVC structure as well as their template system and admin interface. However, I am having trouble with certain aspects of using a PostgreSQL back-end. I've managed to figure out how to specify different schemas (and databases) using the database section of the `settings.py` file like so: ``` DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), }, 'MPS': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'OPTIONS': { 'options': '-c search_path=django' }, 'NAME': 'sandbox_manzer', 'HOST': '192.168.2.151', 'PORT': '5434', 'USER': '******', 'PASSWORD': '**********************', } } ``` However, when I try and script some basic tests, as detailed here, I run into a problem. My user can create databases just fine so my test_db gets built, but when the django app goes to build the models into tables I get an error stating that `No schema is specified` for the test_db. Any help in how I specify schema names for the test_db would be most appreciated. Especially since I intend to build out multiple apps for a single project using different schemas as logical separators. Thanks!