Я пытаюсь запустить мое приложение на VPS в режиме Debug=True
.Django + Apache + mod_wsgi = Плохой запрос (400)
Я использую Django 1.6 с Python 2.7.
Я пробовал простой скрипт wscgi и нашел, что он работает хорошо (в основном возвращает 200 и «Hello world» в текстовом/равнине) в браузер. Вот моя конфигурация:
виртуальный хост конфигурации
<VirtualHost *:80>
ServerName subdomain.domain.info
ServerAlias www.subdomain.sigizmund.info
WSGIScriptAlias//var/www/subdomain/index.wsgi
Alias /static/ /var/www/subdomain/static/
ErrorLog /tmp/subdomain.error.log
CustomLog /tmp/subdomain.custom.log common
LogLevel debug
<Location "/static/">
Options -Indexes
</Location>
<Directory /home/sgzmd/code/myproject>
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
index.wsgi
import os
import sys
import site
# Add the site-packages of the chosen virtualenv to work with
site.addsitedir('/home/sgzmd/.virtualenvs/myenv/local/lib/python2.7/site-packages')
PROJECT_PATH = '/home/sgzmd/code/myproject'
if PROJECT_PATH not in sys.path:
sys.path.insert(0, PROJECT_PATH)
os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings'
# Activate your virtual env
activate_env=os.path.expanduser("~/.virtualenvs/myenv/bin/activate_this.py")
execfile(activate_env, dict(__file__=activate_env))
import django.core.handlers.wsgi
import cStringIO
import pprint
class LoggingMiddleware:
def __init__(self, application):
self.__application = application
def __call__(self, environ, start_response):
errors = environ['wsgi.errors']
pprint.pprint(('REQUEST', environ), stream=errors)
def _start_response(status, headers, *args):
pprint.pprint(('RESPONSE', status, headers), stream=errors)
return start_response(status, headers, *args)
return self.__application(environ, _start_response)
application = LoggingMiddleware(django.core.handlers.wsgi.WSGIHandler())
Я следующий вывод каротаж: http://pastebin.com/SnZVEeT1 (от LoggingMiddleware) и /var/log/django/error.log
в то время как создается и воссоздан, остается полностью пустым.
я понял, что приложение загружается, отредактировав settings.py моего проекта, содержание которого доступно здесь: http://pastebin.com/Byr8RStb
Оценил любые указатели и идеи, так как я в основном из вариантов в настоящее время.