Test fixing setup gpio.
This commit is contained in:
parent
d1d02e13b3
commit
20fd01aca2
16
webapp.py
16
webapp.py
@ -3,8 +3,17 @@
|
||||
|
||||
from flask import Flask
|
||||
import led
|
||||
import os
|
||||
|
||||
app = Flask(__name__)
|
||||
class MyFlask(Flask):
|
||||
|
||||
def run(self, host=None, port=None, debug=None, load_dotenv=True, **options):
|
||||
if not self.debug or os.getenv("WERKZEUG_RUN_MAIN") == 'true':
|
||||
with self.app_context():
|
||||
led.setup()
|
||||
super(MyFlask, self).run(host=host, port=port, debug=debug, load_dotenv=load_dotenv, **options)
|
||||
|
||||
app = MyFlask(__name__)
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
@ -41,7 +50,4 @@ def lampeggia():
|
||||
led.lampeggia()
|
||||
return "LED ha lampeggiato."
|
||||
|
||||
if __name__ == '__main__':
|
||||
with app.app_context():
|
||||
led.setup()
|
||||
app.run()
|
||||
app.run()
|
||||
|
Loading…
Reference in New Issue
Block a user