Last active
August 29, 2015 14:22
-
-
Save justanr/ba21b9ad6dd73a60abe7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
from flask import Flask, render_template | |
app = Flask(__name__) | |
@app.route('/<page_name>') | |
@app.route('/', defaults={'page_name': 'index'}) | |
def page(page_name): | |
return render_template(page_name, {'page_name': page_name}) |
This file contains hidden or 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
from flask import Flask, render_template | |
app = Flask(__name__) | |
pages = ['index', 'about', 'contact'] | |
for page in pages: | |
@app.route('/' + page, endpoint=page) | |
# actually bind the current name to this throwaway | |
def tossaway(page=page): | |
return render_template(page, {'page_name': page}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment