39 lines
847 B
Python
39 lines
847 B
Python
import logging
|
|
import logging.config
|
|
from flask import Flask
|
|
|
|
from common.utils.celery_utils import make_celery, init_celery
|
|
from common.extensions import db
|
|
from config.logging_config import LOGGING
|
|
|
|
|
|
def create_app(config_file=None):
|
|
app = Flask(__name__)
|
|
|
|
if config_file is None:
|
|
app.config.from_object('config.config.DevConfig')
|
|
else:
|
|
app.config.from_object(config_file)
|
|
|
|
logging.config.dictConfig(LOGGING)
|
|
|
|
app.logger.debug('Starting up eveai_chat_workers...')
|
|
register_extensions(app)
|
|
|
|
celery = make_celery(app.name, app.config)
|
|
init_celery(celery, app)
|
|
|
|
app.rag_tuning_logger = logging.getLogger('rag_tuning')
|
|
|
|
from eveai_chat_workers import tasks
|
|
print(tasks.tasks_ping())
|
|
|
|
return app, celery
|
|
|
|
|
|
def register_extensions(app):
|
|
db.init_app(app)
|
|
|
|
|
|
app, celery = create_app()
|