我在ubuntu服务器上使用python3.6,apache2和mod_wsgi开发了flask应用程序。 但是显然我的应用程序正在运行python2,所以发生了一些错误,这困扰着我。 我认为我的python路径是正确的...
这是wsgi文件(catalog.wsgi);
#!/usr/bin/python3
import sys
import logging
import os
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"/var/www/ItemCatalogApp/")
from catalogApp import app as application
这是我的apache配置文件(/etc/apache2/sites-available/catalogApp.conf);
<VirtualHost *:80>
ServerName xx3.xxx.xxx.xx
ServerAlias example.com
WSGIScriptAlias / /var/www/ItemCatalogApp/catalog.wsgi
WSGIDaemonProcess ItemCatalog python-path=/var/www/ItemCatalogApp/venv/lib/python3.6/site-packages
<Directory /var/www/ItemCatalogApp>
WSGIProcessGroup ItemCatalogApp
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>