-1
好的,這是我在有人試圖訪問服務器時收到的錯誤。 (從error_log中)mod_wsgi httpd和Flask應用程序的導入錯誤
錯誤
[Wed Dec 14 11:49:12 2016] [error] [client 10.0.2.15] mod_wsgi (pid=19122): Target WSGI script '/var/www/QuickSearch/quicksearch.wsgi' cannot be loaded as Python module.
[Wed Dec 14 11:49:12 2016] [error] [client 10.0.2.15] mod_wsgi (pid=19122): Exception occurred processing WSGI script '/var/www/QuickSearch/quicksearch.wsgi'.
[Wed Dec 14 11:49:12 2016] [error] [client 10.0.2.15] Traceback (most recent call last):
[Wed Dec 14 11:49:12 2016] [error] [client 10.0.2.15] File "/var/www/QuickSearch/quicksearch.wsgi", line 12, in <module>
[Wed Dec 14 11:49:12 2016] [error] [client 10.0.2.15] from quicksearch import app
[Wed Dec 14 11:49:12 2016] [error] [client 10.0.2.15] File "/var/www/QuickSearch/QuickSearch/quicksearch.py", line 5, in <module>
[Wed Dec 14 11:49:12 2016] [error] [client 10.0.2.15] from flask import Flask
[Wed Dec 14 11:49:12 2016] [error] [client 10.0.2.15] File "/usr/lib/python2.6/site-packages/flask/__init__.py", line 19, in <module>
[Wed Dec 14 11:49:12 2016] [error] [client 10.0.2.15] from jinja2 import Markup, escape
[Wed Dec 14 11:49:12 2016] [error] [client 10.0.2.15] ImportError: No module named jinja2
我的目錄
quicksearch.py是主要的應用,剩下的就是HTML ECT的網站
/var/www/QuickSearch/
|-- QuickSearch
| |-- __init__.py
| |-- quicksearch.py
| |-- static
| | |-- css
| | |-- fonts
| | `-- js
| `-- templates
`-- quicksearch.wsgi
quicksearch.wsgi
#!/usr/bin/env /usr/prod/mts/platform/sandboxes/rhel6/mts-build-09/bin/python
import sys
import logging
logging.basicConfig(stream=sys.stderr)
activate_this = '/var/www/QuickSearch/QuickSearch/venv/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this))
sys.path.insert(0,"/var/www/QuickSearch/QuickSearch/")
sys.path.append("/var/www/QuickSearch/")
from quicksearch import app as application
quicksearch.conf
這是服務器
WSGIPythonPath "/var/www/QuickSearch/QuickSearch/venv/lib64/python2.7/site-packages"
<VirtualHost *:80>
ServerName 10.0.2.15
WSGIScriptAlias//var/www/QuickSearch/quicksearch.wsgi
WSGIScriptReloading On
<Directory /var/www/QuickSearch/QuickSearch/>
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
我完全茫然的配置文件,我一直在試圖解決這一兩天,不知道下一步怎麼辦。我已經看過類似的線程,但仍未找到解決方案。如果您需要任何信息來幫助解決此問題,請發佈。謝謝。