mattermore/setup_database.py

11 lines
228 B
Python
Raw Normal View History

2018-09-24 20:57:36 +02:00
#!/usr/bin/env python3
from app.app import db, models
db.create_all()
2019-02-14 19:09:08 +01:00
exists = models.User.query.filter_by(username='admin').first()
if not exists:
db.session.add(models.User('admin', admin=True))
db.session.commit()