Skip to content

Commit e4b8f6d

Browse files
author
CarensirA
committed
Updated pandas to lazy load, as its only used for very specific admin uses, added preload to Procfile
1 parent 747cb5b commit e4b8f6d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Procfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
web: flask db upgrade && gunicorn --bind 0.0.0.0:$PORT --workers 2 --threads 4 "app:create_app()"
1+
web: flask db upgrade && gunicorn --bind 0.0.0.0:$PORT --preload --workers 2 --threads 4 "app:create_app()"

app/routes/admin/data_upload.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import re
1010
from io import BytesIO
1111

12-
import pandas as pd
1312
from flask import Blueprint, redirect, url_for, request, flash, Response
1413

1514
from app import db
@@ -180,6 +179,8 @@ def _read_uploaded_file(file) -> pd.DataFrame | None:
180179
181180
Validates file extension, MIME type, and size before reading.
182181
"""
182+
import pandas as pd
183+
183184
# Validate file first
184185
if not validate_upload_file(file):
185186
return None
@@ -204,6 +205,8 @@ def _read_uploaded_file(file) -> pd.DataFrame | None:
204205

205206
def _get_cell_value(row, col_name: str | None) -> str | None:
206207
"""Safely get a trimmed string value from a DataFrame row."""
208+
import pandas as pd
209+
207210
if col_name is None:
208211
return None
209212
val = row.get(col_name, '')

0 commit comments

Comments
 (0)