晚上好, 我試圖在天藍色的雲上設置hello world應用程序。我下面的教程Django hello world web app on windows server vmDjango Hello World虛擬機上的Hello World網絡應用程序
做的所有設置,當我瀏覽到http://localhost/
我獲得以下錯誤而讀WSGI處理程序發生
錯誤後:回溯(最近通話最後一個) : 在主env中,文件「c:\ users \ compUser \ appdata \ local \ programs \ python \ python36 \ lib \ site-packages \ wfastcgi.py」,行791,handler = read_wsgi_handler(response.physical_path) File「 c:\ users \ compUser \ appdata \ local \ programs \ python \ python36 \ lib \ site-packages \ wfastcgi.py「,第633行,在re ad_wsgi_handler handler = get_wsgi_handler(os.getenv(「WSGI_HANDLER」)) get_wsgi_handler中的第605行文件「c:\ users \ compUser \ appdata \ local \ programs \ python \ python36 \ lib \ site-packages \ wfastcgi.py」 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(中間件路徑) 文件「c:\ users \ compUser \ appdata \ local \ programs \ python \ python36 \ lib \ site-packages \ django \ utils \ module_loading.py」,第20行,位於import_string module = import_module(module_path) File 「C:\用戶\ compUser \應用程序數據\本地\程序\ pytho在import_module中返回__pootstrap._gcd_import(name [level:],package,level) 文件「 _find_and_load 文件 「」,線路955,在_find_and_load_unlocked 文件 「」,線路665,在_load_unlocked 文件 「」,線路678,在exec_module 文件 「」,線路219,在_call_with_frames_removed 文件「C:\用戶\ compUser \ appdata \ local \ programs \ python \ python36 \ lib \ site-packages \ django \ contrib \ auth \ middleware.py「,第4行,從django.contrib.auth.backends導入RemoteUserBackend 文件」c:\ users \ compuser \ appdata \ local \ programs \ python \ python36 \ lib \ site-packages \ django \ contrib \ auth \ backends.py「,第4行,來自django.contrib.auth.models導入權限 從django.contrib.auth.base_user導入文件「c:\ users \ compUser \ appdata \ local \ programs \ python \ python36 \ lib \ site-packages \ django \ contrib \ auth \ models.py」 AbstractBaseUser,BaseUserManager 類AbstractBaseUser(models.Model)中的第52行文件「c:\ users \ compUser \ appdata \ local \ programs \ python \ python36 \ lib \ site-packages \ django \ contrib \ auth \ base_user.py」 ): 文件「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) get_containing_app_config中的文件「c:\ users \ compUser \ appdata \ local \ programs \ python \ python36 \ lib \ site-packages \ django \ apps \ registry.py」,第247行self.check_apps_ready() 文件「c:\ users \ compUser \ appdata \ local \ programs \ python \ python36 \ lib \ site-packages \ django \ apps \ registry.py「,第125行,在check_apps_ready raise AppRegistryNotReady(」應用程序尚未加載「。)django.core.exceptions.AppRegistryNotReady:應用程序尚未加載。的StdOut:STDERR:
我在一些後看到,人們建議增加django.setup()像獨立的應用程序,沒有工作或我把在錯誤的地方。我試圖運行python manage.py runserver,它運行時沒有錯誤。
以下是我的網頁。配置文件
<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/'
它看起來沒有設置DJANGO_SETTINGS_MODULE。無論運行您的wsgi應用程序如何WFastCGI,將有一個配置文件需要將您的項目目錄添加到PYTHONPATH環境變量,並設置DJANGO_SETTINGS_MODULE環境變量。 – Thtu
添加了config和setting.py文件。這些文件不受教程的影響。只是web.config的值被更改爲符合我的設置。 – FurqanRauf