我是直接下载课程提供的完整源码想运行下看看效果,前面这几步都做了
然后在虚拟环境下运行 python manage.py runserver
时出错
报错信息如下
(testvir) C:\Users\hello\Desktop\code\MxOnlie>python manage.py runserver
Traceback (most recent call last):
File "manage.py", line 11, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\hello\Envs\testvir\lib\site-packages\django\core\management\__init__.py", line 350, in execute_from_command_line
utility.execute()
File "C:\Users\hello\Envs\testvir\lib\site-packages\django\core\management\__init__.py", line 342, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\hello\Envs\testvir\lib\site-packages\django\core\management\__init__.py", line 176, in fetch_command
commands = get_commands()
File "C:\Users\hello\Envs\testvir\lib\site-packages\django\utils\lru_cache.py", line 100, in wrapper
result = user_function(*args, **kwds)
File "C:\Users\hello\Envs\testvir\lib\site-packages\django\core\management\__init__.py", line 71, in get_commands
for app_config in reversed(list(apps.get_app_configs())):
File "C:\Users\hello\Envs\testvir\lib\site-packages\django\apps\registry.py", line 137, in get_app_configs
self.check_apps_ready()
File "C:\Users\hello\Envs\testvir\lib\site-packages\django\apps\registry.py", line 124, in check_apps_ready
raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
安装的包如下
(testvir) C:\Users\hello\Desktop\code\MxOnlie>pip list
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Package Version
---------------------- ----------
certifi 2018.11.29
chardet 3.0.4
Django 1.9
django-crispy-forms 1.6.1
django-formtools 1.0
django-pure-pagination 0.3.0
django-simple-captcha 0.4.6
DjangoUeditor 1.8.143
httplib2 0.9.2
idna 2.8
MySQL-python 1.2.5
Pillow 3.4.2
pip 19.0.3
requests 2.21.0
setuptools 40.8.0
six 1.12.0
urllib3 1.24.1
wheel 0.33.1
在非虚拟环境下也出错,但报错信息有区别:
C:\Users\hello\Desktop\code\MxOnlie>python manage.py runserver
Unhandled exception in thread started by <function wrapper at 0x000000000472D4A8>
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\django\utils\autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "C:\Python27\lib\site-packages\django\core\management\commands\runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "C:\Python27\lib\site-packages\django\utils\autoreload.py", line 249, in raise_last_exception
six.reraise(*_exception)
File "C:\Python27\lib\site-packages\django\utils\autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "C:\Python27\lib\site-packages\django\__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Python27\lib\site-packages\django\apps\registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "C:\Python27\lib\site-packages\django\apps\config.py", line 90, in create
module = import_module(entry)
File "C:\Python27\lib\importlib\__init__.py", line 37, in import_module
__import__(name)
File "C:\Users\hello\Desktop\code\MxOnlie\extra_apps\xadmin\__init__.py", line 4, in <module>
from xadmin.sites import AdminSite, site
File "C:\Users\hello\Desktop\code\MxOnlie\extra_apps\xadmin\sites.py", line 3, in <module>
from future.utils import iteritems
ImportError: No module named future.utils
就像把代码跑起来,要怎么解决呀。