Django你好

时间:2016-11-14 12:51:32

标签: python django apache

我正在尝试使用mod-wsgi在apache2上部署一个来自here的简单问候语。

但是我得到以下错误消息althogh我将ip和hostname添加到应用程序的settings.py中的ALLOWED_HOST。

DisallowedHost at /
Invalid HTTP_HOST header: '192.168.1.36:8000'. You may need to add u'192.168.1.36' to ALLOWED_HOSTS.
Request Method: GET
Request URL:    http://192.168.1.36:8000/
Django Version: 1.10.3
Exception Type: DisallowedHost
Exception Value:    
Invalid HTTP_HOST header: '192.168.1.36:8000'. You may need to add u'192.168.1.36' to ALLOWED_HOSTS.
Exception Location: /var/www/sampleapp/env/local/lib/python2.7/site-packages/django/http/request.py in get_host, line 113
Python Executable:  /var/www/sampleapp/env/bin/python
Python Version: 2.7.12
Python Path:    
['/var/www/sampleapp',
 '/var/www/sampleapp/env/lib/python2.7',
 '/var/www/sampleapp/env/lib/python2.7/plat-x86_64-linux-gnu',
 '/var/www/sampleapp/env/lib/python2.7/lib-tk',
 '/var/www/sampleapp/env/lib/python2.7/lib-old',
 '/var/www/sampleapp/env/lib/python2.7/lib-dynload',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-x86_64-linux-gnu',
 '/usr/lib/python2.7/lib-tk',
 '/var/www/sampleapp/env/local/lib/python2.7/site-packages',
 '/var/www/sampleapp/env/lib/python2.7/site-packages']
Server time:    Mon, 14 Nov 2016 12:11:35 +0000
Traceback Switch to copy-and-paste view

/var/www/sampleapp/env/local/lib/python2.7/site-packages/django/core/handlers/exception.py in inner
            response = get_response(request) ...
▶ Local vars
/var/www/sampleapp/env/local/lib/python2.7/site-packages/django/utils/deprecation.py in __call__
            response = self.process_request(request) ...
▶ Local vars
/var/www/sampleapp/env/local/lib/python2.7/site-packages/django/middleware/common.py in process_request
        host = request.get_host() ...
▶ Local vars
/var/www/sampleapp/env/local/lib/python2.7/site-packages/django/http/request.py in get_host
            raise DisallowedHost(msg) ...
▶ Local vars
Request information

GET
No GET data
POST
No POST data
FILES
No FILES data
COOKIES
No cookie data
META
Variable    Value
CLUTTER_IM_MODULE   
'xim'
COLORTERM   
'gnome-terminal'
COMPIZ_BIN_PATH 
'/usr/bin/'
COMPIZ_CONFIG_PROFILE   
'ubuntu-lowgfx'
CONTENT_LENGTH  
''
CONTENT_TYPE    
'text/plain'
DBUS_SESSION_BUS_ADDRESS    
'unix:abstract=/tmp/dbus-nvlHAS61ss'
DEFAULTS_PATH   
'/usr/share/gconf/ubuntu.default.path'
DESKTOP_SESSION 
'ubuntu'
DISPLAY 
':0'
DJANGO_SETTINGS_MODULE  
'sampleapp.settings'
GATEWAY_INTERFACE   
'CGI/1.1'
GDMSESSION  
'ubuntu'
GDM_LANG    
'en_CA'
GIO_LAUNCHED_DESKTOP_FILE   
'/usr/share/applications/terminator.desktop'
GIO_LAUNCHED_DESKTOP_FILE_PID   
'2612'
GNOME_DESKTOP_SESSION_ID    
'this-is-deprecated'
GNOME_KEYRING_CONTROL   
''
GNOME_KEYRING_PID   
''
GPG_AGENT_INFO  
'/home/mike/.gnupg/S.gpg-agent:0:1'
GTK2_MODULES    
'overlay-scrollbar'
GTK_IM_MODULE   
'ibus'
GTK_MODULES 
'gail:atk-bridge:unity-gtk-module'
HOME    
'/root'
HTTP_ACCEPT 
'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'
HTTP_ACCEPT_ENCODING    
'gzip, deflate, sdch'
HTTP_ACCEPT_LANGUAGE    
'en-GB,en;q=0.8,en-US;q=0.6,fa;q=0.4'
HTTP_CACHE_CONTROL  
'max-age=0'
HTTP_CONNECTION 
'keep-alive'
HTTP_HOST   
'192.168.1.36:8000'
HTTP_UPGRADE_INSECURE_REQUESTS  
'1'
HTTP_USER_AGENT 
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36'
IBUS_DISABLE_SNOOPER    
'1'
IM_CONFIG_PHASE 
'1'
INSTANCE    
''
JOB 
'unity-settings-daemon'
LANG    
'en_CA.UTF-8'
LANGUAGE    
'en_CA:en'
LESSCLOSE   
'/usr/bin/lesspipe %s %s'
LESSOPEN    
'| /usr/bin/lesspipe %s'
LIBGL_ALWAYS_SOFTWARE   
'1'
LOGNAME 
'root'
LS_COLORS   
'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:'
MAIL    
'/var/mail/root'
MANDATORY_PATH  
'/usr/share/gconf/ubuntu.mandatory.path'
OLDPWD  
'/home/mike/Desktop/work/django/firstdjango'
ORBIT_SOCKETDIR 
'/tmp/orbit-mike'
PATH    
'/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games'
PATH_INFO   
u'/'
PWD 
'/var/www/sampleapp'
QT4_IM_MODULE   
'xim'
QT_ACCESSIBILITY    
'1'
QT_IM_MODULE    
'ibus'
QT_LINUX_ACCESSIBILITY_ALWAYS_ON    
'1'
QT_QPA_PLATFORMTHEME    
'appmenu-qt5'
QUERY_STRING    
''
REMOTE_ADDR 
'192.168.1.36'
REMOTE_HOST 
''
REQUEST_METHOD  
'GET'
RUN_MAIN    
'true'
SCRIPT_NAME 
u''
SERVER_NAME 
'mike-VirtualBox'
SERVER_PORT 
'8000'
SERVER_PROTOCOL 
'HTTP/1.1'
SERVER_SOFTWARE 
'WSGIServer/0.1 Python/2.7.12'
SESSION 
'ubuntu'
SESSIONTYPE 
'gnome-session'
SESSION_MANAGER 
'local/mike-VirtualBox:@/tmp/.ICE-unix/1783,unix/mike-VirtualBox:/tmp/.ICE-unix/1783'
SHELL   
'/bin/bash'
SHLVL   
'2'
SSH_AUTH_SOCK   
'/run/user/1000/keyring/ssh'
TERM    
'xterm'
TERMINATOR_UUID 
'urn:uuid:5595b3e0-976d-4792-8bda-d6c817f13a19'
TZ  
'UTC'
UPSTART_EVENTS  
'xsession started'
UPSTART_INSTANCE    
''
UPSTART_JOB 
'unity7'
UPSTART_SESSION 
'unix:abstract=/com/ubuntu/upstart-session/1000/1472'
USER    
'root'
WINDOWID    
'69206020'
XAUTHORITY  
'/home/mike/.Xauthority'
XDG_CONFIG_DIRS 
'/etc/xdg/xdg-ubuntu:/usr/share/upstart/xdg:/etc/xdg'
XDG_CURRENT_DESKTOP 
'Unity'
XDG_DATA_DIRS   
'/usr/share/ubuntu:/usr/share/gnome:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop'
XDG_GREETER_DATA_DIR    
'/var/lib/lightdm-data/mike'
XDG_MENU_PREFIX 
'gnome-'
XDG_RUNTIME_DIR 
'/run/user/1000'
XDG_SEAT    
'seat0'
XDG_SEAT_PATH   
'/org/freedesktop/DisplayManager/Seat0'
XDG_SESSION_DESKTOP 
'ubuntu'
XDG_SESSION_ID  
'c2'
XDG_SESSION_PATH    
'/org/freedesktop/DisplayManager/Session0'
XDG_SESSION_TYPE    
'x11'
XDG_VTNR    
'7'
XMODIFIERS  
'@im=ibus'
_   
'env/bin/python'
wsgi.errors 
<open file '<stderr>', mode 'w' at 0x7efc37c341e0>
wsgi.file_wrapper   
''
wsgi.input  
<socket._fileobject object at 0x7efc339f8050>
wsgi.multiprocess   
False
wsgi.multithread    
True
wsgi.run_once   
False
wsgi.url_scheme 
'http'
wsgi.version    
(1, 0)
Settings
Using settings module sampleapp.settings
Setting Value
ABSOLUTE_URL_OVERRIDES  
{}
ADMINS  
[]
ALLOWED_HOSTS   
[]
APPEND_SLASH    
True
AUTHENTICATION_BACKENDS 
[u'django.contrib.auth.backends.ModelBackend']
AUTH_PASSWORD_VALIDATORS    
u'********************'
AUTH_USER_MODEL 
u'auth.User'
BASE_DIR    
'/var/www/sampleapp'
CACHES  
{u'default': {u'BACKEND': u'django.core.cache.backends.locmem.LocMemCache'}}
CACHE_MIDDLEWARE_ALIAS  
u'default'
CACHE_MIDDLEWARE_KEY_PREFIX 
u'********************'
CACHE_MIDDLEWARE_SECONDS    
600
CSRF_COOKIE_AGE 
31449600
CSRF_COOKIE_DOMAIN  
None
CSRF_COOKIE_HTTPONLY    
False
CSRF_COOKIE_NAME    
u'csrftoken'
CSRF_COOKIE_PATH    
u'/'
CSRF_COOKIE_SECURE  
False
CSRF_FAILURE_VIEW   
u'django.views.csrf.csrf_failure'
CSRF_HEADER_NAME    
u'HTTP_X_CSRFTOKEN'
CSRF_TRUSTED_ORIGINS    
[]
DATABASES   
{'default': {'ATOMIC_REQUESTS': False,
             'AUTOCOMMIT': True,
             'CONN_MAX_AGE': 0,
             'ENGINE': 'django.db.backends.sqlite3',
             'HOST': '',
             'NAME': '/var/www/sampleapp/db.sqlite3',
             'OPTIONS': {},
             'PASSWORD': u'********************',
             'PORT': '',
             'TEST': {'CHARSET': None,
                      'COLLATION': None,
                      'MIRROR': None,
                      'NAME': None},
             'TIME_ZONE': None,
             'USER': ''}}
DATABASE_ROUTERS    
[]
DATA_UPLOAD_MAX_MEMORY_SIZE 
2621440
DATA_UPLOAD_MAX_NUMBER_FIELDS   
1000
DATETIME_FORMAT 
u'N j, Y, P'
DATETIME_INPUT_FORMATS  
[u'%Y-%m-%d %H:%M:%S',
 u'%Y-%m-%d %H:%M:%S.%f',
 u'%Y-%m-%d %H:%M',
 u'%Y-%m-%d',
 u'%m/%d/%Y %H:%M:%S',
 u'%m/%d/%Y %H:%M:%S.%f',
 u'%m/%d/%Y %H:%M',
 u'%m/%d/%Y',
 u'%m/%d/%y %H:%M:%S',
 u'%m/%d/%y %H:%M:%S.%f',
 u'%m/%d/%y %H:%M',
 u'%m/%d/%y']
DATE_FORMAT 
u'N j, Y'
DATE_INPUT_FORMATS  
[u'%Y-%m-%d',
 u'%m/%d/%Y',
 u'%m/%d/%y',
 u'%b %d %Y',
 u'%b %d, %Y',
 u'%d %b %Y',
 u'%d %b, %Y',
 u'%B %d %Y',
 u'%B %d, %Y',
 u'%d %B %Y',
 u'%d %B, %Y']
DEBUG   
True
DEBUG_PROPAGATE_EXCEPTIONS  
False
DECIMAL_SEPARATOR   
u'.'
DEFAULT_CHARSET 
u'utf-8'
DEFAULT_CONTENT_TYPE    
u'text/html'
DEFAULT_EXCEPTION_REPORTER_FILTER   
u'django.views.debug.SafeExceptionReporterFilter'
DEFAULT_FILE_STORAGE    
u'django.core.files.storage.FileSystemStorage'
DEFAULT_FROM_EMAIL  
u'webmaster@localhost'
DEFAULT_INDEX_TABLESPACE    
u''
DEFAULT_TABLESPACE  
u''
DISALLOWED_USER_AGENTS  
[]
EMAIL_BACKEND   
u'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST  
u'localhost'
EMAIL_HOST_PASSWORD 
u'********************'
EMAIL_HOST_USER 
u''
EMAIL_PORT  
25
EMAIL_SSL_CERTFILE  
None
EMAIL_SSL_KEYFILE   
u'********************'
EMAIL_SUBJECT_PREFIX    
u'[Django] '
EMAIL_TIMEOUT   
None
EMAIL_USE_SSL   
False
EMAIL_USE_TLS   
False
FILE_CHARSET    
u'utf-8'
FILE_UPLOAD_DIRECTORY_PERMISSIONS   
None
FILE_UPLOAD_HANDLERS    
[u'django.core.files.uploadhandler.MemoryFileUploadHandler',
 u'django.core.files.uploadhandler.TemporaryFileUploadHandler']
FILE_UPLOAD_MAX_MEMORY_SIZE 
2621440
FILE_UPLOAD_PERMISSIONS 
None
FILE_UPLOAD_TEMP_DIR    
None
FIRST_DAY_OF_WEEK   
0
FIXTURE_DIRS    
[]
FORCE_SCRIPT_NAME   
None
FORMAT_MODULE_PATH  
None
IGNORABLE_404_URLS  
[]
INSTALLED_APPS  
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles']
INTERNAL_IPS    
[]
LANGUAGES   
[(u'af', u'Afrikaans'),
 (u'ar', u'Arabic'),
 (u'ast', u'Asturian'),
 (u'az', u'Azerbaijani'),
 (u'bg', u'Bulgarian'),
 (u'be', u'Belarusian'),
 (u'bn', u'Bengali'),
 (u'br', u'Breton'),
 (u'bs', u'Bosnian'),
 (u'ca', u'Catalan'),
 (u'cs', u'Czech'),
 (u'cy', u'Welsh'),
 (u'da', u'Danish'),
 (u'de', u'German'),
 (u'dsb', u'Lower Sorbian'),
 (u'el', u'Greek'),
 (u'en', u'English'),
 (u'en-au', u'Australian English'),
 (u'en-gb', u'British English'),
 (u'eo', u'Esperanto'),
 (u'es', u'Spanish'),
 (u'es-ar', u'Argentinian Spanish'),
 (u'es-co', u'Colombian Spanish'),
 (u'es-mx', u'Mexican Spanish'),
 (u'es-ni', u'Nicaraguan Spanish'),
 (u'es-ve', u'Venezuelan Spanish'),
 (u'et', u'Estonian'),
 (u'eu', u'Basque'),
 (u'fa', u'Persian'),
 (u'fi', u'Finnish'),
 (u'fr', u'French'),
 (u'fy', u'Frisian'),
 (u'ga', u'Irish'),
 (u'gd', u'Scottish Gaelic'),
 (u'gl', u'Galician'),
 (u'he', u'Hebrew'),
 (u'hi', u'Hindi'),
 (u'hr', u'Croatian'),
 (u'hsb', u'Upper Sorbian'),
 (u'hu', u'Hungarian'),
 (u'ia', u'Interlingua'),
 (u'id', u'Indonesian'),
 (u'io', u'Ido'),
 (u'is', u'Icelandic'),
 (u'it', u'Italian'),
 (u'ja', u'Japanese'),
 (u'ka', u'Georgian'),
 (u'kk', u'Kazakh'),
 (u'km', u'Khmer'),
 (u'kn', u'Kannada'),
 (u'ko', u'Korean'),
 (u'lb', u'Luxembourgish'),
 (u'lt', u'Lithuanian'),
 (u'lv', u'Latvian'),
 (u'mk', u'Macedonian'),
 (u'ml', u'Malayalam'),
 (u'mn', u'Mongolian'),
 (u'mr', u'Marathi'),
 (u'my', u'Burmese'),
 (u'nb', u'Norwegian Bokm\xe5l'),
 (u'ne', u'Nepali'),
 (u'nl', u'Dutch'),
 (u'nn', u'Norwegian Nynorsk'),
 (u'os', u'Ossetic'),
 (u'pa', u'Punjabi'),
 (u'pl', u'Polish'),
 (u'pt', u'Portuguese'),
 (u'pt-br', u'Brazilian Portuguese'),
 (u'ro', u'Romanian'),
 (u'ru', u'Russian'),
 (u'sk', u'Slovak'),
 (u'sl', u'Slovenian'),
 (u'sq', u'Albanian'),
 (u'sr', u'Serbian'),
 (u'sr-latn', u'Serbian Latin'),
 (u'sv', u'Swedish'),
 (u'sw', u'Swahili'),
 (u'ta', u'Tamil'),
 (u'te', u'Telugu'),
 (u'th', u'Thai'),
 (u'tr', u'Turkish'),
 (u'tt', u'Tatar'),
 (u'udm', u'Udmurt'),
 (u'uk', u'Ukrainian'),
 (u'ur', u'Urdu'),
 (u'vi', u'Vietnamese'),
 (u'zh-hans', u'Simplified Chinese'),
 (u'zh-hant', u'Traditional Chinese')]
LANGUAGES_BIDI  
[u'he', u'ar', u'fa', u'ur']
LANGUAGE_CODE   
'en-us'
LANGUAGE_COOKIE_AGE 
None
LANGUAGE_COOKIE_DOMAIN  
None
LANGUAGE_COOKIE_NAME    
u'django_language'
LANGUAGE_COOKIE_PATH    
u'/'
LOCALE_PATHS    
[]
LOGGING 
{}
LOGGING_CONFIG  
u'logging.config.dictConfig'
LOGIN_REDIRECT_URL  
u'/accounts/profile/'
LOGIN_URL   
u'/accounts/login/'
LOGOUT_REDIRECT_URL 
None
MANAGERS    
[]
MEDIA_ROOT  
u''
MEDIA_URL   
u''
MESSAGE_STORAGE 
u'django.contrib.messages.storage.fallback.FallbackStorage'
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']
MIDDLEWARE_CLASSES  
[u'django.middleware.common.CommonMiddleware',
 u'django.middleware.csrf.CsrfViewMiddleware']
MIGRATION_MODULES   
{}
MONTH_DAY_FORMAT    
u'F j'
NUMBER_GROUPING 
0
PASSWORD_HASHERS    
u'********************'
PASSWORD_RESET_TIMEOUT_DAYS 
u'********************'
PREPEND_WWW 
False
ROOT_URLCONF    
'sampleapp.urls'
SECRET_KEY  
u'********************'
SECURE_BROWSER_XSS_FILTER   
False
SECURE_CONTENT_TYPE_NOSNIFF 
False
SECURE_HSTS_INCLUDE_SUBDOMAINS  
False
SECURE_HSTS_SECONDS 
0
SECURE_PROXY_SSL_HEADER 
None
SECURE_REDIRECT_EXEMPT  
[]
SECURE_SSL_HOST 
None
SECURE_SSL_REDIRECT 
False
SERVER_EMAIL    
u'root@localhost'
SESSION_CACHE_ALIAS 
u'default'
SESSION_COOKIE_AGE  
1209600
SESSION_COOKIE_DOMAIN   
None
SESSION_COOKIE_HTTPONLY 
True
SESSION_COOKIE_NAME 
u'sessionid'
SESSION_COOKIE_PATH 
u'/'
SESSION_COOKIE_SECURE   
False
SESSION_ENGINE  
u'django.contrib.sessions.backends.db'
SESSION_EXPIRE_AT_BROWSER_CLOSE 
False
SESSION_FILE_PATH   
None
SESSION_SAVE_EVERY_REQUEST  
False
SESSION_SERIALIZER  
u'django.contrib.sessions.serializers.JSONSerializer'
SETTINGS_MODULE 
'sampleapp.settings'
SHORT_DATETIME_FORMAT   
u'm/d/Y P'
SHORT_DATE_FORMAT   
u'm/d/Y'
SIGNING_BACKEND 
u'django.core.signing.TimestampSigner'
SILENCED_SYSTEM_CHECKS  
[]
STATICFILES_DIRS    
[]
STATICFILES_FINDERS 
[u'django.contrib.staticfiles.finders.FileSystemFinder',
 u'django.contrib.staticfiles.finders.AppDirectoriesFinder']
STATICFILES_STORAGE 
u'django.contrib.staticfiles.storage.StaticFilesStorage'
STATIC_ROOT 
None
STATIC_URL  
'/static/'
TEMPLATES   
[{'APP_DIRS': True,
  'BACKEND': 'django.template.backends.django.DjangoTemplates',
  'DIRS': [],
  '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']}}]
TEST_NON_SERIALIZED_APPS    
[]
TEST_RUNNER 
u'django.test.runner.DiscoverRunner'
THOUSAND_SEPARATOR  
u','
TIME_FORMAT 
u'P'
TIME_INPUT_FORMATS  
[u'%H:%M:%S', u'%H:%M:%S.%f', u'%H:%M']
TIME_ZONE   
'UTC'
USE_ETAGS   
False
USE_I18N    
True
USE_L10N    
True
USE_THOUSAND_SEPARATOR  
False
USE_TZ  
True
USE_X_FORWARDED_HOST    
False
USE_X_FORWARDED_PORT    
False
WSGI_APPLICATION    
'sampleapp.wsgi.application'
X_FRAME_OPTIONS 
u'SAMEORIGIN'
YEAR_MONTH_FORMAT   
u'F Y'
You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard page generated by the handler for this status code.

请告诉我。

提前谢谢你。

1 个答案:

答案 0 :(得分:0)

请检查您的Apache VirtualHost设置,请参阅How to use Django with Apache and mod_wsgi

应该是这样的:

<VirtualHost *:8000>
    DocumentRoot "/home/user/sampleapp"

    Alias /static/ /home/user/sampleapp/static/

    <Directory /home/user/sampleapp/static>
        Require all granted
    </Directory>

    WSGIDaemonProcess sampleapp python-path=/home/user/sampleapp:/home/user/sampleapp/venv/lib/python2.7/site-packages
    WSGIProcessGroup sampleapp
    WSGIScriptAlias / /home/user/sampleapp/sampleapp/wsgi.py

    <Directory /home/user/sampleapp/sampleapp>
            <Files wsgi.py>
                Require all granted
            </Files>
    </Directory>

</VirtualHost>

此外,您还可以从本文link获取更多信息。