We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

zrbecker • 4 years ago

When I try to make a dynamic viewer with flask, since the app.run method blocks, the tech.io tutorial ends up timing out. Is there something else I need to do?

MrBurgess4 • 4 years ago

I'm doing a similar thing at the moment, but using Python's BaseHTTPSerevr and BaseHTTPRequestHandler rather than Flask. I hit the same problem using the serve_forever() method. What worked for me was starting the web server on another thread, i.e.

import threading
threading.Thread(target=httpd.serve_forever).start()
# Now, continue to execute the test cases against the user's submitted code...

I'm going to try switching my project over to use flask, now that I realised how to get flask into my runtime environment by editing the techio.yaml file!

projects:
python:
root: /python-project # Set the root path to your Python project
runner: python:3
buildCommand: pip install flask

Nicolas • 4 years ago

I copy the answer posted by @Jerome on the slack channel, to let everybody know the answer

"yes, you should start flask in background mode. There is a solution here: https://stackoverflow.com/q... Let me know if it solves the problem"