-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit_db.py
35 lines (27 loc) · 1.13 KB
/
init_db.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from database.db_instance import db
from flask_security import Security, SQLAlchemyUserDatastore
from server.server import app
import sys
from flask_security.utils import hash_password
def create_db():
# Important: The model should be imported before create_all() is called
with app.app_context():
# from auth.models import BotAuth, Department, Role, User, RevokedTokenModel, IPModel
# from bot_page.models import Car, TodoModel, WebUserModel
# from chatbot.models import Message, Chat, Lead, Group
# Setup Flask-Security
# user_datastore = SQLAlchemyUserDatastore(db, User, Role)
# security = Security(app, user_datastore)
# from bot_page.models import BotConfiguration
from auth.models import BotBackendResponse
db.create_all()
# user_datastore.create_user(email=email, password=hash_password(password))
db.session.commit()
if __name__ == '__main__':
# if len(sys.argv) != 3:
# print("Please only call me with 2 parameters: <email> <password>")
# sys.exit()
#
# email = sys.argv[1]
# password =sys.argv[2]
create_db()