Skip to content

Instantly share code, notes, and snippets.

@jeffwidman
Forked from heavenshell/app.py
Created June 3, 2016 22:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffwidman/11d8b8d952abca30756ca4ba01909143 to your computer and use it in GitHub Desktop.
Save jeffwidman/11d8b8d952abca30756ca4ba01909143 to your computer and use it in GitHub Desktop.
Flask static file for reproducing https://github.com/pallets/flask/issues/331
#!/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)
$ tree
.
├── app.py
├── static
│   └── css
│   └── style.css
└── templates
└── index.html
3 directories, 3 files
$ 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 -
body { font-family: sans-serif; background: #eee; }
<!doctype html>
<html>
<head>
<title>Flaskr</title>
<link rel=stylesheet type=text/css href="/static/style.css" />
</head>
<body>
Sample
</body>
</html>
@hyunchel
Copy link

hyunchel commented Jun 3, 2016

Forgot to mention, but I believe author meant to href /static/css/style.css on line 5 of templatesindex.html.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment