diff --git a/env b/env index a9192d3cf..5df6a5920 100644 --- a/env +++ b/env @@ -1,3 +1,4 @@ +export FLASK_APP="/service/files/cli:app" export MASTER_KEY="blahblahblah" export DOMAIN="localhost" export SITE_NAME="rDrama" diff --git a/files/__init__.py b/files/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/files/cli.py b/files/cli.py new file mode 100644 index 000000000..85cbf5b6f --- /dev/null +++ b/files/cli.py @@ -0,0 +1,10 @@ +from .__main__ import app, db_session +from flask import g +import files.helpers.cron + +#from flask_migrate import Migrate +#from flask_sqlalchemy import SQLAlchemy +#import files.classes + +#db = SQLAlchemy(app) +#migrate = Migrate(app, db) diff --git a/files/helpers/cron.py b/files/helpers/cron.py new file mode 100644 index 000000000..f748a3bd1 --- /dev/null +++ b/files/helpers/cron.py @@ -0,0 +1,18 @@ +from files.cli import g, app, db_session +import click +import files.helpers.lottery + +@app.cli.command('cron', help='Run scheduled tasks.') +@click.option('--every-5m', is_flag=True, help='Call every 5 minutes.') +@click.option('--every-1h', is_flag=True, help='Call every 1 hour.') +@click.option('--every-1d', is_flag=True, help='Call every 1 day.') +def cron(every_5m, every_1h, every_1d): + g.db = db_session() + + if every_5m: + pass + if every_1h: + pass + if every_1d: + pass +