老师xadmin安装问题

老师xadmin安装问题

http://img1.sycdn.imooc.com//climg/5f81cc7d09bb0fbc19050964.jpg启动服务器报错代码:

Microsoft Windows [版本 6.1.7601]

版权所有 (c) 2009 Microsoft Corporation。保留所有权利。


(django) C:\Users\Administrator\Desktop\py_learn\django_mall>python manage.py runserver

Performing system checks...


Exception ignored in thread started by: <function check_errors.<locals>.wrapper at 0x0000000004004040>

Traceback (most recent call last):

  File "C:\envs\django\lib\site-packages\django\utils\autoreload.py", line 228, in wrapper

    fn(*args, **kwargs)

  File "C:\envs\django\lib\site-packages\django\core\management\commands\runserver.py", line 124, in inner_run

    self.check(display_num_errors=True)

  File "C:\envs\django\lib\site-packages\django\core\management\base.py", line 356, in check

    all_issues = self._run_checks(

  File "C:\envs\django\lib\site-packages\django\core\management\base.py", line 346, in _run_checks

    return checks.run_checks(**kwargs)

  File "C:\envs\django\lib\site-packages\django\core\checks\registry.py", line 81, in run_checks

    new_errors = check(app_configs=app_configs)

  File "C:\envs\django\lib\site-packages\django\core\checks\urls.py", line 16, in check_url_config

    return check_resolver(resolver)

  File "C:\envs\django\lib\site-packages\django\core\checks\urls.py", line 26, in check_resolver

    return check_method()

  File "C:\envs\django\lib\site-packages\django\urls\resolvers.py", line 256, in check

    for pattern in self.url_patterns:

  File "C:\envs\django\lib\site-packages\django\utils\functional.py", line 35, in __get__

    res = instance.__dict__[self.name] = self.func(instance)

  File "C:\envs\django\lib\site-packages\django\urls\resolvers.py", line 407, in url_patterns

    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)

  File "C:\envs\django\lib\site-packages\django\utils\functional.py", line 35, in __get__

    res = instance.__dict__[self.name] = self.func(instance)

  File "C:\envs\django\lib\site-packages\django\urls\resolvers.py", line 400, in urlconf_module

    return import_module(self.urlconf_name)

  File "d:\python\lib\importlib\__init__.py", line 127, in import_module

    return _bootstrap._gcd_import(name[level:], package, level)

  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import

  File "<frozen importlib._bootstrap>", line 991, in _find_and_load

  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked

  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked

  File "<frozen importlib._bootstrap_external>", line 783, in exec_module

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

  File "C:\Users\Administrator\Desktop\py_learn\django_mall\django_mall\urls.py", line 21, in <module>

    from extra_apps import xadmin

  File "C:\Users\Administrator\Desktop\py_learn\django_mall\extra_apps\xadmin\__init__.py", line 4, in <module>

    from xadmin.sites import AdminSite, site

  File "C:\Users\Administrator\Desktop\py_learn\django_mall\extra_apps\xadmin\__init__.py", line 4, in <module>

    from xadmin.sites import AdminSite, site

  File "C:\Users\Administrator\Desktop\py_learn\django_mall\extra_apps\xadmin\sites.py", line 3, in <module>

    from future.utils import iteritems

ModuleNotFoundError: No module named 'future'



老师我根据安装教程安装了xadmin和设置了,不知道哪里有问题,还有执行python manage.pu migrate也报错http://img1.sycdn.imooc.com//climg/5f81cd4609cc234e10030662.jpg

正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

1回答
好帮手慕燕燕 2020-10-11 14:13:56

同学,你好

1、可以先用pip list命令查看xadmin的依赖是否都安装成功了,如:

    django>=1.9.0 
    django-crispy-forms>=1.6.0 
    django-import-export>=0.5.1 
    django-reversion>=2.0.0 
    django-formtools==1.0 
    future==0.15.2 
    httplib2==0.9.2 
    six==1.10.0

从错误信息看future是没有安装的

2、如果没有安装,可以执行以下命令进行安装:pip install xx进行安装

3、然后再重新启动服务器

加油,祝学习愉快~~~


  • 提问者 Buck_messic #1
    老师安装了 future,django-crispy-forms,django-reversion,后执行又报错: from django.urls import reverse, re_path ImportError: cannot import name 're_path' from 'django.urls' (C:\envs\django\lib\site-packages\django\urls\__init__.py)
    2020-10-11 20:03:32
  • 好帮手慕美 回复 提问者 Buck_messic #2
    同学,你好。 1、re_path是django2中的语法,同学可以看下项目中使用的django和xadmin的版本。 2、若django版本与课程中一致,同学可以下载教辅区中提供的xadmin安装包及教程来安装xadmin 祝学习愉快~~~~
    2020-10-12 10:32:39
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
3.从网页搭建入门Python Web
  • 参与学习           人
  • 提交作业       218    份
  • 解答问题       3562    个

本阶段带你用Python开发一个网站,学习主流框架Django+Flask是Python Web开发的第一步,在基础知识上实现积分商城的项目开发,体验真实的项目开发流程,提高解决编程问题和效率的能力。

了解课程
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师