This file contains 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 | |
>>> from flask import g | |
>>> app=Flask('test') | |
>>> with app.app_context(): | |
... g.e='test' | |
... | |
>>> with app.app_context(): | |
... print(g.e) | |
... | |
Traceback (most recent call last): |
This file contains 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
# file: app.py | |
from flask import Flask | |
from redis_instance import create_redis | |
def create_app(script_info: ScriptInfo = None): | |
app = Flask('myapp') | |
with app.app_context(): | |
from flask import g | |
g.redis = create_redis() | |
return app |
This file contains 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
[tool.poetry] | |
name = "app" | |
version = "0.1.0" | |
description = "" | |
authors = ["App Author <app@author.com>"] | |
packages = [{ include = "app", from = "." }] | |
[[tool.poetry.source]] | |
name = "custom-python" |