Edit: Originally thought this was IIS issue, but looks like it's FastCgiModule causing the issue.
To be clear, the WebApp itself works, it only fails when I choose "Image Test" from the dropdown (see code below) menu on the site. Specifically, it fails on the df.plot
line, and I can't figure out why.
from flask import Flask, request
import pandas as pd
app = Flask(__name__)
html = '''
<h1>Discovery Capital</h1>
<h2>Report Generator</h2>
<p>
<form action="/submitted" method="post">
<label for="reports">Choose a Report:</label>
<select id="reports" name="reports">
<option value="img_test">Image Test</option>
</select>
<input type="submit">
</form>
'''
@app.route("/")
def index():
return html
@app.route("/submitted", methods=['POST'])
def show():
select = request.form.get("reports")
if select == 'img_test':
df = pd.DataFrame([1,2,3,4,5])
df.plot()
plt.close()
result = "Success"
else:
result = "Not Available"
return result
if __name__ == "__main__":
app.run()
Appreciate the help!
Edit: Here's the log from failed request tracing:
from wfastcgi 500 error in flask app when trying to plot
No comments:
Post a Comment