diff --git a/backend/api/forms.py b/backend/api/forms.py new file mode 100644 index 0000000..3606870 --- /dev/null +++ b/backend/api/forms.py @@ -0,0 +1,12 @@ +from django import forms + +class UploadFileForm(forms.Form): + file = forms.FileField(label='Select a file') + + # You can add custom validation if needed + def clean_file(self): + file = self.cleaned_data.get('file') + if not file: + raise forms.ValidationError("No file uploaded!") + # Additional custom validations can be added here + return file diff --git a/backend/api/task.py b/backend/api/tasks.py similarity index 100% rename from backend/api/task.py rename to backend/api/tasks.py diff --git a/backend/backend/__init__.py b/backend/backend/__init__.py index e69de29..52ffd13 100644 --- a/backend/backend/__init__.py +++ b/backend/backend/__init__.py @@ -0,0 +1 @@ +from celery_app import app as celery diff --git a/backend/celery.py b/backend/celery.py deleted file mode 100644 index 312fe2e..0000000 --- a/backend/celery.py +++ /dev/null @@ -1,16 +0,0 @@ -from __future__ import absolute_import, unicode_literals -import os -from celery import Celery - -# set the default Django settings module for the 'celery' program. -os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings') - -app = Celery('backend') - -# Using a string here means the worker doesn't have to serialize -# the configuration object to child processes. -# Namespace 'CELERY' means all celery-related configs must start with 'CELERY_' -app.config_from_object('django.conf:settings', namespace='CELERY') - -# Load task modules from all registered Django app configs. -app.autodiscover_tasks() diff --git a/backend/celery_app.py b/backend/celery_app.py new file mode 100644 index 0000000..12ffede --- /dev/null +++ b/backend/celery_app.py @@ -0,0 +1,9 @@ +from celery import Celery + +app = Celery('backend') + +# Load configuration from Django settings, using the CELERY namespace. +app.config_from_object('django.conf:settings', namespace='CELERY') + +# Autodiscover tasks from installed apps. +app.autodiscover_tasks()