所以我有一个适用于Django 1.8和Python 2.7的现有项目。
我试过在Django 1.9和Python 3.5.1下运行该项目......
但是我遇到了问题,我在运行时没有在新数据库中创建表格
python3.5 manage.py migrate
以下是我看到的日志:
[gpsp@localhost gpsp]$ python3.5 manage.py migrate
/usr/local/lib/python3.5/site-packages/django/template/utils.py:37: RemovedInDjango110Warning: You haven't defined a TEMPLATES setting. You must do so before upgrading to Django 1.10. Otherwise Django will be unable to load templates.
"unable to load templates.", RemovedInDjango110Warning)
/home/gpsp/gpsp/gpsp/urls.py:36: RemovedInDjango110Warning: django.conf.urls.patterns() is deprecated and will be removed in Django 1.10. Update your urlpatterns to be a list of django.conf.urls.url() instances instead.
url(r'^admin/', include(admin.site.urls)),
/usr/local/lib/python3.5/site-packages/django/conf/urls/__init__.py:89: RemovedInDjango110Warning: Support for string view arguments to url() is deprecated and will be removed in Django 1.10 (got loginregistration.views.login). Pass the callable instead.
t = url(prefix=prefix, *t)
/usr/local/lib/python3.5/site-packages/django/conf/urls/__init__.py:89: RemovedInDjango110Warning: Support for string view arguments to url() is deprecated and will be removed in Django 1.10 (got loginregistration.views.logout). Pass the callable instead.
t = url(prefix=prefix, *t)
/usr/local/lib/python3.5/site-packages/django/conf/urls/__init__.py:89: RemovedInDjango110Warning: Support for string view arguments to url() is deprecated and will be removed in Django 1.10 (got loginregistration.views.register). Pass the callable instead.
t = url(prefix=prefix, *t)
/usr/local/lib/python3.5/site-packages/django/conf/urls/__init__.py:89: RemovedInDjango110Warning: Support for string view arguments to url() is deprecated and will be removed in Django 1.10 (got puzzles.views.mypuzzles). Pass the callable instead.
t = url(prefix=prefix, *t)
/usr/local/lib/python3.5/site-packages/django/conf/urls/__init__.py:89: RemovedInDjango110Warning: Support for string view arguments to url() is deprecated and will be removed in Django 1.10 (got createpuzzle.views.planning). Pass the callable instead.
t = url(prefix=prefix, *t)
/usr/local/lib/python3.5/site-packages/django/conf/urls/__init__.py:89: RemovedInDjango110Warning: Support for string view arguments to url() is deprecated and will be removed in Django 1.10 (got createpuzzle.views.submitplan). Pass the callable instead.
t = url(prefix=prefix, *t)
/usr/local/lib/python3.5/site-packages/django/conf/urls/__init__.py:89: RemovedInDjango110Warning: Support for string view arguments to url() is deprecated and will be removed in Django 1.10 (got play.views.request_piece). Pass the callable instead.
t = url(prefix=prefix, *t)
/usr/local/lib/python3.5/site-packages/django/conf/urls/__init__.py:89: RemovedInDjango110Warning: Support for string view arguments to url() is deprecated and will be removed in Django 1.10 (got play.views.localplay). Pass the callable instead.
t = url(prefix=prefix, *t)
/usr/local/lib/python3.5/site-packages/django/conf/urls/__init__.py:89: RemovedInDjango110Warning: Support for string view arguments to url() is deprecated and will be removed in Django 1.10 (got applicationtester.views.googlemaps). Pass the callable instead.
t = url(prefix=prefix, *t)
/usr/local/lib/python3.5/site-packages/django/conf/urls/__init__.py:89: RemovedInDjango110Warning: Support for string view arguments to url() is deprecated and will be removed in Django 1.10 (got applicationtester.views.widget). Pass the callable instead.
t = url(prefix=prefix, *t)
/home/gpsp/gpsp/gpsp/urls.py:42: RemovedInDjango110Warning: django.conf.urls.patterns() is deprecated and will be removed in Django 1.10. Update your urlpatterns to be a list of django.conf.urls.url() instances instead.
(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
/usr/local/lib/python3.5/site-packages/django/conf/urls/__init__.py:89: RemovedInDjango110Warning: Support for string view arguments to url() is deprecated and will be removed in Django 1.10 (got django.views.static.serve). Pass the callable instead.
t = url(prefix=prefix, *t)
Operations to perform:
Apply all migrations: admin, contenttypes, sessions, auth
Running migrations:
Rendering model states... DONE
Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying admin.0001_initial... OK
Applying admin.0002_logentry_remove_auto_add... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying auth.0007_alter_validators_add_error_messages... OK
Applying sessions.0001_initial... OK
[gpsp@localhost gpsp]$
所有这些折旧警告都会阻止创建表吗?
所有应用程序都安装在settings.py中。
答案 0 :(得分:2)
首先需要为您的应用创建迁移文件:
python manage.py makemigrations app_name
如果您希望这适用于所有应用:
python manage.py makemigrations
然后迁移这些方案
python manage.py migrate
<强>更新强>:
您需要将应用插入INSTALLED_APPS