Schedule data removal + change WSGI server
This commit is contained in:
parent
93d1dab63a
commit
96d64f4704
@ -1,11 +1,19 @@
|
|||||||
from routes import app
|
from routes import app
|
||||||
from db import init_db
|
from db import init_db
|
||||||
from hypercorn.config import Config
|
import waitress
|
||||||
from hypercorn.asyncio import serve
|
import threading
|
||||||
import asyncio
|
import schedule
|
||||||
|
import time
|
||||||
|
|
||||||
|
from func.remove_old_data import remove_old_data
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
init_db()
|
init_db()
|
||||||
config = Config()
|
thread = threading.Thread(target=waitress.serve, args=(app,), kwargs={'port': 5252})
|
||||||
config.bind =["0.0.0.0:5252"]
|
thread.start()
|
||||||
asyncio.run(serve(app, config))
|
print('Server running on port 5252. Healthy.')
|
||||||
|
|
||||||
|
schedule.every().day.at('00:01').do(remove_old_data)
|
||||||
|
while True:
|
||||||
|
schedule.run_pending()
|
||||||
|
time.sleep(1)
|
@ -1,9 +1,10 @@
|
|||||||
Flask==3.0.0
|
Flask==3.0.0
|
||||||
Flask-HTTPAuth==4.8.0
|
Flask-HTTPAuth==4.8.0
|
||||||
Hypercorn==0.15.0
|
waitress==2.1.2
|
||||||
ip2location-io==1.0.0
|
ip2location-io==1.0.0
|
||||||
python-dotenv==1.0.0
|
python-dotenv==1.0.0
|
||||||
SQLAlchemy==2.0.27
|
SQLAlchemy==2.0.27
|
||||||
tabulate==0.9.0
|
tabulate==0.9.0
|
||||||
ua-parser==0.18.0
|
ua-parser==0.18.0
|
||||||
validators==0.22.0
|
validators==0.22.0
|
||||||
|
schedule==1.2.1
|
Loading…
x
Reference in New Issue
Block a user