最近的错误日志(python manage.py runserver):
Django version 3.2.6, using settings 'empoweru.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
Exception in thread django-main-thread:
Traceback (most recent call last):
File "D:\GA\venv\lib\site-packages\django\core\servers\basehttp.py", line 45, in get_internal_wsgi_application
return import_string(app_path)
File "D:\GA\venv\lib\site-packages\django\utils\module_loading.py", line 17, in import_string
module = import_module(module_path)
File "C:\Users\sweth\AppData\Local\Programs\Python\Python36\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 950, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "D:\GA\fitgirl-inc\empoweru\wsgi.py", line 16, in <module>
application = get_wsgi_application()
File "D:\GA\venv\lib\site-packages\django\core\wsgi.py", line 13, in get_wsgi_application
return WSGIHandler()
File "D:\GA\venv\lib\site-packages\django\core\handlers\wsgi.py", line 127, in __init__
self.load_middleware()
File "D:\GA\venv\lib\site-packages\django\core\handlers\base.py", line 40, in load_middleware
middleware = import_string(middleware_path)
File "D:\GA\venv\lib\site-packages\django\utils\module_loading.py", line 17, in import_string
module = import_module(module_path)
File "C:\Users\sweth\AppData\Local\Programs\Python\Python36\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 'wagtail.core.middleware'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\sweth\AppData\Local\Programs\Python\Python36\lib\threading.py", line 916, in _bootstrap_inner
self.run()
File "C:\Users\sweth\AppData\Local\Programs\Python\Python36\lib\threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "D:\GA\venv\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "D:\GA\venv\lib\site-packages\django\core\management\commands\runserver.py", line 138, in inner_run
handler = self.get_handler(*args, **options)
File "D:\GA\venv\lib\site-packages\django\contrib\staticfiles\management\commands\runserver.py", line 27, in get_handler
handler = super().get_handler(*args, **options)
File "D:\GA\venv\lib\site-packages\django\core\management\commands\runserver.py", line 65, in get_handler
return get_internal_wsgi_application()
File "D:\GA\venv\lib\site-packages\django\core\servers\basehttp.py", line 50, in get_internal_wsgi_application
) from err
django.core.exceptions.ImproperlyConfigured: WSGI application 'empoweru.wsgi.application' could not be loaded; Error importing module.
==================================================== ================
更新:
我删除了数据库并在 pgAdmin 中创建了一个新数据库并执行了 python manage.py makemigrations 和 python manage.py migrate - 两者都有效。
当我运行 python manage.py runserver 时,我收到以下错误:
Exception in thread django-main-thread:
Traceback (most recent call last):
File "D:\GA\venv\lib\site-packages\django\core\servers\basehttp.py", line 45, in get_internal_wsgi_application
return import_string(app_path)
File "D:\GA\venv\lib\site-packages\django\utils\module_loading.py", line 17, in import_string
module = import_module(module_path)
File "C:\Users\sweth\AppData\Local\Programs\Python\Python36\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 950, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "D:\GA\fitgirl-inc\empoweru\wsgi.py", line 16, in <module>
application = get_wsgi_application()
File "D:\GA\venv\lib\site-packages\django\core\wsgi.py", line 13, in get_wsgi_application
return WSGIHandler()
File "D:\GA\venv\lib\site-packages\django\core\handlers\wsgi.py", line 127, in __init__
self.load_middleware()
File "D:\GA\venv\lib\site-packages\django\core\handlers\base.py", line 40, in load_middleware
middleware = import_string(middleware_path)
File "D:\GA\venv\lib\site-packages\django\utils\module_loading.py", line 17, in import_string
module = import_module(module_path)
File "C:\Users\sweth\AppData\Local\Programs\Python\Python36\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 936, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
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.wagtail'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\sweth\AppData\Local\Programs\Python\Python36\lib\threading.py", line 916, in _bootstrap_inner
self.run()
File "C:\Users\sweth\AppData\Local\Programs\Python\Python36\lib\threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "D:\GA\venv\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "D:\GA\venv\lib\site-packages\django\core\management\commands\runserver.py", line 138, in inner_run
handler = self.get_handler(*args, **options)
File "D:\GA\venv\lib\site-packages\django\contrib\staticfiles\management\commands\runserver.py", line 27, in get_handler
handler = super().get_handler(*args, **options)
File "D:\GA\venv\lib\site-packages\django\core\management\commands\runserver.py", line 65, in get_handler
return get_internal_wsgi_application()
File "D:\GA\venv\lib\site-packages\django\core\servers\basehttp.py", line 50, in get_internal_wsgi_application
) from err
django.core.exceptions.ImproperlyConfigured: WSGI application 'empoweru.wsgi.application' could not be loaded; Error importing module.
==================================================== ================ 我们正在开发一个 Django 项目并希望将软件包升级到最新版本。首先,我们尝试安装 requirements.txt 中提到的与项目相关的所有包。在安装 requirements.txt 文件中提到的包时,一些包需要升级。因此,我们相应地对其进行了升级,请在 requirements_new.txt(使用 pip freeze > requirements_new.txt 生成的文件)下找到项目中安装的最新包。我们能够成功安装所有软件包。但是,当我们执行 python manage.py makemigrations 时,我们收到以下错误:
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "D:\GA\venv\lib\site-packages\django\core\management\__init__.py", line 419, in execute_from_command_line
utility.execute()
File "D:\GA\venv\lib\site-packages\django\core\management\__init__.py", line 395, in execute
django.setup()
File "D:\GA\venv\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "D:\GA\venv\lib\site-packages\django\apps\registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "D:\GA\venv\lib\site-packages\django\apps\config.py", line 224, in create
import_module(entry)
File "C:\Users\sweth\AppData\Local\Programs\Python\Python36\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.wagtail'
请在 requirements_new.txt 中的软件包下方找到
anyascii==0.2.0
asgiref==3.4.1
atomicwrites==1.3.0
backports.zoneinfo==0.2.1
beautifulsoup4==4.9.3
bleach==3.1.4
boto3==1.11.10
botocore==1.14.10
certifi==2021.5.30
cffi==1.13.2
chardet==3.0.4
charset-normalizer==2.0.4
cssselect2==0.2.2
defusedxml==0.6.0
dj-database-url==0.5.0
Django==3.2.6
django-appconf==1.0.3
django-avatar==5.0.0
django-classy-tags==1.0.0
django-cogwheels==0.3
django-contrib-comments==1.9.2
django-cors-headers==3.8.0
django-crispy-forms==1.8.1
django-filter==2.4.0
django-formtools==2.2
django-imagekit==4.0.1
django-modelcluster==5.1
django-sekizai==1.1.0
django-social-share==1.3.2
django-storages==1.8
django-taggit==1.5.1
django-treebeard==4.5.1
django-webpack-loader==0.6.0
django-widget-tweaks==1.4.5
djangocms-admin-style==1.2.8
djangorestframework==3.12.4
docutils==0.15.2
draftjs-exporter==2.1.7
et-xmlfile==1.1.0
filebrowser-safe==0.5.0
future==0.18.2
grappelli-safe==0.5.2
gunicorn==19.9.0
html5lib==1.1
idna==3.2
importlib-resources==5.2.2
jmespath==0.9.4
l18n==2020.6.1
Mezzanine==4.3.1
numpy==1.19.5
oauthlib==3.1.0
openpyxl==3.0.7
pandas==0.25.3
pilkit==2.0
Pillow==8.3.1
psycopg2-binary==2.8.4
pycparser==2.19
PyJWT==2.1.0
Pyphen==0.9.5
python-dateutil==2.8.1
python-decouple==3.3
python3-openid==3.1.0
pytz==2021.1
requests==2.26.0
requests-oauthlib==1.3.0
rjsmin==1.1.0
s3transfer==0.3.2
semantic-version==2.8.5
six==1.16.0
social-auth-app-django==3.1.0
social-auth-core==3.2.0
soupsieve==2.2.1
sqlparse==0.4.1
tablib==3.0.0
telepath==0.2
tinycss2==0.6.1
toml==0.10.2
typing-extensions==3.10.0.0
tzdata==2021.1
tzlocal==2.0.0
Unidecode==1.1.1
urllib3==1.26.6
wagtail==2.14.1
wagtail-gallery==0.1.1
wagtailmenus==3.0.2
webencodings==0.5.1
whitenoise==5.0.1
Willow==1.4
xlrd==2.0.1
XlsxWriter==1.4.5
xlwt==1.3.0
zipp==3.5.0
请在 requirements.txt 中的软件包下方找到
asgiref==3.2.3
atomicwrites==1.3.0
beautifulsoup4==4.6.0
bleach==3.1.4
boto3==1.11.10
botocore==1.14.10
certifi==2019.11.28
cffi==1.13.2
chardet==3.0.4
cssselect2==0.2.2
defusedxml==0.6.0
dj-database-url==0.5.0
Django==2.2.10
django-appconf==1.0.3
django-avatar==5.0.0
django-classy-tags==1.0.0
django-cogwheels==0.3
django-compressor==2.4
django-contrib-comments==1.9.2
django-cors-headers==3.2.1
django-crispy-forms==1.8.1
django-formtools==2.2
django-imagekit==4.0.1
django-modelcluster==5.0.1
django-sekizai==1.1.0
django-social-share==1.3.2
django-storages==1.8
django-taggit==1.2.0
django-treebeard==4.3.1
django-webpack-loader==0.6.0
django-widget-tweaks==1.4.5
djangocms-admin-style==1.2.8
djangorestframework==3.11.0
docutils==0.15.2
draftjs-exporter==2.1.7
filebrowser-safe==0.5.0
future==0.18.2
grappelli-safe==0.5.2
gunicorn==19.9.0
html5lib==1.0.1
idna==2.8
jmespath==0.9.4
l18n==2018.5
Mezzanine==4.3.1
oauthlib==3.1.0
Pillow==6.2.2
psycopg2-binary==2.8.4
pycparser==2.19
PyJWT==1.7.1
Pyphen==0.9.5
python-dateutil==2.8.1
python-decouple==3.3
python3-openid==3.1.0
pytz==2019.3
rcssmin==1.0.6
requests==2.22.0
requests-oauthlib==1.3.0
rjsmin==1.1.0
s3transfer==0.3.2
six==1.14.0
social-auth-app-django==3.1.0
social-auth-core==3.2.0
sqlparse==0.3.0
tinycss2==0.6.1
tzlocal==2.0.0
Unidecode==1.1.1
urllib3==1.25.8
wagtail==2.8.2
wagtail-gallery==0.1.1
wagtailmenus==3.0
WeasyPrint==45
webencodings==0.5.1
whitenoise==5.0.1
Willow==1.3
pandas
请在下面找到应用程序列表
INSTALLED_APPS = [
'account.apps.AccountConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.postgres',
'wagtail.contrib.forms',
'wagtail.contrib.redirects',
'wagtail.contrib.modeladmin',
'wagtail.embeds',
'wagtail.sites',
'wagtail.users',
'wagtail.snippets',
'wagtail.documents',
'wagtail.images',
'wagtail.search',
'wagtail.admin',
'wagtail.core',
'modelcluster',
'taggit',
'empoweru',
'avatar',
'assessment',
'home',
'week',
'widget_tweaks',
'wagtailmenus',
'crispy_forms',
'imagekit',
'storages',
'wagtail_gallery',
'wagtail.contrib.routable_page',
'django_social_share',
'webpack_loader',
'dashboard',
'rest_framework',
]
请在下面找到中间件部分:
MIDDLEWARE = [
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'wagtail.core.middleware.SiteMiddleware',
'wagtail.contrib.redirects.middleware.RedirectMiddleware',
]
有人可以帮我们解决问题吗?