fix log in issue

This commit is contained in:
2025-12-28 05:59:49 +01:00
parent 6b254534f6
commit a9ad5bc2ad
2 changed files with 33 additions and 0 deletions

View File

@@ -36,8 +36,35 @@ def create_app():
with app.app_context():
db.create_all()
# Simple migration for Phase 2 columns with retry
import time
max_retries = 5
for i in range(max_retries):
try:
from sqlalchemy import text
with db.engine.connect() as conn:
# Check if remote_queue_id exists
result = conn.execute(text("SELECT column_name FROM information_schema.columns WHERE table_name='jobs' AND column_name='remote_queue_id'"))
if not result.fetchone():
print("Running Phase 2 migrations...")
conn.execute(text("ALTER TABLE jobs ADD COLUMN remote_queue_id VARCHAR(50)"))
conn.execute(text("ALTER TABLE jobs ADD COLUMN remote_task_ids TEXT"))
conn.execute(text("ALTER TABLE jobs ADD COLUMN remote_results TEXT"))
conn.execute(text("ALTER TABLE jobs ADD COLUMN queue_log TEXT"))
conn.commit()
print("Phase 2 migrations completed.")
break # Success
except Exception as e:
print(f"Migration attempt {i+1} failed: {e}")
if i < max_retries - 1:
time.sleep(2)
else:
print("Migration failed after all retries.")
# Create default admin user if not exists
try:
from app.models import User
if not User.query.filter_by(username='admin').first():
admin = User(username='admin', is_admin=True)
admin.set_password('admin123')

View File

@@ -8,12 +8,18 @@ import os
import requests
import random
import string
import traceback
def generate_remote_id(length=6):
return ''.join(random.choices(string.digits, k=length))
jobs_bp = Blueprint('jobs', __name__, url_prefix='/jobs')
@jobs_bp.route('/submit')
@login_required
def submit():
return render_template('jobs/submit.html')
@jobs_bp.route('/debug/test-step2')
@login_required
def debug_test_step2():