Skip to content

Instantly share code, notes, and snippets.

@matthewrobertbell
Last active June 30, 2019 15:46
Show Gist options
  • Save matthewrobertbell/5163275 to your computer and use it in GitHub Desktop.
Save matthewrobertbell/5163275 to your computer and use it in GitHub Desktop.
from flask import Flask
from flask.ext.classy import FlaskView
# we'll make a list to hold some quotes for our app
quotes = [
"A noble spirit embiggens the smallest man! ~ Jebediah Springfield",
"If there is a way to do it better... find it. ~ Thomas Edison",
"No one knows what he can do till he tries. ~ Publilius Syrus"
]
app = Flask(__name__)
class QuotesView(FlaskView):
def index(self):
return "<br>".join(quotes)
class SubView(FlaskView):
route_base = QuotesView
def index(self):
return 'this is sub'
class DoubleSubView(FlaskView):
route_base = SubView
def index(self):
return 'double sub'
QuotesView.register(app)
SubView.register(app)
DoubleSubView.register(app)
if __name__ == '__main__':
app.run(debug=True)
@apiguy
Copy link

apiguy commented Mar 15, 2013

I really like this idea!

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