fix(upload): remove broken django.setup() from per-file thread

This commit is contained in:
PM-pinou
2026-07-24 23:18:16 +08:00
parent 92e1305c07
commit 10c9c46a84
4 changed files with 2148 additions and 8 deletions
+1
View File
@@ -0,0 +1 @@
6428
+1 -8
View File
@@ -73,16 +73,9 @@ def upload_csv(request):
def _process_single_file(run_id, filepath):
"""Load a single CSV into SQLite, then delete it."""
import django
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'tianxuan.settings'
os.environ['DJANGO_ALLOW_ASYNC_UNSAFE'] = 'true'
django.setup()
from analysis.models import AnalysisRun
"""Load a single CSV into SQLite, then delete it. Runs in background thread inside Django."""
from analysis.data_loader._sqlite import save_to_db, drop_sqlite_table
from analysis.data_loader._csv import load_csv_directory
from analysis.session_store import SessionStore
import logging
logger = logging.getLogger(__name__)
+2086
View File
File diff suppressed because it is too large Load Diff
+60
View File
@@ -12,3 +12,63 @@ System check identified no issues (0 silenced).
Performing system checks...
System check identified no issues (0 silenced).
Performing system checks...
System check identified no issues (0 silenced).
You have 19 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions, tianxuan_analysis.
Run 'python manage.py migrate' to apply them.
Operations to perform:
Apply all migrations: admin, auth, contenttypes, sessions, tianxuan_analysis
Running migrations:
Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying admin.0001_initial... OK
Applying admin.0002_logentry_remove_auto_add... OK
Applying admin.0003_logentry_add_action_flag_choices... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying auth.0007_alter_validators_add_error_messages... OK
Applying auth.0008_alter_user_username_max_length... OK
Applying auth.0009_alter_user_last_name_max_length... OK
Applying auth.0010_alter_group_name_max_length... OK
Applying auth.0011_update_proxy_permissions... OK
Applying auth.0012_alter_user_first_name_max_length... OK
Applying sessions.0001_initial... OK
Applying tianxuan_analysis.0001_squashed_0008_entityprofile_embedding_z_and_more... OK
[OK] Imported 57 TLS field definitions from: E:\hjq\Ììè¯\TlsDB.csv
New: 57 | Updated: 0 | Total: 57
July 24, 2026 - 23:11:03
Django version 4.2.30, using settings 'tianxuan.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CTRL-BREAK.
Performing system checks...
System check identified no issues (0 silenced).
July 24, 2026 - 23:12:48
Django version 4.2.30, using settings 'tianxuan.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CTRL-BREAK.
Performing system checks...
System check identified no issues (0 silenced).
July 24, 2026 - 23:13:52
Django version 4.2.30, using settings 'tianxuan.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CTRL-BREAK.
Performing system checks...
System check identified no issues (0 silenced).
July 24, 2026 - 23:15:31
Django version 4.2.30, using settings 'tianxuan.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CTRL-BREAK.