Python Forum
RuntimeError: No application found. Either work inside a view function or push an app
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
RuntimeError: No application found. Either work inside a view function or push an app
#3
Larz60+ Thank you so much for helping me, I have added the information you requested to the origional post.
The reason why I have written the code like this;
Quote:This code is wrong:
for pin in pins:
GPIO.setup(pin.pin, GPIO.OUT)
GPIO.output(pin.pin, GPIO.LOW)
pin.state = GPIO.input(pin.pin)
db.session.commit()
Is, before the code is a query to Pins:
pins = Pins.query.all()
for pin in pins:
    GPIO.setup(pin.pin, GPIO.OUT)
    GPIO.output(pin.pin, GPIO.LOW)
    pin.state = GPIO.input(pin.pin)
    db.session.commit()
 
each ".pin" is the column "pin" of the database, I understand it as the first pin is "for 'pin' of pins" where "pins" is now = Pins.query.all() this code works, and what I understand is that your second code would relate to a dicionary "pins".
But I have proberbly misunderstood!
Thank you for helping.
regards
Paul
Ps one day when I eventually understand this I will read as many posts as possible (except gamming) and try to help others.
Reply


Messages In This Thread
RE: RuntimeError: No application found. Either work inside a view function or push an app - by pascale - Mar-04-2019, 08:17 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020