Я клонирую репо из Git. Я создаю venv:
python -m venv myenv
/myenv/scripts/activate.bat
pip install -r requirements.txt
pip install mod_wsgi-4.6.5+ap24vc14-cp36-cp36m-win_amd64.whl
, если я запускаю из myvenv, что:
python manage.py runserver
это работает!
, если я запускаю из apache, у меня появляется ошибка:
[Wed Oct 30 10:51:18.732028 2019] [mpm_winnt:notice] [pid 352:tid 168] AH00455: Apache/2.4.41 (Win64) mod_wsgi/4.6.5 Python/3.6 configured -- resuming normal operations
[Wed Oct 30 10:51:18.732028 2019] [mpm_winnt:notice] [pid 352:tid 168] AH00456: Apache Lounge VS16 Server built: Aug 9 2019 16:46:32
[Wed Oct 30 10:51:18.732028 2019] [core:notice] [pid 352:tid 168] AH00094: Command line: 'httpd -d C:/Apache24'
[Wed Oct 30 10:51:18.732028 2019] [mpm_winnt:notice] [pid 352:tid 168] AH00418: Parent: Created child process 1748
Fatal Python error: Py_Initialize: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'
Current thread 0x00000354 (most recent call first):
[Wed Oct 30 10:51:23.677228 2019] [mpm_winnt:crit] [pid 352:tid 168] AH00419: master_main: create child process failed. Exiting.
ниже httpd.conf:
LoadFile "c:/<>/python/python36/python36.dll"
LoadModule wsgi_module "c:/envs/myproject/lib/site-packages/mod_wsgi/server/mod_wsgi.cp36-win_amd64.pyd"
WSGIScriptAlias / "c:/<myproject>/wsgi.py"
WSGIPythonHome "c:/envs/myproject"
WSGIPythonPath "c:/<myproject>"
Alias /static/ "c:/<myproject>/static/"
<Directory "c:/<myproject>/static">
Require all granted
</Directory>
<Directory c:/<myproject>>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
<Directory c:/<myproject>/attachments>
Require all granted
</Directory>
Я установил PYTHONHOME и PYTHONPATH как "C: \ Users \ user \ AppData \ Local \ Programs \ Python \ Python36; C: \ Users"\ user \ AppData \ Local \ Programs \ Python \ Python36 \ Scripts "
Я посмотрел много вопросов, например: Неустранимая ошибка Python в Windows 10 ModuleNotFoundError: Нет модуля с именем 'encodings' , но этоошибка только в apache.