qq_47596224
qq_47596224
采纳率100%
2021-03-01 22:33

大佬们Django配置模板和数据库时遇到这种情况能提供些思路吗,两天了 快崩溃?

已采纳

Traceback (most recent call last):
  File "D:\py\lib\site-packages\django\apps\config.py", line 118, in create
    cls = getattr(mod, cls_name)
AttributeError: module 'django.contrib' has no attribute 'sessions'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "D:\py\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "D:\py\lib\site-packages\django\core\management\__init__.py", line 357, in execute
    django.setup()
  File "D:\py\lib\site-packages\django\__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "D:\py\lib\site-packages\django\apps\registry.py", line 89, in populate
    app_config = AppConfig.create(entry)
  File "D:\py\lib\site-packages\django\apps\config.py", line 123, in create
    import_module(entry)
  File "D:\py\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 978, in _gcd_import
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 948, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'django.contrib.sessions'
 

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • clc_vi clc_vi 1月前

    你可以按照教程重新生成一个空django项目,重新走一遍配置,再移代码

    点赞 评论 复制链接分享