Initial commit: Fleet Management app with security hardening and background launcher
- Flask app with SQLAlchemy, Flask-Login, Flask-Mail - Admin/owner roles, vessel management, charters, work orders - Background launcher (Iniciar.vbs) runs server without terminal window - Root redirect fixed: / → /login - debug=False, use_reloader=False for pythonw.exe compatibility Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
from app import create_app, db
|
||||
from app.models import User, Company
|
||||
from werkzeug.security import generate_password_hash
|
||||
|
||||
app = create_app()
|
||||
with app.app_context():
|
||||
# Verificar si ya existe la compañía
|
||||
company = Company.query.filter_by(email='admin@fleet.com').first()
|
||||
if not company:
|
||||
company = Company(name='Al & Al Management LLC', type='management', email='admin@fleet.com')
|
||||
db.session.add(company)
|
||||
db.session.commit()
|
||||
print("Compañía creada")
|
||||
else:
|
||||
print("Compañía ya existe")
|
||||
|
||||
# Verificar si ya existe el usuario
|
||||
user = User.query.filter_by(email='admin@fleet.com').first()
|
||||
if not user:
|
||||
user = User(
|
||||
name='Administrador',
|
||||
email='admin@fleet.com',
|
||||
password_hash=generate_password_hash('admin123'),
|
||||
company_id=company.id,
|
||||
role='admin'
|
||||
)
|
||||
db.session.add(user)
|
||||
db.session.commit()
|
||||
print("Usuario admin creado: admin@fleet.com / admin123")
|
||||
else:
|
||||
print("Usuario admin ya existe: admin@fleet.com / admin123")
|
||||
Reference in New Issue
Block a user