diff options
author | Navan Chauhan <navanchauhan@gmail.com> | 2021-06-03 22:44:35 +0530 |
---|---|---|
committer | Navan Chauhan <navanchauhan@gmail.com> | 2021-06-03 22:44:35 +0530 |
commit | f07f93f69f4ad7dd617f62eafc295632debc99d2 (patch) | |
tree | bf5e89fcc8e3d0599d8728d3941e23462a8d9cf1 /app | |
parent | f4fc1a9e830ccd2aff3cc82468ee47b2f0e8b448 (diff) |
added app
Diffstat (limited to 'app')
-rw-r--r-- | app/__init__.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/app/__init__.py b/app/__init__.py new file mode 100644 index 0000000..dad9ba0 --- /dev/null +++ b/app/__init__.py @@ -0,0 +1,32 @@ +import click +from flask import Flask +from flask_bcrypt import Bcrypt +from flask.cli import AppGroup +from flask_sqlalchemy import SQLAlchemy + +app = Flask(__name__) +app.config.from_object('app.config') + +bcrypt = Bcrypt(app) +db = SQLAlchemy(app) + +class User(db.Model): + id = db.Column(db.Integer, primary_key=True) + username = db.Column(db.String(80), unique=True, nullable=False) + email = db.Column(db.String(120), unique=True, nullable=False) + + def __repr__(self): + return '<User %r>' % self.username + +database_cli = AppGroup("database") +@database_cli.command("create") +def create_database(): + db.create_all() +@database_cli.command("delete") +def delete_database(): + db.drop_all() + +app.cli.add_command(database_cli) + + +from app.views import main
\ No newline at end of file |