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
|
from flask import Flask
|
||||||
import led
|
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('/')
|
@app.route('/')
|
||||||
def index():
|
def index():
|
||||||
@ -41,7 +50,4 @@ def lampeggia():
|
|||||||
led.lampeggia()
|
led.lampeggia()
|
||||||
return "LED ha lampeggiato."
|
return "LED ha lampeggiato."
|
||||||
|
|
||||||
if __name__ == '__main__':
|
app.run()
|
||||||
with app.app_context():
|
|
||||||
led.setup()
|
|
||||||
app.run()
|
|
||||||
|
Loading…
Reference in New Issue
Block a user