Created
September 30, 2011 16:01
-
-
Save heavenshell/1254213 to your computer and use it in GitHub Desktop.
Flask static file
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from flask import Flask, render_template | |
app = Flask(__name__) | |
@app.route('/') | |
def index(): | |
return render_template('index.html') | |
@app.route('/<arg1>/<arg2>/<arg3>/', strict_slashes=False) | |
def arg3(arg1, arg2, arg3): | |
print arg1, arg2, arg3 | |
return render_template('index.html') | |
if __name__ == '__main__': | |
app.run(debug=True) |
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
$ tree | |
. | |
├── app.py | |
├── static | |
│ └── css | |
│ └── style.css | |
└── templates | |
└── index.html | |
3 directories, 3 files |
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
$ python app.py | |
* Running on http://127.0.0.1:5000/ | |
* Restarting with reloader | |
foo bar baz | |
127.0.0.1 - - [01/Oct/2011 01:14:38] "GET /foo/bar/baz/ HTTP/1.1" 200 - | |
static css style.css | |
127.0.0.1 - - [01/Oct/2011 01:14:38] "GET /static/css/style.css HTTP/1.1" 200 - | |
127.0.0.1 - - [01/Oct/2011 01:14:38] "GET /favicon.ico HTTP/1.1" 404 - |
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
body { font-family: sans-serif; background: #eee; } |
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
<!doctype html> | |
<html> | |
<head> | |
<title>Flaskr</title> | |
<link rel=stylesheet type=text/css href="/static/style.css" /> | |
</head> | |
<body> | |
Sample | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment