Skip to content

Instantly share code, notes, and snippets.

@rtzll rtzll/
Last active Mar 24, 2020

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.config['SOMETHING'] = 'something'
if __name__ == '__main__':
from flask import Blueprint, current_app
sample = Blueprint('sample', __name__)
def index():
return current_app.config['SOMETHING']

This comment has been minimized.

Copy link
Owner Author

rtzll commented Sep 30, 2016

Run python 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.