Created
June 14, 2020 11:22
-
-
Save abdounasser202/a96172d29d6a1c6087c327ca03ddc8e2 to your computer and use it in GitHub Desktop.
Code: Flask-Simple - __init__.py
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 Blueprint | |
class Simple(object): | |
def __init__(self, app): | |
self.app = None | |
if app is not None: | |
self.init_app(app) | |
def init_app(self, app): | |
simple = self.register('simple') | |
app.register_blueprint(simple) | |
def register(self, name): | |
feature = Blueprint(name, | |
__name__, | |
template_folder='templates', | |
static_folder='static', | |
url_prefix='/simple') | |
feature.add_url_rule('/hello/<name>', view_func=self.hello) | |
return feature | |
def hello(self, name): | |
return 'hello ' + ' ' + name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment