I have the following setup:
- Windows Server 2016
- Python 3.4
- IIS 10
- fastwcgi 2.2.0
- flask So locally everything works just fine, but when i call the web from external, it throws error 500, internal server error.
I ran the web locally with runserver.py and everything seemed to go good. Im thinking this is somehow related to the endpoints of some sort. I will post my code if necessary but its a pretty large but this is overall structure:
app.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(inputRequest):
INPA = []
INPQ = []
INPS = []
#do work with inputRequest
return INPA, INPQ, INPS
menu.js //this sends the 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.");
});
I think its more of IIS issue rather than python/JS syntax because locally everything is fine, but i can provide more info as needed.