mirror of
https://github.com/StefBuwalda/WebTech.git
synced 2025-10-30 19:29:58 +00:00
123123123
This commit is contained in:
24
seed.py
Normal file
24
seed.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from application import db, app
|
||||
from application.dash.models import Service
|
||||
from application.auth.models import User
|
||||
from werkzeug.security import generate_password_hash
|
||||
|
||||
"""
|
||||
new_strikers = [
|
||||
se(name="Erik", strike="y", age=44),
|
||||
Striker(name="Henk", strike="n", age=88),
|
||||
]
|
||||
|
||||
"""
|
||||
|
||||
new_user = User(username="admin", password=generate_password_hash("admin"))
|
||||
|
||||
with app.app_context():
|
||||
# Remove all existing
|
||||
Service.query.delete()
|
||||
User.query.delete()
|
||||
db.session.commit()
|
||||
# Then add new
|
||||
# db.session.add_all(new_strikers)
|
||||
db.session.add(new_user)
|
||||
db.session.commit()
|
||||
Reference in New Issue
Block a user