0
我想在使用wsgi的Ubuntu VPS中部署FLASK應用程序,但出現內部服務器錯誤。檢查apache.log給了我以下錯誤:無法解析在WSGI/Apache上運行的Flask應用程序中的路徑
No such file or directory: 'files/filesystem/filesystem.pickle'.
我的目錄樹是這個樣子下/var/www/
:
dmft_seacrh_engine
files
filesystem
filesystem.pickle
dmft_search.wsgi
dmft_search
controllers
search.py
我試圖打開filesystem.pickle
內search.py
如下:
with open('/files/filesystem/filesystem.pickle', 'rb') as handle:
filesystem = pickle.load(handle)
dmft.wsgi
文件的內容有:
activate_this = '/opt/dmft/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this))
import sys
import logging
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"/var/www/dmft_search_engine")
from dmft_search import app as application
這是我的conf文件的外觀:
<VirtualHost *:80>
ServerName dmft_search_engine.com
WSGIScriptAlias//var/www/dmft_search_engine/dmft_search.wsgi
<Directory /var/www/dmft_search_engine/dmft_search/>
Order allow,deny
Allow from all
</Directory>
Alias /static /var/www/dmft_search_engine/dmft_search/static
<Directory /var/www/dmft_search_engine/dmft_search/static/>
Order allow,deny
Allow from all
</Directory>
Alias /files /var/www/dmft_search_engine/files/$
<Directory /var/www/dmft_search_engine/files/>$
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
請幫助我。我還在.conf文件中添加了一個/files
的別名。 我該如何解決這個問題?