0

运行 Django 抛出conn = _connect(dsn, connection_factory=connection_factory, **kwasync) does not existOperationalError: FATAL: database "saleor"

我用过:

CREATE USER saleor WITH PASSWORD 'somepassword';
CREATE DATABASE saleor WITH OWNER saleor ENCODING 'utf-8';

当我进入psql -U saleor终端时,它可以工作并使用用户 saleor 登录到 db saleor。

我的连接字符串是:postgres://saleor:somepassword@localhost/saleor

当我运行python3 manage.py migrate它会引发如下错误:

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/mnt/c/Users/Rick/projects/jorcustom/e-commerce/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/mnt/c/Users/Rick/projects/jorcustom/e-commerce/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/mnt/c/Users/Rick/projects/jorcustom/e-commerce/venv/lib/python3.6/site-packages/django/core/management/base.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)

[..removed 14 lines..]

    self.connection = self.get_new_connection(conn_params)
  File "/mnt/c/Users/Rick/projects/jorcustom/e-commerce/venv/lib/python3.6/site-packages/django/db/backends/postgresql/base.py", line 178, in get_new_connection
    connection = Database.connect(**conn_params)
  File "/mnt/c/Users/Rick/projects/jorcustom/e-commerce/venv/lib/python3.6/site-packages/psycopg2/__init__.py", line 126, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
" does not existOperationalError: FATAL:  database "saleor
4

0 回答 0