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'])
|
@app.route('/', methods=['GET', 'POST'])
|
||||||
@login_required
|
@login_required
|
||||||
def index():
|
def index():
|
||||||
|
print(f"DEBUG: index() called with method={request.method}")
|
||||||
global processing_complete, current_output_dir
|
global processing_complete, current_output_dir
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
print(f"POST request received at {datetime.now()}")
|
print(f"POST request received at {datetime.now()}")
|
||||||
@@ -363,8 +364,13 @@ def index():
|
|||||||
# Clean up any previous processing
|
# Clean up any previous processing
|
||||||
cleanup_temp_files()
|
cleanup_temp_files()
|
||||||
|
|
||||||
# Create temp dirs
|
# Create job ID first
|
||||||
input_dir = tempfile.mkdtemp()
|
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()
|
output_dir = tempfile.mkdtemp()
|
||||||
current_output_dir = output_dir
|
current_output_dir = output_dir
|
||||||
|
|
||||||
@@ -390,8 +396,6 @@ def index():
|
|||||||
print(f"Saved file from folder: {filename}")
|
print(f"Saved file from folder: {filename}")
|
||||||
|
|
||||||
# Create job immediately
|
# Create job immediately
|
||||||
job_start_time = datetime.now()
|
|
||||||
job_id = job_start_time.strftime('%Y%m%d_%H%M%S')
|
|
||||||
jobs = load_jobs()
|
jobs = load_jobs()
|
||||||
jobs[job_id] = {
|
jobs[job_id] = {
|
||||||
'id': job_id,
|
'id': job_id,
|
||||||
|
|||||||
Reference in new issue
Block a user