Update app.py
This commit is contained in:
14
app.py
14
app.py
@@ -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)
|
|
||||||
Reference in New Issue
Block a user