-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
25 lines (21 loc) · 684 Bytes
/
Copy pathapp.py
File metadata and controls
25 lines (21 loc) · 684 Bytes
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
from flask import Flask
from application.database import db
app = None
def create_app():
app = Flask(__name__)
app.debug = True
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///hospital.sqlite3'
db.init_app(app)
app.app_context().push()
return app
app = create_app()
from application.controllers import *
if __name__ == "__main__":
with app.app_context():
db.create_all()
Admin = User.query.filter_by(type='admin').first()
if Admin is None:
Admin = User(username='admin', email='admin@example.com', password='admin', type='admin')
db.session.add(Admin)
db.session.commit()
app.run()