Skip to content

Commit

Permalink
create_db.py to initialize db file
Browse files Browse the repository at this point in the history
  • Loading branch information
eshaan7 committed Jul 21, 2019
1 parent 144b56e commit d22adb6
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/create_db.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import datetime

from FlaskRTBCTF import create_app, db, bcrypt
from FlaskRTBCTF.models import User, Score

app = create_app()

# create_app().app_context().push()
with app.app_context():
db.create_all()

# NOTE: CHANGE DEFAULT CREDENTIALS !!!
admin_user = User(
username='admin',
email='[email protected]',
password=bcrypt.generate_password_hash('admin').decode('utf-8'),
confirmed_at=datetime.datetime.now(),
isAdmin = True
)
score = Score(userid=admin_user.id, userHash=False, rootHash=False, score=0)
db.session.add(admin_user)
db.session.add(score)
db.session.commit()

0 comments on commit d22adb6

Please sign in to comment.