Skip to content

Instantly share code, notes, and snippets.

@rtzll rtzll/app.py
Last active Mar 24, 2020

Embed
What would you like to do?
Using the app context in a flask blueprint
from flask import Flask
from blueprint import sample
app = Flask(__name__)
app.register_blueprint(sample)
app.config['SOMETHING'] = 'something'
if __name__ == '__main__':
app.run()
from flask import Blueprint, current_app
sample = Blueprint('sample', __name__)
@sample.route('/')
def index():
return current_app.config['SOMETHING']
@rtzll

This comment has been minimized.

Copy link
Owner Author

rtzll commented Sep 30, 2016

Run python app.py and visit http://localhost:5000/, there you will see something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.