python - 尝试在 python Django 中运行 Runserver 时出现运行时错误
问题描述
所以我收到了一个不是我的代码。我的目标是运行我收到的 Django 网站,因为他们告诉我一切正常。但是当我尝试运行 Runserver 时,我得到了这个错误:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\eneko\AppData\Local\Programs\Python\Python38-32\lib\site-
packages\django\core\management\__init__.py", line 353, in execute_from_command_line
utility.execute()
File "C:\Users\eneko\AppData\Local\Programs\Python\Python38-32\lib\site-
packages\django\core\management\__init__.py", line 327, in execute
django.setup()
File "C:\Users\eneko\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\__init__.py",
line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\eneko\AppData\Local\Programs\Python\Python38-32\lib\site-
packages\django\apps\registry.py", line 108, in populate
app_config.import_models(all_models)
File "C:\Users\eneko\AppData\Local\Programs\Python\Python38-32\lib\site-
packages\django\apps\config.py", line 202, in import_models
self.models_module = import_module(models_module_name)
File "C:\Users\eneko\AppData\Local\Programs\Python\Python38-32\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\eneko\AppData\Local\Programs\Python\Python38-32\lib\site-
packages\django\contrib\auth\models.py", line 4, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "C:\Users\eneko\AppData\Local\Programs\Python\Python38-32\lib\site-
packages\django\contrib\auth\base_user.py", line 49, in <module>
class AbstractBaseUser(models.Model):
RuntimeError: __class__ not set defining 'AbstractBaseUser' as <class
'django.contrib.auth.base_user.AbstractBaseUser'>. Was __classcell__ propagated to type.__new__?
这些是我的包版本:
Django 1.9.13 django-autoslug 1.9.7 pip 20.1.1
我的python版本是3.8.2
非常感谢您的帮助
解决方案
根据官方发布说明,Django 1.9 需要 Python 2.7、3.4 或 3.5
所以尝试使用python 3.5版
推荐阅读
- javascript - JS - 有没有办法在不丢失默认功能的情况下将 CSS 样式添加到 JSON 控制台日志消息?
- asp.net - IApplicationBuilder.UseBasePath 奇怪的行为?
- python - 在 python3 中导入超出顶级包失败
- java - 我收到一些关于 java 中无法访问的代码的错误,如何修复它。我用日食霓虹灯
- bash - fswatch 和 ffmpeg 中的输出文件扩展名
- qt - qInstallMessageHandler() 不返回文件行、文件名、函数名
- c# - 是否可以从 C# 链表中提取子列表?
- security - 获取托管在 IP 地址上的所有域
- wso2 - WSO2 API update REST API throwing exception
- wpf - 在画布上创建透明对象以通过 z-index 覆盖上一个对象