【发布时间】:2020-03-06 13:09:36
【问题描述】:
我使用 django-user-accounts==2.1.0 改进了注册表单。在我的本地服务器上一切正常,但在 heroku 服务器上我看到以下错误:
Django Version: 2.2.6
Exception Type: ProgrammingError
Exception Value:
relation "account_account" does not exist
LINE 1: ...nt"."timezone", "account_account"."language" FROM "account_a...
Exception Location: /app/.heroku/python/lib/python3.6/site-packages/django/db/backends/utils.py in _execute, line 84
我删除了数据库并再次makemigrations/migrate,它没有帮助。
我的 settings.py 的相关部分:
import dj_database_url
db_config = dj_database_url.config()
if db_config:
DATABASES['default'] = db_config
迁移命令的输出:
Operations to perform:
Apply all migrations: account, admin, auth, contenttypes, sessions, my_apps, sites
Running migrations:
No migrations to apply.
DATABASE_URL 也定义了:
heroku config
=== Config Vars
DATABASE_URL: postgres://bvki...longrul
这里我尝试获取表“account_account”:
>manage.py dbshell
SQLite version 3.30.1 2019-10-10 20:19:45
sqlite> SELECT * FROM "account_account";
1||1|lt
2||2|en
在sqlite中“account_account”存在!
但在此命令的输出中不是迁移“帐户”!
>heroku run python manage.py migrate
Running python manage.py migrate on ⬢ my-app... up, run.5012 (Free)
Operations to perform:
Apply all migrations: admin, auth, contenttypes, sessions, my_app
Running migrations:
No migrations to apply.
Your models have changes that are not yet reflected in a migration, and so won't be applied.
Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.
【问题讨论】:
标签: django django-authentication