fix waitress
This commit is contained in:
parent
99f117bf69
commit
a7b3935e3b
14
app.py
14
app.py
@ -2,9 +2,8 @@ from flask import Flask, render_template, request, redirect, url_for, flash, ses
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from werkzeug.security import generate_password_hash, check_password_hash
|
||||
import os, paramiko, threading, time, io, tempfile, csv
|
||||
from datetime import datetime, timedelta, timezone
|
||||
|
||||
from apscheduler.schedulers.background import BackgroundScheduler
|
||||
from datetime import datetime, timezone, timedelta
|
||||
from io import StringIO
|
||||
import socket
|
||||
import ipaddress
|
||||
@ -1128,13 +1127,12 @@ def scheduled_deployments():
|
||||
deploy_user(setting.user_id)
|
||||
setting.last_deploy_time = now
|
||||
db.session.commit()
|
||||
|
||||
scheduler = BackgroundScheduler(timezone="UTC")
|
||||
scheduler.add_job(func=scheduled_deployments, trigger="interval", minutes=5, next_run_time=datetime.now())
|
||||
scheduler.add_job(func=automated_backups, trigger="interval", minutes=5, next_run_time=datetime.now())
|
||||
scheduler.add_job(func=cleanup_old_backups, trigger="interval", hours=24, next_run_time=datetime.now())
|
||||
|
||||
scheduler = BackgroundScheduler()
|
||||
scheduler.add_job(func=scheduled_deployments, trigger="interval", minutes=5)
|
||||
scheduler.add_job(func=automated_backups, trigger="interval", minutes=5)
|
||||
scheduler.add_job(func=cleanup_old_backups, trigger="interval", hours=24)
|
||||
|
||||
scheduler.start()
|
||||
|
||||
if __name__ == '__main__':
|
||||
with app.app_context():
|
||||
|
@ -1,7 +1,12 @@
|
||||
from waitress import serve
|
||||
from app import app, scheduler
|
||||
from app import app, scheduler, db
|
||||
from datetime import datetime
|
||||
|
||||
if __name__ == "__main__":
|
||||
with app.app_context():
|
||||
db.create_all()
|
||||
for job in scheduler.get_jobs():
|
||||
job.modify(next_run_time=datetime.now())
|
||||
if not scheduler.running:
|
||||
scheduler.start()
|
||||
serve(app, listen="*:5580", threads=4, ident="")
|
||||
serve(app, listen="*:5580", threads=4, ident="")
|
||||
|
Loading…
x
Reference in New Issue
Block a user