Sunday, 15 May 2011

Operational Error: FATAL: database "django" does not exist -



Operational Error: FATAL: database "django" does not exist -

i'm db dummy, , im trying set postgresql django project. utilize psycopg2. databases complicated though. if there way hold of database- , user-settings/info in 1 place. knew connect , how (i'm still running local there's no security-issue that?).

however seems don't have "rights" create database, though connect standard "admin"-user "postgres". password typed in under installation ("justdoit_90").

django-project (settings.py):

databases = { 'default': { 'engine': 'django.db.backends.postgresql_psycopg2', 'name': 'django', 'user': 'postgres', 'password': 'justdoit_90', 'host': '127.0.0.1', 'port': '5432', } }

cmd -> python manage.py shell (after importing django.db connection)

>>> cursor = connection.cursor() traceback (most recent phone call last): file "<console>", line 1, in <module> file "c:\python27\lib\site-packages\django\db\backends\__init__.py", line 165, in cursor cursor = self.make_debug_cursor(self._cursor()) file "c:\python27\lib\site-packages\django\db\backends\__init__.py", line 138, in _cursor self.ensure_connection() file "c:\python27\lib\site-packages\django\db\backends\__init__.py", line 133, in ensure_connection self.connect() file "c:\python27\lib\site-packages\django\db\utils.py", line 94, in __exit__ six.reraise(dj_exc_type, dj_exc_value, traceback) file "c:\python27\lib\site-packages\django\db\backends\__init__.py", line 133, in ensure_connection self.connect() file "c:\python27\lib\site-packages\django\db\backends\__init__.py", line 122, in connect self.connection = self.get_new_connection(conn_params) file "c:\python27\lib\site-packages\django\db\backends\postgresql_psycopg2\base.py", line 134, in get_new_connection homecoming database.connect(**conn_params) file "c:\python27\lib\site-packages\psycopg2-2.5.4-py2.7-win32.egg\psycopg2\__init__.py", line 164, in connect conn = _connect(dsn, connection_factory=connection_factory, async=async) operationalerror: fatal: database "django" not exist

have done wrong in installation? can right it? should consider reinstalling everything? how go that? databases confusing me :p

postgresql not auto-create databases on first connection. must create database before can utilize it.

connect postgresql (usually administration database, named 'postgres'), via pgadmin-iii or command-line psql client, , create database django. pgadmin-iii can via menus; psql utilize the create database sql command.

see creating postgresql database in manual , this tutorial found in 5second google search doesn't totally wrong.

what i'd connect using psql (you can find in start menu) 'postgres' user, password set @ install time, then:

create user django password 'somepassword'; create database django owner django encoding 'utf-8';

django database postgresql psycopg2

No comments:

Post a Comment