mirror of
https://github.com/StefBuwalda/WebTech.git
synced 2025-10-29 10:49:59 +00:00
Cleanup seed.py
This commit is contained in:
@@ -9,7 +9,7 @@ python -m venv venv
|
||||
### Installing required packages
|
||||
pip install -r requirements.txt
|
||||
|
||||
## Setting up the database
|
||||
## Setting up the database (in venv)
|
||||
### Initialize database
|
||||
flask --app app.py db init
|
||||
|
||||
|
||||
11
seed.py
11
seed.py
@@ -3,14 +3,7 @@ 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),
|
||||
]
|
||||
|
||||
"""
|
||||
|
||||
# User acounts to add
|
||||
new_users = [
|
||||
User(
|
||||
username="admin",
|
||||
@@ -29,6 +22,7 @@ new_users = [
|
||||
),
|
||||
]
|
||||
|
||||
# Services to add
|
||||
new_services = [
|
||||
Service(name="test123", url="http://google.com", user_id=1),
|
||||
# Daan services
|
||||
@@ -51,4 +45,5 @@ with app.app_context():
|
||||
# Then add new
|
||||
db.session.add_all(new_services)
|
||||
db.session.add_all(new_users)
|
||||
# Commit
|
||||
db.session.commit()
|
||||
|
||||
Reference in New Issue
Block a user