[Flask] Extremely lost on how I am suppose to run a function in Flask views
Bare with me, as I'm new to Flask and this is my first project with it and I have no idea how to even word this or what exactly I need help with.
I have file secp2.py with this function:
def addOne():
while True:
choice = input("Would you like to add an item to your lists? ")
choice = choice.lower()
if "yes" in choice:
while True:
choice = input("Would you like to add a unit or post? ")
choice = choice.lower()
if "unit" in choice:
posts = SecP(None, employee, None)
posts.addAnother()
break
elif "post" in choice:
posts = SecP(None, location, None)
posts.addAnother()
break
else:
print("That's not an option.")
elif "no" in choice:
break
else:
print("That's not an option.")
As you can see I'm also trying to pass some user input to 2 seperate lists.
I am trying to call/run it in this function from my views.py file:
@app.route('/')
def index():
return render_template('index.html')
And get it to run with the html template. I have no idea what to do. Am I suppose to rewrite the whole addOne() function in the index() function?
Posted Jun 3, 2017, 4:49 PM UTC
139