Django migration - disabel system checks

你离开我真会死。 提交于 2021-01-27 04:46:52

问题


I upgraded from Django 1.7 to Django 1.9. I have a number of migrations. Since the upgrade I can no longer create a fresh database.

The problem is that "django manage.py migrate" runs checks. The checks import the application urls. These ultimately import code that looks up the database.

I can get the migration to work, by modifying the migrate.py script and adding this line (as per Django: skip system check when running custom command):

 requires_system_checks = False

Is there a standard/supported way to prevent the system checks via a command line parameter, or is there a way to know that I am running in a management command during the url loading so that I can exclude the web-serving parts of the system?


回答1:


There is a way in the 3.0 version, there is a flag called --skip-checks which skips running system checks prior to running the command.



来源:https://stackoverflow.com/questions/35792376/django-migration-disabel-system-checks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!