Skip to content

Instantly share code, notes, and snippets.

View jacek-jablonski's full-sized avatar

Jacek Jabłoński jacek-jablonski

View GitHub Profile
@jacek-jablonski
jacek-jablonski / pyproject.toml
Created December 5, 2022 12:58
pyproject.torml
[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"
# 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
>>> 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):