1

Trying to set up my Pi as a web server with flask. It works only sometimes, and then only for about 30 seconds. When I stop the script, it returns this error:

Unhandled exception in thread started by sys.exceptbook is missing lost sys.stderr

from flask import Flask, render_template
app = Flask(name)
@app.route("/")
def hello():
    templateData = {
        'title':'Hello!
        }
    return render_template('main.html', **templateData)
if name == "main":
    app.run(host='10.0.0.10', port=80, debug=True)

After it stops working the first time, the Pi must be restarted before it will work again. What did I do wrong?

5
  • 2
    Could you provide full error message (with stacktrace) and tell US show exactly do you run the script? Dec 20, 2013 at 21:52
  • Have you tried using the ip already assigned to your PI rather than 10.0.0.10? Dec 21, 2013 at 0:58
  • I checked the ip with ifconfig. I ran the script from the command line: sudo python script.py
    – user11410
    Dec 21, 2013 at 23:25
  • It returns: running on 10.0.0.10, restarting with reloader. But I cannot access 10.0.0.10 from another computer on the network. The funny thing is it does work sometimes, like 1/10 times
    – user11410
    Dec 21, 2013 at 23:27
  • Here is a self-contained project that uses flask. Might be useful: hackaday.io/project/…
    – SDsolar
    Jun 7, 2018 at 15:58

1 Answer 1

1

The problem was something to do with my router. It worked when I tried it with a different router at a friend's house!

1
  • So what happened when you brought it home?
    – SDsolar
    Jun 7, 2018 at 15:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.