snauwcounter/run.py
Michael Trip b56e866071
All checks were successful
Build and Push Image / build-and-push (push) Successful in 1m26s
initial commit
2026-01-09 21:58:53 +01:00

36 lines
872 B
Python

from app import create_app, db
from app.models import User, Incident
app = create_app()
@app.cli.command()
def init_db():
"""Initialize the database with tables"""
db.create_all()
print("Database tables created successfully!")
@app.cli.command()
def create_test_user():
"""Create a test user for development"""
email = "test@example.com"
password = "test123"
# Check if user already exists
if User.query.filter_by(email=email).first():
print(f"User {email} already exists!")
return
user = User(email=email)
user.set_password(password)
db.session.add(user)
db.session.commit()
print(f"Test user created: {email} / {password}")
if __name__ == '__main__':
with app.app_context():
db.create_all()
print("Database initialized!")
app.run(debug=True, host='0.0.0.0', port=5000)