Update app.py

This commit is contained in:
2025-05-22 20:05:46 +02:00
parent 36ace2d566
commit 09f6750c2b

14
app.py
View File

@@ -1142,16 +1142,4 @@ def seed_db():
description=plant['description'], description=plant['description'],
care_guide=plant['care_guide'] care_guide=plant['care_guide']
)) ))
db.session.commit() db.session.commit()
if __name__ == '__main__':
with app.app_context():
db.create_all()
# Create an admin user if not exists
if not User.query.filter_by(username='admin').first():
admin = User(username='admin')
admin.set_password('admin123') # Change this password after first login!
db.session.add(admin)
db.session.commit()
seed_db()
app.run(debug=True)