initial commit
All checks were successful
Build and Push Image / build-and-push (push) Successful in 1m26s
All checks were successful
Build and Push Image / build-and-push (push) Successful in 1m26s
This commit is contained in:
parent
3bba1f6db6
commit
b56e866071
36 changed files with 4160 additions and 0 deletions
36
run.py
Normal file
36
run.py
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue