aboutsummaryrefslogtreecommitdiff
path: root/app/__init__.py
diff options
context:
space:
mode:
authorNavan Chauhan <navanchauhan@gmail.com>2021-06-04 21:29:42 +0530
committerNavan Chauhan <navanchauhan@gmail.com>2021-06-04 21:29:42 +0530
commit7ecfc4bafc75a125c73e03bd630f065d9e4ed40c (patch)
tree7405c86d55806181696940c08f4ba61ab7706844 /app/__init__.py
parent7d767d09ad9d7167d07d5b55a98b172de1a5200b (diff)
added superuser
Diffstat (limited to 'app/__init__.py')
-rw-r--r--app/__init__.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/app/__init__.py b/app/__init__.py
index 1c759e7..9f025af 100644
--- a/app/__init__.py
+++ b/app/__init__.py
@@ -22,7 +22,16 @@ def create_database():
db.create_all()
@database_cli.command("delete")
def delete_database():
- db.drop_all()
+ db.drop_all()
+@database_cli.command("admin-create")
+def make_superuser_database():
+ user = User(
+ first_name="Supersu",
+ email=app.config["ADMIN_EMAIL"],
+ password=app.config["ADMIN_PASSWORD"],
+ role="SUPERUSER")
+ db.session.add(user)
+ db.session.commit()
app.cli.add_command(database_cli)