-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
23 lines (20 loc) · 748 Bytes
/
app.py
File metadata and controls
23 lines (20 loc) · 748 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from flask import Flask , redirect , url_for , request # Importing the class flask
# app is the object or instance of Flask
app = Flask(__name__)
# app.route informs Flask about the URL to be used by function
@app.route('/success/<name>')
# Creating a function named success
def success(name):
return 'welcome %s' % name
@app.route('/login', methods = ['GET','POST'])
# Creating a function named login
def login():
if request.method == 'POST':
user = request.form['adamlistek']
return redirect(url_for('success', name = user))
else:
return "INVALID"
# Programs executes from here in a development server (locally on your system)
# with debugging enabled.
if __name__ == '__main__':
app.run(debug = True)