title: Django / postgres setup for database creation, for running tests
body: <p>My unittests are extending from <code>django.test.TestCase</code>. Using an SQLite3 backend, they are running fine.</p>
  
  <p>I want to run them with a PostgreSQL backend, and the first thing that the tests are doing is to try and create a test database. This fails, since django has no permissions to do this. I want to configure PostgreSQL / django so that this operation is allowed, but I can not find any documentation on how to do this.</p>
  
  <p>These are the settings used to <em>connect</em> to the database (<code>settings.py</code>):</p>
  
  <pre><code>DATABASES = {
      'default': {
          'ENGINE': 'django.db.backends.postgresql_psycopg2',
          'NAME': 'mydb',
          'USER': 'myuser',
          'PASSWORD': 'myppasss',
          'HOST': 'localhost',
          'PORT': '',
      }
  }
  </code></pre>
  
  <p>When running the django application, I have always a pre-created database and user, so that django can connect. </p>
  
  <p>I have two questions:</p>
  
  <ul>
  <li>What are the connection settings used to <em>create</em> the database, during unit test? My understanding is that the user that django is using to connect to the application database does not need to (and <em>should</em> not) have database creation rights.</li>
  <li>Where is all this described? The closest I have found is <a href="https://docs.djangoproject.com/en/1.8/ref/settings/#test" rel="noreferrer">here</a> (<code>TEST</code> key in the <code>DATABASES</code> config parameter), but those settings mostly refer to Oracle databases, and have a different purpose.</li>
  </ul>