fix log in issue
This commit is contained in:
@@ -36,8 +36,35 @@ def create_app():
|
|||||||
|
|
||||||
with app.app_context():
|
with app.app_context():
|
||||||
db.create_all()
|
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
|
# Create default admin user if not exists
|
||||||
try:
|
try:
|
||||||
|
from app.models import User
|
||||||
if not User.query.filter_by(username='admin').first():
|
if not User.query.filter_by(username='admin').first():
|
||||||
admin = User(username='admin', is_admin=True)
|
admin = User(username='admin', is_admin=True)
|
||||||
admin.set_password('admin123')
|
admin.set_password('admin123')
|
||||||
|
|||||||
@@ -8,12 +8,18 @@ import os
|
|||||||
import requests
|
import requests
|
||||||
import random
|
import random
|
||||||
import string
|
import string
|
||||||
|
import traceback
|
||||||
|
|
||||||
def generate_remote_id(length=6):
|
def generate_remote_id(length=6):
|
||||||
return ''.join(random.choices(string.digits, k=length))
|
return ''.join(random.choices(string.digits, k=length))
|
||||||
|
|
||||||
jobs_bp = Blueprint('jobs', __name__, url_prefix='/jobs')
|
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')
|
@jobs_bp.route('/debug/test-step2')
|
||||||
@login_required
|
@login_required
|
||||||
def debug_test_step2():
|
def debug_test_step2():
|
||||||
|
|||||||
Reference in New Issue
Block a user