Another approach

This commit is contained in:
zandercymatics 2023-11-24 12:44:18 -07:00
parent 9c05dcde44
commit 90282c7cdc
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
2 changed files with 19 additions and 23 deletions

View file

@ -3,7 +3,6 @@ import os
from django.apps import apps
from django.views.decorators.http import require_http_methods
from django.http import FileResponse, HttpResponse, JsonResponse
import requests
from login_required import login_not_required
@ -107,7 +106,6 @@ def get_current_federal(request):
file_path = "migrationdata/current-federal.csv"
return serve_file(file_path)
def serve_file(file_path):
"""Downloads a file based on a given filepath. Returns a 404 if not found."""
if os.path.exists(file_path):