I'm a db dummy, and im trying to set up PostgreSQL for my django project. For that I also use psycopg2. Databases are complicated though. Personally I would like if there was a way to get hold of ALL my DATABASE- and USER-SETTINGS/INFO in one place. So I knew what connect to and how (I'm still running local so there's no security-issue with that?).
However it seems I don't have the "rights" to create this database, even though I connect to the standard "admin"-user "postgres". With the password i typed in under installation ("pw123").
Django-project (settings.py):
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'django',
'USER': 'postgres',
'PASSWORD': 'pw123',
'HOST': '127.0.0.1',
'PORT': '5432',
}
}
CMD -> python manage.py shell (after importing django.db connection)
>>> cursor = connection.cursor()
Traceback (most recent 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
return 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" does not exist
Have I done something wrong in the installation? Can I correct it? Should I consider reinstalling everything? How would I go about that? Databases are confusing me :P