我正在使用本教程作为参考click here
,然后尝试将我的应用程序托管在我们的Intranet服务器上。
该应用程序可与女服务生完美配合,但不能与IIS快速CGI一起很好地运行
代码
import pyodbc
from flask import Flask, render_template, request, redirect, url_for, session
from config.Database_Details import cursor
import re
import time
from datetime import datetime,date
import ctypes
from waitress import serve
app = Flask(__name__)
ctypes.windll.shell32.IsUserAnAdmin()
class PrefixMiddleware(object):
#class for URL sorting
def __init__(self, app, prefix=''):
self.app = app
self.prefix = prefix
def __call__(self, environ, start_response):
if environ['PATH_INFO'].lower().replace('/Checker','').startswith(self.prefix):
environ['PATH_INFO'] = environ['PATH_INFO'].lower().replace('/Checker','')[len(self.prefix):]
environ['SCRIPT_NAME'] = self.prefix
return self.app(environ, start_response)
else:
start_response('404', [('Content-Type', 'text/plain')])
return ["This url does not belong to the app.".encode()]
app.wsgi_app = PrefixMiddleware(app.wsgi_app, prefix='/check')
@app.route('/home/', methods=['GET', 'POST'])
def home():
print("hello")
if __name__ == '__main__':
app.run(host='xx.xxx.xx.xxx', port=5000)
错误消息