Django项目启动报错
大家都说python简单,然后算是好奇心吧驱使着我学习python,就是想看下到底是不是像大家说的那样特别简单呢!!!^_^
网上搜索的视频,照猫画虎完成了django项目搭建,嘴角微微上扬,启动的时候却报错了,emmmmmmmm.......,(你们是不是也遇到过呢)
E:\python\djangoTest\venv\Scripts\python.exe E:/xypython/djangoTest/manage.py runserver 127.0.0.1:8000
Performing system checks...
Watching for file changes with StatReloader
System check identified no issues (0 silenced).
You have 17 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.
April 24, 2020 - 17:22:15
Django version 3.0.5, using settings 'djangoTest.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
E:\python\djangoTest\web\views.py changed, reloading.
Performing system checks...
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "D:\software\python3.7.6\python\lib\threading.py", line 926, in _bootstrap_inner
self.run()
File "D:\software\python3.7.6\python\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "E:\python\djangoTest\venv\lib\site-packages\django\utils\autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "E:\python\djangoTest\venv\lib\site-packages\django\core\management\commands\runserver.py", line 117, in inner_run
self.check(display_num_errors=True)
File "E:\python\djangoTest\venv\lib\site-packages\django\core\management\base.py", line 395, in check
include_deployment_checks=include_deployment_checks,
File "E:\python\djangoTest\venv\lib\site-packages\django\core\management\base.py", line 382, in _run_checks
return checks.run_checks(**kwargs)
File "E:\python\djangoTest\venv\lib\site-packages\django\core\checks\registry.py", line 72, in run_checks
new_errors = check(app_configs=app_configs)
File "E:\python\djangoTest\venv\lib\site-packages\django\core\checks\urls.py", line 13, in check_url_config
return check_resolver(resolver)
File "E:\python\djangoTest\venv\lib\site-packages\django\core\checks\urls.py", line 23, in check_resolver
return check_method()
File "E:\python\djangoTest\venv\lib\site-packages\django\urls\resolvers.py", line 407, in check
for pattern in self.url_patterns:
File "E:\python\djangoTest\venv\lib\site-packages\django\utils\functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "E:\python\djangoTest\venv\lib\site-packages\django\urls\resolvers.py", line 588, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "E:\python\djangoTest\venv\lib\site-packages\django\utils\functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "E:\python\djangoTest\venv\lib\site-packages\django\urls\resolvers.py", line 581, in urlconf_module
return import_module(self.urlconf_name)
File "D:\software\python3.7.6\python\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "E:\python\djangoTest\djangoTest\urls.py", line 20, in <module>
from web.views import Login
File "E:\python\djangoTest\web\views.py", line 5
from __future__ import unicode_literals
^
SyntaxError: from __future__ imports must occur at the beginning of the file
============================================================================================
修改代码之前:
=================================================================================================
修改之后:
重新启动项目:---启动成功了吆!!!撒花✿✿ヽ(°▽°)ノ✿✿✿ヽ(°▽°)ノ✿✿✿ヽ(°▽°)ノ✿