18 lines
No EOL
524 B
Python
18 lines
No EOL
524 B
Python
from app import create_app, db
|
|
from app.models import User, File, Share, Download
|
|
|
|
app = create_app()
|
|
|
|
with app.app_context():
|
|
# Create all tables
|
|
db.create_all()
|
|
|
|
# Check if we need to create an admin user
|
|
if not User.query.filter_by(username='admin').first():
|
|
admin = User(username='admin')
|
|
admin.set_password('password') # Change this in production!
|
|
db.session.add(admin)
|
|
db.session.commit()
|
|
print('Admin user created!')
|
|
|
|
print('Database initialized!') |