编辑:我现在稍微进一步,但新问题是渲染模板。当我转到任何URL时,我在日志中收到以下错误消息:
服务器:666 /出现此错误
[error] [client 192.168.100.109] client denied by server configuration: C:/I4/importicusindex.html
和服务器:666 / export提供此错误
error] [client 192.168.100.109] client denied by server configuration: C:/I4/importicusexport
它必须读取.py文件,因为它知道在访问“/”时查找index.html或者这只是默认行为吗?
我正在努力使用MOD_WSGI在Windows上的APACHE中运行我的应用程序。我已经在这里浏览了几个答案并尝试按照文档进行操作但无济于事。
应用程序本身使用flask的内置服务器运行良好。
C:\ 6-14 \ importicus \ WSGI \ importicus.WSGI
import sys
sys.path.append('c:/i4/importicus/')
activate_this = 'c:/i4/importicus/importicus.py'
execfile(activate_this, dict(__file__=activate_this))
import importicus as importicus
vhosts文件
<VirtualHost *:666>
ServerAdmin imats@copyright.com.au
DocumentRoot "c:/i4/importicus"
ErrorLog c:/i4/importicus/logs/engine-error_log
CustomLog c:/i4/importicus/logs/engine-access_log common
Alias /media c:/i4/importicus/static
<Directory c:/i4/importicus>
Order deny,allow
Allow from all
</Directory>
WSGIScriptAlias /wsgi z:\i4\importicus\wsgi\importicus.wsgi
<Directory c:/i4/importicus/wsgi>
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
C:\ 6-14 \ importicus \ importicus.py
from flask import Flask, render_template,jsonify, request
from werkzeug import secure_filename
import importicus_functions
import ast, os, sys
importicus_main = Flask(__name__)
UPLOAD_FOLDER = 'uploads'
importicus_main.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
#print importicus_main.config.keys()#['ROOT_PATH']='C:/IMATS-Project/legacy import scripts/importicus/'
importicus_main.debug=True
@importicus_main.route('/')
def importicus():
return render_template('splash.html')
我得到的唯一错误是:
禁止
您无权访问此服务器上的/。
所以apache显然找到了WSGI文件,但我怀疑是我没有正确运行烧瓶应用程序。
任何帮助将不胜感激! 谢谢!
答案 0 :(得分:1)
WSGIScriptAlias /wsgi z:\i4\importicus\wsgi\importicus.wsgi
是问题所在,您会注意到所有其他路径都在 c:,而不是 z:
真气!