我刚刚创建了 Django 项目并运行了服务器。 它工作正常,但向我显示了类似的警告
You have 14 unapplied migration(s)...
然后我跑了
python manage.py migrate
在终端中。它有效,但向我展示了这个
?: (1_7.W001) MIDDLEWARE_CLASSES is not set.
HINT: Django 1.7 changed the global defaults for the MIDDLEWARE_CLASSES.
django.contrib.sessions.middleware.SessionMiddleware, django.contrib.auth.middleware.AuthenticationMiddleware, and django.contrib.messages.middleware.MessageMiddleware were removed from the defaults. If your project needs these middleware then you should configure this setting.
现在我在启动服务器后收到此警告。
You have 3 unapplied migration(s).
Your project may not work properly until you apply
the migrations for app(s): admin, auth.
那么我该如何正确迁移才能摆脱这个警告呢?
我正在使用 PyCharm 并尝试通过 PyCharm 和终端创建项目,但遇到了同样的问题。
~$ python3.5 --version
Python 3.5.2
>>> django.VERSION
(1, 10, 1, 'final', 1)
最佳答案
所以我的问题是我使用了错误的 python 版本进行迁移。
python3.5 manage.py migrate
解决问题。
关于python - 您有 3 个未应用的迁移。在您为应用程序 : admin, auth 应用迁移之前,您的项目可能无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39469409/