fix pep requierments

This commit is contained in:
Daniel afx 2022-02-04 15:27:05 +02:00
parent b8ce6422b4
commit 1543126307

View file

@ -5,7 +5,8 @@ import subprocess, shlex
from forest import app, db, User from forest import app, db, User
from flask.cli import FlaskGroup from flask.cli import FlaskGroup
from flask_migrate import Migrate, MigrateCommand from flask_migrate import Migrate
from flask_migrate import :wMigrateCommand
cli = FlaskGroup(app) cli = FlaskGroup(app)
migrate = Migrate(app, db) migrate = Migrate(app, db)
@ -18,11 +19,13 @@ def create_db():
db.create_all() db.create_all()
db.session.commit() db.session.commit()
@cli.command("seed_db") @cli.command("seed_db")
def seed_db(): def seed_db():
db.session.add(User(email="daniel@deflax.net")) db.session.add(User(email="daniel@deflax.net"))
db.session.commit() db.session.commit()
@cli.command("upgrade_db") @cli.command("upgrade_db")
def upgrade_db(): def upgrade_db():
"""Run deployment tasks.""" """Run deployment tasks."""
@ -35,6 +38,7 @@ def upgrade_db():
# create user roles # create user roles
Role.insert_roles() Role.insert_roles()
@cli.command("restore_db") @cli.command("restore_db")
def restore_db(restore_file): def restore_db(restore_file):
""" recreate db from grid export with python3 manage.py restore /path/grid.tar.bz2 """ """ recreate db from grid export with python3 manage.py restore /path/grid.tar.bz2 """
@ -44,6 +48,7 @@ def restore_db(restore_file):
db.session.add(User(email=str(user), password=str(password), confirmed=True, confirmed_on=datetime.datetime.now())) db.session.add(User(email=str(user), password=str(password), confirmed=True, confirmed_on=datetime.datetime.now()))
db.session.commit() db.session.commit()
if __name__ == "__main__": if __name__ == "__main__":
cli() cli()