晚上好,我正在尝试在天蓝 Cloud 上设置你好世界的应用程序 . 我正在按照教程Django hello world web app on windows server vm
完成所有设置后,我导航到http://localhost/
我得到以下错误
读取WSGI处理程序时发生错误:Traceback(最近一次调用最后一次):文件“c:\ users \ compUser \ appdata \ local \ programs \ python \ python36 \ lib \ site-packages \ wfastcgi.py”,第791行, main env,handler = read_wsgi_handler(response.physical_path)文件“c:\ users \ compUser \ appdata \ local \ programs \ python \ python36 \ lib \ site-packages \ wfastcgi.py”,第633行,read_wsgi_handler handler = get_wsgi_handler( os.getenv(“WSGI_HANDLER”))文件“c:\ users \ compUser \ appdata \ local \ programs \ python \ python36 \ lib \ site-packages \ wfastcgi.py”,第605行,get_wsgi_handler handler = handler()文件“c:\ users \ compUser \ appdata \ local \ programs \ python \ python36 \ lib \ site-packages \ django \ core \ handlers \ wsgi.py”,第151行,在init self.load_middleware()文件“c:\ users \ compUser \ appdata \ local \ programs \ python \ python36 \ lib \ site-packages \ django \ core \ handlers \ base.py“,第81行,在load_middleware middleware = import_string(middleware_path)文件”c:\ users \ compUser \应用程序数据\本地\程序\ python的\ python36 \ LIB \站点包\ Django的\ utils \ module_loading.py“,第20行,在import_string module = import_module(module_path)文件”c:\ users \ compUser \ appdata \ local \ programs \ python \ python36 \ lib \ importlib__init __ . py“,第126行,在import_module中返回_bootstrap._gcd_import(name [level:],package,level)文件“”,行994,在_gcd_import文件“”,第971行,在_find_and_load文件“”,第955行,在_find_and_load_unlocked文件“”,第665行,在_load_unlocked中文件“”,第678行,在exec_module文件“”,第219行,在_call_with_frames_removed文件“c:\ users \ compUser \ appdata \ local \ programs \ python \ python36 \ lib \ site-packages \ django \ contrib \ auth \ middleware .j“,第4行,来自django.contrib.auth.backends导入RemoteUserBackend文件”c:\ users \ compUser \ appdata \ local \ programs \ python \ python36 \ lib \ site-packages \ django \ contrib \ auth \ backends .j“,第4行,来自django.contrib.auth.models导入权限文件”c:\ users \ compUser \ appdata \ local \ programs \ python \ python36 \ lib \ site-packages \ django \ contrib \ auth \ models .j“,第4行,来自django . contrib.auth.base_user导入AbstractBaseUser,BaseUserManager文件“c:\ users \ compUser \ appdata \ local \ programs \ python \ python36 \ lib \ site-packages \ django \ contrib \ auth \ base_user.py”,第52行,在课堂上AbstractBaseUser(models.Model):文件“c:\ users \ compUser \ appdata \ local \ programs \ python \ python36 \ lib \ site-packages \ django \ db \ models \ base.py”,第110行,在新的app_config = apps.get_containing_app_config(module)文件“c:\ users \ compUser \ appdata \ local \ programs \ python \ python36 \ lib \ site-packages \ django \ apps \ registry.py”,第247行,get_containing_app_config self.check_apps_ready()文件“c:\ users \ compUser \ appdata \ local \ programs \ python \ python36 \ lib \ site-packages \ django \ apps \ registry.py”,第125行,在check_apps_ready中引发AppRegistryNotReady(“尚未加载应用程序 . “)django.core.exceptions.AppRegistryNotReady:尚未加载应用 . StdOut:StdErr:
我在一些帖子中看到,人们建议添加django.setup(),就像独立的应用程序一样,不起作用或我把它放在错误的位置 . 我试图运行python manage.py runserver,它运行没有错误 .
以下是我的web.config文件
<configuration>
<appSettings>
<add key="WSGI_HANDLER" value="django.core.handlers.wsgi.WSGIHandler()" />
<add key="PYTHONPATH" value="C:\inetpub\wwwroot\resumeApp" />
<add key="DJANGO_SETTINGS_MODULE" value="resumeApp.settings" />
<!-- optional settings -->
<add key="WSGI_LOG" value="C:\inetpub\wwwroot\resumeApp\Logs\resumeApp.log" />
</appSettings>
<system.webServer>
<handlers>
<add name="Python FastCGI"
path="*"
verb="*"
modules="FastCgiModule"
scriptProcessor="c:\users\compUser\appdata\local\programs\python\python36\python.exe|c:\users\compUser\appdata\local\programs\python\python36\lib\site-packages\wfastcgi.py"
resourceType="Unspecified" />
</handlers>
</system.webServer>
这是我的settings.py
"""enter code hereDjango settings for resumeApp project.
Generated by 'django-admin startproject' using Django 1.11.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '<removed>'
# SECURITY WARNING: don't run with debug turned on in production!
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',
]
MIDDLEWARE = [
'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',
]
ROOT_URLCONF = 'resumeApp.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'resumeApp.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Password validation
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/1.11/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.11/howto/static-files/
STATIC_URL = '/static/'
1 回答
在
web.config
中,替换:有:
参考django source code .