Ich habe versucht, meine Django App mit PostgreSQL als meine Datenbank-Engine früher sqlite, Dies ist meine settings.py. Ich tat die Installation von Tutorial https://djangogirls.gitbooks.io/django-girls-tutorial-extensions/optional_postgresql_installation/Djago Fehler mit PostgreSQL Migration
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'djangogirls',
'USER': 'cherzik',
'PASSWORD': 'ADMIN',
'HOST': 'localhost',
}
}
dies Fehler, bitte helfen
d:\py\djangogirls>python manage.py migrate
System check identified some issues:
WARNINGS:
blog.Comment.created_date: (fields.W161) Fixed default value provided.
HINT: It seems you set a fixed date/time/datetime value as default f
or this field. This may not be what you want. If you want to have the current da
te as default, use `django.utils.timezone.now`
blog.Post.created_date: (fields.W161) Fixed default value provided.
HINT: It seems you set a fixed date/time/datetime value as default f
or this field. This may not be what you want. If you want to have the current da
te as default, use `django.utils.timezone.now`
Traceback (most recent call last):
File "C:\Users\Кирюшик\AppData\Local\Programs\Python\Python35\lib\site-package
s\django\db\backends\base\base.py", line 213, in ensure_connection
self.connect()
File "C:\Users\Кирюшик\AppData\Local\Programs\Python\Python35\lib\site-package
s\django\db\backends\base\base.py", line 189, in connect
self.connection = self.get_new_connection(conn_params)
File "C:\Users\Кирюшик\AppData\Local\Programs\Python\Python35\lib\site-package
s\django\db\backends\postgresql\base.py", line 176, in get_new_connection
connection = Database.connect(**conn_params)
File "C:\Users\Кирюшик\AppData\Local\Programs\Python\Python35\lib\site-package
s\psycopg2\__init__.py", line 130, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\Кирюшик\AppData\Local\Programs\Python\Python35\lib\site-package
s\django\core\management\__init__.py", line 363, in execute_from_command_line
utility.execute()
File "C:\Users\Кирюшик\AppData\Local\Programs\Python\Python35\lib\site-package
s\django\core\management\__init__.py", line 355, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\Кирюшик\AppData\Local\Programs\Python\Python35\lib\site-package
s\django\core\management\base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\Кирюшик\AppData\Local\Programs\Python\Python35\lib\site-package
s\django\core\management\base.py", line 330, in execute
output = self.handle(*args, **options)
File "C:\Users\Кирюшик\AppData\Local\Programs\Python\Python35\lib\site-package
s\django\core\management\commands\migrate.py", line 83, in handle
executor = MigrationExecutor(connection, self.migration_progress_callback)
File "C:\Users\Кирюшик\AppData\Local\Programs\Python\Python35\lib\site-package
s\django\db\migrations\executor.py", line 20, in __init__
self.loader = MigrationLoader(self.connection)
File "C:\Users\Кирюшик\AppData\Local\Programs\Python\Python35\lib\site-package
s\django\db\migrations\loader.py", line 52, in __init__
self.build_graph()
File "C:\Users\Кирюшик\AppData\Local\Programs\Python\Python35\lib\site-package
s\django\db\migrations\loader.py", line 209, in build_graph
self.applied_migrations = recorder.applied_migrations()
File "C:\Users\Кирюшик\AppData\Local\Programs\Python\Python35\lib\site-package
s\django\db\migrations\recorder.py", line 65, in applied_migrations
self.ensure_schema()
File "C:\Users\Кирюшик\AppData\Local\Programs\Python\Python35\lib\site-package
s\django\db\migrations\recorder.py", line 52, in ensure_schema
if self.Migration._meta.db_table in self.connection.introspection.table_name
s(self.connection.cursor()):
File "C:\Users\Кирюшик\AppData\Local\Programs\Python\Python35\lib\site-package
s\django\db\backends\base\base.py", line 254, in cursor
return self._cursor()
File "C:\Users\Кирюшик\AppData\Local\Programs\Python\Python35\lib\site-package
s\django\db\backends\base\base.py", line 229, in _cursor
self.ensure_connection()
File "C:\Users\Кирюшик\AppData\Local\Programs\Python\Python35\lib\site-package
s\django\db\backends\base\base.py", line 213, in ensure_connection
self.connect()
File "C:\Users\Кирюшик\AppData\Local\Programs\Python\Python35\lib\site-package
s\django\db\utils.py", line 94, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "C:\Users\Кирюшик\AppData\Local\Programs\Python\Python35\lib\site-package
s\django\utils\six.py", line 685, in reraise
raise value.with_traceback(tb)
File "C:\Users\Кирюшик\AppData\Local\Programs\Python\Python35\lib\site-package
s\django\db\backends\base\base.py", line 213, in ensure_connection
self.connect()
File "C:\Users\Кирюшик\AppData\Local\Programs\Python\Python35\lib\site-package
s\django\db\backends\base\base.py", line 189, in connect
self.connection = self.get_new_connection(conn_params)
File "C:\Users\Кирюшик\AppData\Local\Programs\Python\Python35\lib\site-package
s\django\db\backends\postgresql\base.py", line 176, in get_new_connection
connection = Database.connect(**conn_params)
File "C:\Users\Кирюшик\AppData\Local\Programs\Python\Python35\lib\site-package
s\psycopg2\__init__.py", line 130, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError
Poste bitte deine Modelle. – Selcuk
Es scheint, dass Ihr Code keine Verbindung zu PostgreSQL herstellen kann. Vergewissern Sie sich, dass PostgreSQL installiert ist und ausgeführt wird und dass der Name der postgresql-Datenbank, des Benutzers und des Passworts in den Django-Einstellungen korrekt eingestellt ist. –