Created
June 24, 2013 07:14
-
-
Save tos-kamiya/5848254 to your computer and use it in GitHub Desktop.
dummy server with flask
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding: utf-8 | |
from flask import Flask, url_for, request, redirect | |
app = Flask(__name__) | |
@app.route('/login', methods=['GET', 'POST']) | |
def login(): | |
if request.method == 'POST': | |
user = request.form["user"] | |
password = request.form["password"] | |
return """ | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
</head> | |
<body> | |
user = %s<br /> | |
password = %s<br /> | |
</body> | |
""" % (user, password) | |
else: | |
return redirect(url_for('static', filename='index.html')) | |
if __name__ == '__main__': | |
app.debug = True | |
app.run() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment