Приветствую. Использую:
- Windows 10 64-bits
- Apache 2.4 VC14
- Python 3.6
Скачал скомпилированный пакет mod_wsgi‑4.5.17+ap24vc14‑cp36‑cp36m‑win_amd64.whl из данного источника
Используя команду pip install
установил данный пакет. С помощью команды
mod_wsgi-express module-config
Получил следующий конфиг для апача:
LoadFile "c:/program files/python36/python36.dll"
LoadModule wsgi_module "c:/program files/python36/lib/site-packages/mod_wsgi/server/mod_wsgi.cp36-win_amd64.pyd"
WSGIPythonHome "c:/program files/python36"
Добавил его в httpd.conf. Запустил апач, открыл localhost, смотрю загловки ответа. Вижу там: Server:Apache/2.4.27 (Win64) mod_wsgi/4.5.17 Python/3.6
Как я понимаю, это значит - что mod_wsgi успешно установился на Apache. Добавляю в httpd.conf:
WSGIScriptAlias /wsgi "D:/test/django.py"
<Directory "D:/test">
<Files django.py>
Require all granted
</Files>
</Directory>
Содержимое файла django.py следующее:
def application(environ, start_response):
status = '200 OK'
output = 'Hello World!'
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
Перезапустил апач, открыл localhost/wsgi и получил ошибку 500 Internal Server Error Иду в логи апача и там:
[Tue Aug 08 11:06:08.389722 2017] [wsgi:error] [pid 1228:tid 1260] [client ::1:54302] mod_wsgi (pid=1228): Exception occurred processing WSGI script 'D:/test/django.py'.
[Tue Aug 08 11:06:08.390722 2017] [wsgi:error] [pid 1228:tid 1260] [client ::1:54302] TypeError: sequence of byte string values expected, value of type str found\r
Может у кого есть идеи как исправить данную ошибку?