Save uploaded files to uploads/job_id folder instead of temp dirs
- Create job_id first, then save files to uploads/job_id/ - Add debug print when index() is called - Files will now be visible in uploads folder for debugging
This commit is contained in:
1 parent
163414e8e4
commit
17f63125b1
1 file changed
+8
-4
@@ -352,6 +352,7 @@ def save_jobs(jobs):
|
||||
@app.route('/', methods=['GET', 'POST'])
|
||||
@login_required
|
||||
def index():
|
||||
print(f"DEBUG: index() called with method={request.method}")
|
||||
global processing_complete, current_output_dir
|
||||
if request.method == 'POST':
|
||||
print(f"POST request received at {datetime.now()}")
|
||||
@@ -363,8 +364,13 @@ def index():
|
||||
# Clean up any previous processing
|
||||
cleanup_temp_files()
|
||||
|
||||
# Create temp dirs
|
||||
input_dir = tempfile.mkdtemp()
|
||||
# Create job ID first
|
||||
job_start_time = datetime.now()
|
||||
job_id = job_start_time.strftime('%Y%m%d_%H%M%S')
|
||||
|
||||
# Create dirs
|
||||
input_dir = os.path.join('uploads', job_id)
|
||||
os.makedirs(input_dir, exist_ok=True)
|
||||
output_dir = tempfile.mkdtemp()
|
||||
current_output_dir = output_dir
|
||||
|
||||
@@ -390,8 +396,6 @@ def index():
|
||||
print(f"Saved file from folder: {filename}")
|
||||
|
||||
# Create job immediately
|
||||
job_start_time = datetime.now()
|
||||
job_id = job_start_time.strftime('%Y%m%d_%H%M%S')
|
||||
jobs = load_jobs()
|
||||
jobs[job_id] = {
|
||||
'id': job_id,
|
||||
|
||||
Reference in new issue
Block a user