pip 安装就直接安装django2.2.6了,运行项目一直报 错

来源:3-6 migrations原理及表生成

qq_萱紫_0

2019-11-09

G:\python3.7\install\python.exe D:/pycharm/MxShop/manage.py runserver 0.0.0.0:8000
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File “G:\python3.7\install\lib\threading.py”, line 926, in _bootstrap_inner
self.run()
File “G:\python3.7\install\lib\threading.py”, line 870, in run
self._target(*self.args, **self.kwargs)
File “G:\python3.7\install\lib\site-packages\django\utils\autoreload.py”, line 54, in wrapper
fn(*args, **kwargs)
File “G:\python3.7\install\lib\site-packages\django\core\management\commands\runserver.py”, line 109, in inner_run
autoreload.raise_last_exception()
File “G:\python3.7\install\lib\site-packages\django\utils\autoreload.py”, line 77, in raise_last_exception
raise exception[1]
File "G:\python3.7\install\lib\site-packages\django\core\management_init
.py", line 337, in execute
autoreload.check_errors(django.setup)()
File “G:\python3.7\install\lib\site-packages\django\utils\autoreload.py”, line 54, in wrapper
fn(*args, **kwargs)
File "G:\python3.7\install\lib\site-packages\django_init
.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File “G:\python3.7\install\lib\site-packages\django\apps\registry.py”, line 91, in populate
app_config = AppConfig.create(entry)
File “G:\python3.7\install\lib\site-packages\django\apps\config.py”, line 90, in create
module = import_module(entry)
File "G:\python3.7\install\lib\importlib_init
.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “

根据网上方法url中加import os, django

os.environ.setdefault(“DJANGO_SETTINGS_MODULE”, “MxShop.settings”)

django.setup()

from extra_apps.xadmin.plugins import xversion

xadmin.autodiscover()
xversion.register_models()

urlpatterns = [
path(r’^xadmin/’, xadmin.site.urls),
# url(r’^comments/’, include(‘django_comments.urls’)),
# path(r’^xadmin/’, xadmin.site.urls),
]
也没有用,试了很多方法也没用

写回答

2回答

qq_萱紫_0

提问者

2019-11-13

G:\python3.7\install\python.exe D:/pycharm/MxShop/manage.py runserver 0.0.0.0:8000

Watching for file changes with StatReloader

Exception in thread django-main-thread:

Traceback (most recent call last):

  File "G:\python3.7\install\lib\threading.py", line 926, in _bootstrap_inner

    self.run()

  File "G:\python3.7\install\lib\threading.py", line 870, in run

    self._target(*self._args, **self._kwargs)

  File "G:\python3.7\install\lib\site-packages\django\utils\autoreload.py", line 54, in wrapper

    fn(*args, **kwargs)

  File "G:\python3.7\install\lib\site-packages\django\core\management\commands\runserver.py", line 109, in inner_run

    autoreload.raise_last_exception()

  File "G:\python3.7\install\lib\site-packages\django\utils\autoreload.py", line 77, in raise_last_exception

    raise _exception[1]

  File "G:\python3.7\install\lib\site-packages\django\core\management\__init__.py", line 337, in execute

    autoreload.check_errors(django.setup)()

  File "G:\python3.7\install\lib\site-packages\django\utils\autoreload.py", line 54, in wrapper

    fn(*args, **kwargs)

  File "G:\python3.7\install\lib\site-packages\django\__init__.py", line 24, in setup

    apps.populate(settings.INSTALLED_APPS)

  File "G:\python3.7\install\lib\site-packages\django\apps\registry.py", line 91, in populate

    app_config = AppConfig.create(entry)

  File "G:\python3.7\install\lib\site-packages\django\apps\config.py", line 90, in create

    module = import_module(entry)

  File "G:\python3.7\install\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 953, in _find_and_load_unlocked

  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed

  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 "D:\pycharm\MxShop\extra_apps\xadmin\models.py", line 6, in <module>

    from django.contrib.contenttypes.models import ContentType

  File "G:\python3.7\install\lib\site-packages\django\contrib\contenttypes\models.py", line 133, in <module>

    class ContentType(models.Model):

  File "G:\python3.7\install\lib\site-packages\django\db\models\base.py", line 103, in __new__

    app_config = apps.get_containing_app_config(module)

  File "G:\python3.7\install\lib\site-packages\django\apps\registry.py", line 252, in get_containing_app_config

    self.check_apps_ready()

  File "G:\python3.7\install\lib\site-packages\django\apps\registry.py", line 135, in check_apps_ready

    raise AppRegistryNotReady("Apps aren't loaded yet.")

django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.

这是全部报错


0
4
qq_萱紫_0
回复
bobby
老师你什么时候帮我看问题
2019-12-15
共4条回复

bobby

2019-11-11

有些关键的报错信息你没有贴上来。你可以把完整的错误信息截图我看看。需要完整一点的,而且这里最好不要使用django2.2. 因为课程中的xadmin在django2.2下面可能会有点问题,不过课程本身的内容是支持django2.2的

0
1
qq_萱紫_0
我把全部报错贴出来了,请老师解答一下
2019-11-13
共1条回复

Python前后端分离开发Vue+Django REST framework实战

Django REST framework课程视频,RESTFul API前后端分离开发

2873 学习 · 2457 问题

查看课程