2017-05-10 155 views
-1

我開發了一個python flask web應用程序,並試圖在使用mod_wsgi(Apache)的linux(ubuntu 12.04)機器中進行主機託管。但無法訪問該應用程序作爲顯示內部服務器錯誤的客戶端Web瀏覽器。無法使用mod_wsgi(Apache)部署Flask python web應用程序

在檢查apache錯誤日誌時,注意到以下錯誤。

[Wed May 10 16:08:11 2017] [error] [client 192.168.160.101] File "/var/www/FlaskApp/env/lib/python2.7/site-packages/werkzeug/http.py", line 28, in <module> 
[Wed May 10 16:08:11 2017] [error] [client 192.168.160.101]  from urllib.request import parse_http_list as _parse_list_header 
[Wed May 10 16:08:11 2017] [error] [client 192.168.160.101] ImportError: No module named request 

在我的系統,既python2.7和安裝Python的3.6(蟒蛇)和兩個蟒蛇--version和PIP -V顯示不同的Python解釋器,這是不匹配的Python解釋導致此問題。我已經在python2.x模式下編寫了代碼。

[email protected]:/var/www/FlaskApp/env/lib/python2.7/site-packages$ python --version 
Python 2.7.6 

[email protected]:/var/www/FlaskApp/env/lib/python2.7/site-packages$ pip -V 
pip 9.0.1 from /home/ccptriage/anaconda3/lib/python3.6/site-packages (python 3.6) 

我的Apache配置文件如下, 的/ etc/apache2的/網站可用/ FlaskApp

<VirtualHost *:80> 
    ServerName TVMTELXSI 
    ServerAdmin vysakh 
    #WSGIDaemonProcess FlaskApp threads=5 
    WSGIDaemonProcess FlaskApp python-path=/var/www/FlaskApp:/var/www/FlaskApp/env/lib/python2.7/site-packages 
    WSGIProcessGroup FlaskApp 
    WSGIScriptAlias//var/www/FlaskApp/flaskapp.wsgi 
    <Directory /var/www/FlaskApp/> 
     WSGIProcessGroup FlaskApp 
     Order allow,deny 
     Allow from all 
    </Directory> 
    ErrorLog ${APACHE_LOG_DIR}/error.log 
    LogLevel warn 
    CustomLog ${APACHE_LOG_DIR}/access.log combined 

能否請你讓別人幫我解決這個問題?

回答

相關問題