我试图让 Flask 在 Windows 上运行 apache,我遇到了下面的错误消息。关于可能导致此问题的任何想法?
错误信息:
mod_wsgi (pid=4380): Exception occurred processing WSGI script 'C:/I4/importicus/importicus.wsgi'.
[Fri Nov 30 14:47:47 2012] [error] [client 192.168.100.109] Traceback (most recent call last):
[Fri Nov 30 14:47:47 2012] [error] [client 192.168.100.109] File "C:\\Python26\\lib\\site-packages\\flask-0.9-py2.6.egg\\flask\\app.py", line 1701, in __call__
[Fri Nov 30 14:47:47 2012] [error] [client 192.168.100.109] return self.wsgi_app(environ, start_response)
[Fri Nov 30 14:47:47 2012] [error] [client 192.168.100.109] File "C:\\Python26\\lib\\site-packages\\flask-0.9-py2.6.egg\\flask\\app.py", line 1689, in wsgi_app
[Fri Nov 30 14:47:47 2012] [error] [client 192.168.100.109] response = self.make_response(self.handle_exception(e))
[Fri Nov 30 14:47:47 2012] [error] [client 192.168.100.109] File "C:\\Python26\\lib\\site-packages\\flask-0.9-py2.6.egg\\flask\\app.py", line 1687, in wsgi_app
[Fri Nov 30 14:47:47 2012] [error] [client 192.168.100.109] response = self.full_dispatch_request()
[Fri Nov 30 14:47:47 2012] [error] [client 192.168.100.109] File "C:\\Python26\\lib\\site-packages\\flask-0.9-py2.6.egg\\flask\\app.py", line 1360, in full_dispatch_request
[Fri Nov 30 14:47:47 2012] [error] [client 192.168.100.109] rv = self.handle_user_exception(e)
[Fri Nov 30 14:47:47 2012] [error] [client 192.168.100.109] File "C:\\Python26\\lib\\site-packages\\flask-0.9-py2.6.egg\\flask\\app.py", line 1358, in full_dispatch_request
[Fri Nov 30 14:47:47 2012] [error] [client 192.168.100.109] rv = self.dispatch_request()
[Fri Nov 30 14:47:47 2012] [error] [client 192.168.100.109] File "C:\\Python26\\lib\\site-packages\\flask-0.9-py2.6.egg\\flask\\app.py", line 1344, in dispatch_request
[Fri Nov 30 14:47:47 2012] [error] [client 192.168.100.109] return self.view_functions[rule.endpoint](**req.view_args)
[Fri Nov 30 14:47:47 2012] [error] [client 192.168.100.109] TypeError: application() takes exactly 2 arguments (0 given)
我的 WSGI 文件如下所示:
import sys
sys.path.insert(0, "c:\i4\importicus")
from importicus import importicus_main as application
application.debug = True
我的应用程序文件如下所示:
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'
TEMPLATE_FOLDER = 'templates'
importicus_main.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
importicus_main.config['TEMPLATE_FOLDER'] = TEMPLATE_FOLDER
@importicus_main.route('/')
def application(environ, start_response):
status = '200 OK'
output = "Hello World! INSIDE"
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]