问题描述
错误当我尝试 runserver 时,我的django应用程序如下所示:
The error I get when I try to runserver for my django app is as follows:
在我遵循这个heroku教程后发生了这种情况:
This happened after I followed this heroku tutorial: https://devcenter.heroku.com/articles/getting-started-with-django
I修改设置文件以包含:
I modified the settings file to include:
import dj_database_url SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') import os BASE_DIR = os.path.dirname(os.path.abspath(__file__)) STATIC_ROOT = 'staticfiles' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } #DATABASES['default'] = dj_database_url.config() STATIC_URL = '/static/' STATICFILES_DIRS = ( os.path.join(BASE_DIR, 'tasks/static'), )
我的 0001_initial 迁移如下所示:
from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('auth', '0007_alter_validators_add_error_messages'), migrations.swappable_dependency(settings.AUTH_USER_MODEL), ]
我失去了我应该尝试的内容修复这个错误。建议感激!谢谢!
I'm lost as to what I should try next to fix this error. Advice appreciated! Thank you!
推荐答案
您的迁移对另一个应用程序()中的迁移有依赖性,这显然不存在。如果您在auth应用中删除或移动/合并迁移,这可能是原因。如果您从此迁移中删除了有问题的迁移,请确保auth包中的'0007'迁移(检查您的源代码修订历史记录)中的更改已应用于您的当前数据库,并且您应该没有明确地继续移民。我还会考虑检查项目中的其他应用程序是否依赖于来自'auth'的缺少迁移。干杯。
your migration has a dependency on a migration in another app () which apparently doesn't exist. if you've removed or moved/consolidation migrations in the 'auth' app, this is possibly why. if you remove the offending migration from this migration, just make sure changes from the '0007' migration in the auth package (check your source code revision history) have already been applied to your current database and you should be fine to continue without that explicit migration. i would also consider checking if any other apps in your project depend on those missing migrations from 'auth'. cheers.
(u'auth', u'0007_alter_validators_add_error_messages')
这篇关于Django NodeNotFoundError在迁移期间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!