-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_database.py
More file actions
28 lines (22 loc) · 797 Bytes
/
create_database.py
File metadata and controls
28 lines (22 loc) · 797 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
26
27
28
import os
from app import create_app
basedir = os.path.abspath(os.path.dirname(__file__))
if __name__ == '__main__':
flask_app = create_app(os.environ.get('APP_CONFIG', 'default'))
with flask_app.test_request_context():
from app.models import Client, Book, BookOffer
Client.init()
Book.init()
BookOffer.init()
response = Client.search().execute()
if Client.search().execute().hits.total == 0:
admin = Client(
client_id='rastadev',
secret='rastadev',
email='a.verdier@outlook.fr',
confirmed=True,
favorite_genders=['chill', 'science'],
balance=999999999
)
admin.save()
print('admin created')