remove "with app.app_context():"
This commit is contained in:
parent
074dd875dc
commit
eb0e327402
3
cron.py
3
cron.py
|
@ -849,9 +849,6 @@ if __name__ == "__main__":
|
|||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
app = create_app()
|
||||
|
||||
with app.app_context():
|
||||
if args.job == "stats":
|
||||
LOG.d("Compute Stats")
|
||||
stats()
|
||||
|
|
|
@ -1986,8 +1986,6 @@ def main(port: int):
|
|||
|
||||
if LOAD_PGP_EMAIL_HANDLER:
|
||||
LOG.w("LOAD PGP keys")
|
||||
app = create_app()
|
||||
with app.app_context():
|
||||
load_pgp_public_keys()
|
||||
|
||||
while True:
|
||||
|
|
|
@ -51,8 +51,5 @@ def add_sl_domains():
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = create_app()
|
||||
|
||||
with app.app_context():
|
||||
load_pgp_public_keys()
|
||||
add_sl_domains()
|
||||
|
|
|
@ -103,9 +103,6 @@ if __name__ == "__main__":
|
|||
min_dt = arrow.now().shift(hours=-1)
|
||||
max_dt = arrow.now().shift(hours=1)
|
||||
|
||||
app = new_app()
|
||||
|
||||
with app.app_context():
|
||||
for job in Job.filter(
|
||||
Job.taken.is_(False), Job.run_at > min_dt, Job.run_at <= max_dt
|
||||
).all():
|
||||
|
|
|
@ -59,8 +59,6 @@ def nb_files(directory) -> int:
|
|||
|
||||
if __name__ == "__main__":
|
||||
while True:
|
||||
app = create_app()
|
||||
with app.app_context():
|
||||
get_stats()
|
||||
|
||||
# 1 min
|
||||
|
|
|
@ -924,7 +924,6 @@ def register_custom_commands(app):
|
|||
from init_app import add_sl_domains
|
||||
|
||||
LOG.w("reset db, add fake data")
|
||||
with app.app_context():
|
||||
fake_data()
|
||||
add_sl_domains()
|
||||
|
||||
|
|
4
shell.py
4
shell.py
|
@ -137,9 +137,7 @@ def send_onboarding_emails(user):
|
|||
onboarding_pgp(user)
|
||||
|
||||
|
||||
app = create_app()
|
||||
|
||||
with app.app_context():
|
||||
if __name__ == "__main__":
|
||||
# to test email template
|
||||
# with open("/tmp/email.html", "w") as f:
|
||||
# user = User.first()
|
||||
|
|
|
@ -24,7 +24,6 @@ app.config["TESTING"] = True
|
|||
app.config["WTF_CSRF_ENABLED"] = False
|
||||
app.config["SERVER_NAME"] = "sl.test"
|
||||
|
||||
with app.app_context():
|
||||
# enable pg_trgm extension
|
||||
with engine.connect() as conn:
|
||||
try:
|
||||
|
@ -49,7 +48,6 @@ def flask_app():
|
|||
def flask_client():
|
||||
transaction = connection.begin()
|
||||
|
||||
with app.app_context():
|
||||
try:
|
||||
client = app.test_client()
|
||||
yield client
|
||||
|
|
Loading…
Reference in a new issue