Я создал flask .conf
<VirtualHost *:80>
ServerName 10.174.134.93
ServerAlias www.itk.com
ServerAdmin root@admin.com
DocumentRoot /opt/automation/automation_itk_romita
WSGIDaemonProcess python-path=/root/.virtualenvs/itk':/root/.virtualenvs/itk/lib/python3.7/site-packages
#WSGIProcessGroup apache
WSGIScriptAlias / /opt/automation/automation_itk_romita/wsgi/flask.wsgi
WSGIScriptReloading On
<Directory /opt/automation/automation_itk_romita/>
Options Indexes MultiViews
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
И flask .wsgi
#!/usr/bin/python3.7
import os
import sys
##Virtualenv Settings
activate_this = '/root/.virtualenvs/itk/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this))
##Replace the standard out
sys.stdout = sys.stderr
##Add this file path to sys.path in order to import settings
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), '../..'))
##Add this file path to sys.path in order to import app
sys.path.append('/opt/automation/automation_itk_romita/')
from executor import app as application
Запуск его на CentOs 7 systemctl перезапустите httpd
Ошибка ниже:
[Thu Mar 26 01:08:54.462633 2020] [lbmethod_heartbeat:notice] [pid 17539] AH02282: No slotmem from mod_heartmonitor
[Thu Mar 26 01:08:54.470487 2020] [mpm_prefork:notice] [pid 17539] AH00163: Apache/2.4.6 (CentOS) mod_wsgi/3.4 Python/2.7.5 configured -- resuming normal operations
[Thu Mar 26 01:08:54.470546 2020] [core:notice] [pid 17539] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Thu Mar 26 01:09:01.728261 2020] [:error] [pid 17542] [client 100.94.108.148:56772] mod_wsgi (pid=17542): Target WSGI script '/opt/automation/automation_itk_romita/wsgi/flask.wsgi' cannot be loaded as Python module.
[Thu Mar 26 01:09:01.728320 2020] [:error] [pid 17542] [client 100.94.108.148:56772] mod_wsgi (pid=17542): Exception occurred processing WSGI script '/opt/automation/automation_itk_romita/wsgi/flask.wsgi'.
[Thu Mar 26 01:09:01.728338 2020] [:error] [pid 17542] [client 100.94.108.148:56772] Traceback (most recent call last):
[Thu Mar 26 01:09:01.728354 2020] [:error] [pid 17542] [client 100.94.108.148:56772] File "/opt/automation/automation_itk_romita/wsgi/flask.wsgi", line 8, in <module>
[Thu Mar 26 01:09:01.728414 2020] [:error] [pid 17542] [client 100.94.108.148:56772] execfile(activate_this, dict(__file__=activate_this))
[Thu Mar 26 01:09:01.728430 2020] [:error] [pid 17542] [client 100.94.108.148:56772] IOError: [Errno 13] Permission denied: '/root/.virtualenvs/itk/bin/activate_this.py'
Я использую Python 3.7, Centos 7 с Flask приложением: создан virtualenv ( itk ) с mkvirtualenv.
Я что-то не так делаю? Я пытался chown -R
, даже chmod -R 777
, но ничего не получалось.