heroku 希禄无此表:尝试运行创建超级用户时出现auth_user错误

ycl3bljg  于 2022-11-13  发布在  其他
关注(0)|答案(1)|浏览(104)

我试图创建我的Django应用程序w/ Heroku,但是我被这个错误卡住了。我看到了一些关于Heroku不能使用sqllite的信息,所以我一直试图更新到postgres,但不知道为什么没有反映在这里。
sqlite3.OperationalError:无此表:验证用户

heroku run python3 manage.py createsuperuser

 ›   Warning: heroku update available from 7.41.0 to 7.60.1.
Running python3 manage.py createsuperuser on ⬢ generic-heroku-app... up, run.5883 (Free)
On development database

You have 18 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.
Traceback (most recent call last):
  File "/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py", line 423, in execute
    return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: no such table: auth_user
  • 数据库来自settings.py *
import dj_database_url
db_from_env = dj_database_url.config(conn_max_age=600)
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': '**',
        'USER': '**',
        'PASSWORD': '**',
        'HOST': '127.0.0.1',
        'PORT': '5432',
    }
}

编辑:这个线程显示了一些坚实的信息,但我仍然不能似乎使它与此信息工作.不知道我哪里出错了.. "no such table" error on Heroku after django syncdb passed
如有任何帮助,我们将不胜感激!

fxnxkyjh

fxnxkyjh1#

If your project is connected with github deploy, then in your project, in Procfile, add:

release: python manage.py migrate
web: gunicorn myproject.wsgi

相关问题