Reputation: 97
I'm using Django 1.6 with PostgreSQL and I want to use a two different Postgres users - one for creating the initial tables (syncdb) and performing migrations, and one for general access to the database in my application. Is there a way of doing this?
Upvotes: 3
Views: 126
Reputation: 43168
From ./manage.py help syncdb
:
--database=DATABASE
Nominates a database to synchronize. Defaults to the "default" database.
You can add another database definition in your DATABASES
configuration, and run ./manage.py syncdb --database=name_of_database_definition
. You might want to create a small wrapper script for running that command, so that you don't have to type out the --database=...
parameter by hand every time.
south
also supports that option, so you can also use it to specify the database for your migrations.
Upvotes: 1