我是 django 的新手,我正在做一个课程,在 pythonanywhere 上部署了一些应用程序,到目前为止效果很好。不,我被卡住了,因为根本不加载。Pythonanywhere 说出了点问题。这是来自 pythonanywhere 的错误日志。运行 WSGI 应用程序时出错 ModuleNotFoundError: No module named 'django_extensions' 这是我的 WSGI 文件
"""
WSGI config for mysite project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
application = get_wsgi_application()
这是我的 settings.py 文件,不是整个文件,而是已安装的应用程序:
DEBUG = True
ALLOWED_HOSTS = ['*']
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize',
'ads.apps.AdsConfig',
# Extensions - installed with pip3 / requirements.txt
'django_extensions',
'crispy_forms',
'rest_framework',
'social_django',
'taggit',
'home.apps.HomeConfig',
]
这是我的 urls.py,不是全部,而是关键部分。
import os
from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls import url
from django.contrib.auth import views as auth_views
from django.views.static import serve
urlpatterns = [
path('', include('home.urls')), # Change to ads.urls
path('ads/', include('ads.urls')),
path('admin/', admin.site.urls), # Keep
path('accounts/', include('django.contrib.auth.urls')), # Keep
# url(r'^oauth/', include('social_django.urls', namespace='social')), # Keep
]
我检查了 django 版本,要求已安装。我仔细检查了点子列表。
运行 python3 manage.py 检查没有错误。我可以毫无错误地进行所有迁移。我不知道在哪里寻找问题。我已经做了 3 或 4 个这些迷你应用程序,我没有遇到这个问题。wsgi 指向 mysite.settings 并且 settings.py 有 django_extensions 作为 INSTALLES APPS。问题是什么?请帮忙