ycdl/frontends/ycdl_flask/ycdl_flask_prod.py
Ethan Dalool 038ce9cffb Rename flask launchers -> _dev, _prod.
I want to reduce some complexity around here, part of which is that
launch imported entrypoint imported backend, all to do some proxy
wrapping which isn't necessary for the dev case anyway. Less
layers of wrapping and importing is good. Plus I think this naming
is more clear.
Additionally, I realized that the entrypoint aka prod launcher was
never updated to init the ycdldb as that was only done by the argparse
launcher. Now it's hardcoded and I'll consider adding a config file.
2020-09-30 15:03:29 -07:00

21 lines
578 B
Python

'''
This file is the WSGI entrypoint for remote / production use.
If you are using Gunicorn, for example:
gunicorn ycdl_flask_prod:site --bind "0.0.0.0:PORT" --access-logfile "-"
'''
import werkzeug.middleware.proxy_fix
import bot
import ycdl
import backend
backend.site.wsgi_app = werkzeug.middleware.proxy_fix.ProxyFix(backend.site.wsgi_app)
site = backend.site
# NOTE: Consider adding a local .json config file.
youtube_core = ycdl.ytapi.Youtube(bot.get_youtube_key())
backend.common.init_ycdldb(youtube_core, create=False)
backend.common.start_refresher_thread(86400)