0

我有以下设置:

  • 视窗服务器 2016
  • 蟒蛇 3.4
  • IIS 10
  • 快速wcgi 2.2.0
  • 烧瓶所以在本地一切正常,但是当我从外部调用网络时,它会抛出错误 500,内部服务器错误。

我使用 runserver.py 在本地运行网络,一切似乎都很顺利。我认为这在某种程度上与某种端点有关。如有必要,我将发布我的代码,但它相当大,但这是整体结构:

应用程序.py:

@app.route('/generate', methods=['GET', 'POST'])
def generate():
     if  request.method == "POST":
        txt = request.json['text']
     returnedQuestions,returnAnswers, returnSources = QG.s(txt)
     return  json.dumps({'Questions': returnedQuestions, 'Answers':returnAnswers, 'Sources':returnSources})

QG.s(输入请求):

INPA = []
INPQ = []
INPS = []
#do work with inputRequest
return INPA, INPQ, INPS

menu.js //这会发送 POST

var userInputData = { 'text': '' }
        userInputData['text'] = $("#input").val();
        $.ajax({
            url: '/generate',
            type: 'POST',
            async: false,
            data: JSON.stringify(userInputData),
            contentType: 'application/json;charset=UTF-8',
        }).done(function (o) {
            var result = JSON.parse(o);
            returnedQuestion = (result.Questions);
            returnedAnswer = (result.Answers);
            returnedSource = (result.Sources);
            document.getElementById('CreateButton').className = "button";
        }).error(function (e) {
            debugger;
            window.alert("Error occured. Try Again.");
        });

我认为它更多的是 IIS 问题而不是 python/JS 语法,因为本地一切都很好,但我可以根据需要提供更多信息。

4

1 回答 1

0

我想通了。看起来它正在寻找的资源不在搜索路径中。

我在整个函数中添加了一个 try/except 并给了我确切的错误。

我仍然不知道如何让烧瓶显示详细的错误(尝试调试 = true,传播 = true)但问题已修复。谢谢scomes的帮助!

于 2017-02-25T01:42:52.390 回答