Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from flask import Flask, request, render_template
- app = Flask(__name__)
- @app.route('/')
- def index():
- return 'Index Page'
- @app.route('/hello')
- def hello():
- return "Hello World!"
- @app.route('/user/<username>')
- def show_user_profile(username):
- return "user: " + username
- @app.route('/post/<int:post_id>')
- def show_post(post_id):
- return "post_id: " + str(post_id)
- @app.route('/login', methods=['GET', 'POST'])
- def login():
- if request.method == 'POST':
- app.logger.info(request.form['name'] + ' is login')
- return render_template('login.html', name=request.form['name'])
- else:
- return render_template('login.html')
- if __name__ == '__main__':
- app.run(debug = True)
Add Comment
Please, Sign In to add comment