[英]flask, mod_wsgi, apache: Importerror:
我有一個問題是使用wsgi在apache2上部署燒瓶應用程序。 我想我已經嘗試過在這個網站上提出的每個解決方案,但沒有任何幫助。 每個輸入或建議都表示贊賞。
這是我的文件和日志
apache conf
WSGIScriptAlias /wsgi D:/microblog/test/wsgi.py
<Directory D:/microblog/test>
AllowOverride None
Options None
Order deny,allow
Allow from all
</Directory>
wsgi.py
import sys
from test import app as application
sys.path.insert(0, 'D:/microblog/test')
_ init _.py
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
import sys
app = Flask(__name__)
app.config.from_pyfile("app_config.py")
app.debug = True
@app.route('/')
def hello_world():
return "hi"
app.run()
apache日志
[Wed Apr 09 09:52:27 2014] [error] [client 127.0.0.1] mod_wsgi (pid=3368):
Exception occurred processing WSGI script 'D:/microblog/test/wsgi.py'.
[Wed Apr 09 09:52:27 2014] [error] [client 127.0.0.1] Traceback (most recent call last):
[Wed Apr 09 09:52:27 2014] [error] [client 127.0.0.1] File "D://microblog/test/wsgi.py", line 2, in <module>
[Wed Apr 09 09:52:27 2014] [error] [client 127.0.0.1] from test import app as application
[Wed Apr 09 09:52:27 2014] [error] [client 127.0.0.1] ImportError: cannot import name app
謝謝!
在Apache配置中使用WSGIPythonPath指令告訴mod_wsgi您的項目代碼在哪里。 不知道你的代碼結構,但嘗試:
WSGIPythonPath /microblog/test
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.