我正在尝试使用Docker运行基于coockiecutter的Django项目,但出现以下错误:
完整输出:https://dpaste.de/eKF5
sudo docker-compose up
crm_postgres_1 is up-to-date
Starting crm_django_1
Starting crm_nginx_1
Attaching to crm_postgres_1, crm_django_1, crm_nginx_1
django_1 | Postgres is up - continuing...
postgres_1 | LOG: database system was shut down at 2017-02-15 10:39:52 UTC
postgres_1 | LOG: MultiXact member wraparound protections are now enabled
postgres_1 | LOG: database system is ready to accept connections
postgres_1 | LOG: autovacuum launcher started
postgres_1 | LOG: received smart shutdown request
postgres_1 | LOG: autovacuum launcher shutting down
postgres_1 | LOG: shutting down
postgres_1 | LOG: database system is shut down
postgres_1 | LOG: database system was shut down at 2017-02-15 10:41:58 UTC
postgres_1 | LOG: MultiXact member wraparound protections are now enabled
postgres_1 | LOG: database system is ready to accept connections
postgres_1 | LOG: autovacuum launcher started
postgres_1 | ERROR: relation "django_session" does not exist at character 109
postgres_1 | STATEMENT: SELECT "django_session"."session_key", "django_session"."session_data", "django_session"."expire_date" FROM "django_session" WHERE ("django_session"."expire_date" > '2017-02-15T11:04:25.807267+00:00'::timestamptz AND
我应该检查什么?我不能自己调试它。
最佳答案
您需要运行迁移以创建数据库表。
通常,您可以使用migration命令来执行此操作。
python manage.py migrate
在您的情况下,您需要在容器内运行迁移。 Cookiecutter-Django docs给出了如何执行此操作的说明:
docker-compose run django python manage.py migrate