aboutsummaryrefslogtreecommitdiff
path: root/app/__init__.py
diff options
context:
space:
mode:
authorNavan Chauhan <navanchauhan@gmail.com>2021-06-06 15:44:45 +0530
committerGitHub <noreply@github.com>2021-06-06 15:44:45 +0530
commit62a5ca363415b0f6f98785b6c3522a71fc895a72 (patch)
tree6fb829110658369321bab897707132f76f9b1b2c /app/__init__.py
parent57207efe38174666d40964b74856537c6f5314ab (diff)
parent6595d53212eaa4b9319da7196f5e2286d30eb462 (diff)
Merge pull request #1 from navanchauhan/deepsource-transform-10f49d7d
Format code with black
Diffstat (limited to 'app/__init__.py')
-rw-r--r--app/__init__.py40
1 files changed, 25 insertions, 15 deletions
diff --git a/app/__init__.py b/app/__init__.py
index 9d76abe..72aac8c 100644
--- a/app/__init__.py
+++ b/app/__init__.py
@@ -9,7 +9,7 @@ from flask_mailman import Mail
from authlib.integrations.flask_client import OAuth
app = Flask(__name__)
-app.config.from_object('app.config')
+app.config.from_object("app.config")
bcrypt = Bcrypt(app)
db = SQLAlchemy(app)
@@ -18,36 +18,46 @@ oauth = OAuth(app)
mail = Mail(app)
oauth.register(
- name="google",
- server_metadata_url="https://accounts.google.com/.well-known/openid-configuration",
- client_kwargs={"scope": "openid email profile"})
+ name="google",
+ server_metadata_url="https://accounts.google.com/.well-known/openid-configuration",
+ client_kwargs={"scope": "openid email profile"},
+)
login_manager.init_app(app)
from app.models import User
database_cli = AppGroup("database")
+
+
@database_cli.command("create")
def create_database():
- db.create_all()
+ 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")
- user.confirmation = True
- db.session.add(user)
- db.session.commit()
+ user = User(
+ first_name="Supersu",
+ email=app.config["ADMIN_EMAIL"],
+ password=app.config["ADMIN_PASSWORD"],
+ role="SUPERUSER",
+ )
+ user.confirmation = True
+ db.session.add(user)
+ db.session.commit()
+
app.cli.add_command(database_cli)
from app.views import main
+
@login_manager.user_loader
def load_user(email):
- return User.query.filter(User.email == email).first() \ No newline at end of file
+ return User.query.filter(User.email == email).first()