Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django GenerateSeries return same row multiple times
I've an appointment model with starts_at, repeat_duration I want to annotate the repeating values returned from a generated series the sum duration field till the end date so if date of appointment on 14-07-2024, end_date is 25-07-2024 and duration is 3 days it return 14, 17, 20, 23 as an array annotation but what I'm getting is the same object, returned multiple times and each time it has one value of the series result for the example it'll be returned four times one for each value and repeat_days will be this value object_1.repeat_days = 14 object_2.repeat_days = 17 how to make it return only one object and the values as an array tried arrayagg to wrap the GenerateSeries but I'm getting aggregate function calls cannot contain set-returning function calls class AppointmentQuerySet(models.QuerySet): def annotate_repeated_days(self, end_date): return self.annotate( repeat_dates=ArrayAgg( GenerateSeries( models.F("starts_at"), models.F("repeat_duration"), end_date ) ) ) function: from django.db import models class GenerateSeries(models.Func): function = 'generate_series' output_field = models.DateTimeField() def __init__(self, start, step, stop, **extra): expressions = [ start, stop, step ] super().__init__(*expressions, **extra) any ideas? -
How to give permissions to users in django.?
I am building a django ERP project, in which there will be multiple user's, admin,user, manager etc. Each of this user has separate user credentials to login. Each user have separate dashboard. I'm using local database for login function. I want to give access to every user from admin dashboard, like view, edit,and delete, allow them to download csv file. I am trying to make privilege page for each user in admin dashboard. When a radio button or check box turn on, that respective user had to access the privilege. -
NoReverseMatch at /users/reset/done/
this is my url file after getting link on terminal and typing new password i am getting this message when i hit to submit, eventually password is reset but i am getting the error NoReverseMatch at /users/reset/done/ i tried without using templates and with custom templates of my own this is a github link of project https://github.com/agrawalaman4310/Social_Project.git -
gunicorn: command not found when hosting on Railway
I am new to Django and hosting web applications, and I am trying to host my first one using Railway. The application successfully builds and deploys for about 5 seconds before crashing and giving me the error /bin/bash: line 1: gunicorn: command not found. It then tries to repeatedly restart the container, failing every time. I have a Procfile with the line web: gunicorn EPLInsights:app, created the requirements.txt file using pip freeze > requirements.txt, and specified the runtime. I also have whitenoise installed, DEBUG set to false, and ALLOWED_HOSTS set to ['*']. Unfortunately, there is not much more information that Railway presents with the error, so I am having trouble figuring out what is causing it. If anyone has any insight it would be greatly appreciated. -
Django: Manager isn’t available; ‘auth.User’ has been swapped for ‘userauths.CustomUser’
I’m working on a Django project and encountering an issue when trying to sign up a new vendor. The error message I’m getting is: AttributeError at /vendorpannel/vendor_signup/ Manager isn't available; 'auth.User' has been swapped for 'userauths.CustomUser' What I’ve Tried: 1.Ensured AUTH_USER_MODEL is set correctly in settings.py: AUTH_USER_MODEL = 'userauths.CustomUser' 2.Updated references to the user model using get_user_model(): from django.contrib.auth import get_user_model User = get_user_model() 3.Checked and updated forms to use the custom user model: from django import forms from vendorpannel.models import * from django.contrib.auth.forms import UserCreationForm, AuthenticationForm from django.contrib.auth.models import User from django.db import transaction class VendorProfileForm(forms.ModelForm): class Meta: model = VendorProfile fields = [ 'company_name', 'contact_number', 'address', 'city', 'state', 'zip_code', 'country', 'website', 'profile_image', 'bio' ] 4.Updated admin configuration to use the custom user model: from django.contrib import admin from vendorpannel.models import VendorProfile from django.contrib.auth import get_user_model @admin.register(VendorProfile) class VendorProfileAdmin(admin.ModelAdmin): list_display = ('user', 'company_name', 'contact_number', 'city', 'state', 'country') Here are the relevant parts of my code: CustomUser model in userauths app: class CustomUser(AbstractUser): username = None email = models.EmailField(_('email address'), unique=True) USERNAME_FIELD = 'email' REQUIRED_FIELDS = [] objects = CustomUserManager() Vendor Signup View: def vendor_signup(request): if request.method == 'POST': form = VendorSignupForm(request.POST, request.FILES) if form.is_valid(): user = form.save() login(request, user) … -
Django redirect url not functioning as expected
So I am making a simple django project where me as a superuser, I can make restaurant instances and it will make a landing page for each restaurant. I have two admin panels, one is the main one, which is for superuser and the other is for restaurant owners who have the is_restaurant_admin set to true. Now the problem is, after stripe onboarding when I make a restaurant instance from admin panel, it redirects me to http://127.0.0.1:8000/restaurant-admin/login/?next=/restaurant-admin/%3Fstripe_onboarding_completed%3Dtrue even though I explicitly wrote the logic to redirect me to main admin page. Can anyone point out where the problem is please? Thanks! My models.py: class Restaurant(models.Model): name = models.CharField(max_length=100) email = models.EmailField() description = models.TextField() image = models.ImageField(upload_to='restaurant_images/') banner_image = models.ImageField(upload_to='restaurant_images/', null=True) primary_color = models.CharField(max_length=7) # Hex color code secondary_color = models.CharField(max_length=7) # Hex color code favicon = models.FileField(upload_to='restaurant_favicons/', null=True, blank=True) about_text = models.TextField(blank=True, null=True) map_iframe_src = models.TextField(blank=True, null=True) slug = models.SlugField(unique=True, max_length=100, null=True) stripe_account_id = models.CharField(max_length=255, null=True, blank=True) stripe_account_completed = models.BooleanField(default=False) def save(self, *args, **kwargs): if not self.slug: self.slug = slugify(self.name) super().save(*args, **kwargs) def __str__(self): return self.name class RestaurantUser(AbstractUser): restaurant = models.OneToOneField(Restaurant, on_delete=models.CASCADE, null=True, blank=True) is_restaurant_admin = models.BooleanField(default=False) def save(self, *args, **kwargs): if self.is_restaurant_admin: self.is_staff = True super().save(*args, **kwargs) My … -
How come I can't get my GET requests to work but I POSTS works fine?
I am working on my first webapp. I can sign up a user or log in a user and the user is stored in my database and a authentication token is generated when they log in. I can successfully have the user create a new venture profile which stores in my database and has a foreign key to associate the venture with the user. So POST is working fine. I am trying to use GET to send data from the database back to the front end and nothing I do will work. I have checked the code over and over and over and it still seems like the endpoint can't be found. This is my front end file which is supposed to display users ventures and its just saying "failed to fech user ventures" async function fetchUserVentures() { try { const token = localStorage.getItem('token'); const response = await fetch('http://localhost:3000/api/ventures', { headers: { 'Authorization': `Bearer ${token}` } }); if (!response.ok) { throw new Error('Failed to fetch user ventures'); } const data = await response.json(); userVentures.set(data); } catch (err) { error.set(err.message); } }` This is from my ventures.js file in routes folder in backend: router.get('/', authenticateToken, async (req, res) => { try … -
How to save css to persist over loading different pages or refreshing page
I am trying to implement the function of saving a post or liking a post and the css style of the like button or the save button doesn't apply when refreshing or changing page. how can I save the css styles to persist over different pages. I am using django in the backend here is my view in django: def favourite(request, post_id): user = request.user post = Post.objects.get(id=post_id) profile = Profile.objects.get(user=user) is_favourite = False if profile.favourite.filter(id=post_id).exists(): profile.favourite.remove(post) is_favourite = False else: profile.favourite.add(post) is_favourite = True response = { "is_favourite": is_favourite, } return JsonResponse(response) here is the html/css/js part: $(document).ready(function () { $('.favourite-button').click(function (e) { e.preventDefault(); var button = $(this); var post_id = button.data('id'); var url = button.attr('href'); $.ajax({ type: 'POST', url: url, data: { 'csrfmiddlewaretoken': '{{ csrf_token }}', }, success: function (response) { if (response.is_favourite) { button.find('i').addClass('liked'); } else { button.find('i').removeClass('liked'); } }, error: function (response) { console.error('Error:', response); } }); }); }); .action-buttons i.liked{ color: var(--btn-color); } <div class="action-buttons"> <div class="interaction-buttons"> <span> <a href="{% url 'like' post.id %}" class="like-button" data-id="{{ post.id }}"> <i class='bx bxs-heart {% if post.user_liked %} liked {% endif %}'></i> </a> </span> <span><i class='bx bxs-comment-detail'></i></span> <span><i class='bx bxs-share-alt'></i></span> </div> <div class="bookmark"> <span> <a href="{% url 'favourite' … -
Django accounts custom AuthenticationForm failing as invalid
Why is this giving form invalid? My username password input is correct. forms.py class CustomAuthForm(AuthenticationForm): username = forms.CharField(required=True, max_length = 50, widget=forms.EmailInput(attrs={"placeholder": "Email", "class":"form-control"})) password = forms.CharField(required=True, max_length = 50, widget=forms.PasswordInput(attrs={"placeholder":"Password", "class":"form-control"})) views.py @csrf_protect def user_login(request): if request.user.is_authenticated: return redirect('/') form=CustomAuthForm(request.POST or None) print(request.POST) if form.is_valid(): print(form.cleaned_data) else: print ('form invalid') Console print <QueryDict: {'csrfmiddlewaretoken': ['mt5a3e9KyCbVg4OokaDeCu97EDrHVInAwVJmmK3a2xn0Nn4KRi0gt7axWJyRDMmT'], 'username': ['myemail@gmail.com'], 'password': ['mypass']}> form invalid -
Query perfomance for main table with many-to-many relation in Django painfully slow on staging environment
I have a Django app which works with geodata. Querying the main table from Djangos ORM containing some larger polygons is all in all ridiculously slow, especially on our staging environment. The table currently has ~50k entries. A simple count over it with one boolean filter takes (times for ORM taken from Django Debug Toolbar, for raw SQL I copied the resulting SQL from there as well and ran it in psql shell): on my dev machine from Django ORM: ~600ms raw SQL: ~60ms on our staging instance from Django ORM: ~12s raw SQL: ~80ms What can cause this gigantic overhead? I find 10x on my local machine already heavy, but almost 200x on the staging instance just renders the application useless. How does Django Debug Toolbar measure the time for SQL execution? I suppose it could be some networking issue, so I already tested a database running in docker on staging instance and a hosted DB by AWS, same results. -
Validating POST parameters with serializers in Django
I'm trying to implement a simple validator for my POST parameters My input looks like this: { "gage_id": "01010000", "forcing_source":"my_source", "forcing_path":"my_path" } I have the following Serializer: class SaveTab1Serializer(Serializer): gage_id = CharField(min_length=1, required=True), forcing_source = CharField(min_length=1, required=True), forcing_path = CharField(min_length=1, required=True), And I use it like this: @api_view(['POST']) def save_tab1(request): body = json.loads(request.body) ser = SaveTab1Serializer(data=body) print('serializer', ser.is_valid()) print('errors', ser.errors) But now matter what I do with the data, it only shows as valid with no errors. Is there more code that I need to add to the serializer to do the validation? -
Unexpected sort order in bootstrap-table
Not sure if I'm doing something dumb or what, but I have a table initialized with data='table' A header like <th data-sortable="true" data-field='col_display_name' class="text-center th-lg "scope="col">{% trans site_display_name_header %}</th> And data that looks like this <td class="ml-5"> <a href="{% url 'sites:site_detail' site.id %}">{{ site.site_display_name }}</a> </td> However sorting the column just seems to toggle the sort between the default order and the reverse order, and doesn't seem related to the data in the column (site.site_display_name) Other columns in the table are setup the same way and seem to sort correctly based on the values in the column. There is no leading or trailing characters or anything that stands out that would make me think it is sorting correctly. My understanding from the bootstrap-table documentation is that if you use data-toggle='table' it automatically figures out the structure of the data and value specified in data-field='col_display_name' can really be anything you want to call it (as long as its unique I imagine). Any idea what I'm doing incorrectly? -
Usage of OneToOneField in Django
I am very confused about the usage of the OnetoOneField. I thought it was for a case where a given record can only have 1 reference to another table. For example, a Child has 1 Parent. But it seems that Django makes the field that is defined as OneToOne a primary key of your table, meaning it has a Unique constraint. This doesn't make any sense. Any given Child has only 1 Parent. But there might be more than 1 child with the same parent. The the FK to the parent is not going to be unique in the entire Child table I wanted to use OneToOne instead of ForeignKey in order to enforce the one-to-one aspect, as opposed to ForeignKey, which is 1 to Many (any given Child can have more than 1 parent). Am I wrong in my understanding? Should I go back to using ForeignKey and just ensure that my code enforces 1-1? I found these other links which asked the same question, but not sure that I saw a definitive answer Why would someone set primary_key=True on an One to one reationship (OneToOneField)? OneToOneField() vs ForeignKey() in Django -
Empty response from GET method inside post_save
I made a post_save pdf creation method from a django webpage using pdfkit, when I call the from_url method to generate and save a pdf, it doesnt pass the values from the request, so the pdf generated shows the template but no data, when I run the same code outside django (pycharm) it works fine, do request work differently with signals?? @receiver(post_save,sender=CertUsoSuelo) def gener_pdf(sender,instance,*args,**kwargs): try: instance.arch_pdf pass except Pdf_cus.DoesNotExist: cus = instance url = f'http://localhost:8000/p/det_cus/{cus.n_id}/' options = { 'page-size': 'Legal', 'margin-top': '0.25in', 'margin-right': '0.15in', 'margin-bottom': '0.25in', 'margin-left': '0.15in', 'encoding': "UTF-8", } pdfkit.from_url(url, F'{cus.n_id}.pdf', options=options) This is the page called def det_cus_oficial(request,cus_id): cus = CertUsoSuelo.objects.get(n_id=cus_id) normat = cus.zona_ipt zon_alt = [] print('cus',cus) print('normat',normat) if cus.homolog_zon is True: zon_alt = PlanReg.objects.get(CODZONA=str(cus.homolog_zon_alt)) return render(request, 'e_publico/cus_ok.html',{'cus':cus,'normat':normat,'zon_alt':zon_alt}) when page called from pycharm or normal request from webpage when called from post_save -
generate swagger docs for allauth.headless
Im using django for an api, where I use django-allauth and dj-rest-auth for authorization and drf-spectacular for documentation. Recently allauth-headless came out and I want to switch to using headless instead of dj-rest-auth. I've done the basic configuration and I think I did everything correct since the routes work. However, in swagger no routes are generated for the new allauth-headless endpoints. Does anybody know what could be the issue? -
Non consistent post_save GET method
I made a post_save pdf creation method from a django webpage using pdfkit, when I call the from_url method to generate and save a pdf, it doesnt pass the values from the request, so the pdf generated shows the template but no data, when I run the same code outside django (pycharm) it works fine, wheres the error?? @receiver(post_save,sender=CertUsoSuelo) def gener_pdf(sender,instance,*args,**kwargs): try: instance.arch_pdf pass except Pdf_cus.DoesNotExist: cus = instance url = f'http://localhost:8000/p/det_cus/{cus.n_id}/' options = { 'page-size': 'Legal', 'margin-top': '0.25in', 'margin-right': '0.15in', 'margin-bottom': '0.25in', 'margin-left': '0.15in', 'encoding': "UTF-8", } pdfkit.from_url(url, F'{cus.n_id}.pdf', options=options) -
Django template compare templatetag result with variable?
I've got template tag, that returns selected (earlier) location name of the store: @register.simple_tag( takes_context=True) def getSelectedLocation(context): request = context['request'] locationId = request.session.get('locationId') if (locationId): location = Location.objects.get(id = locationId) else: location = Location.objects.first() return location.locationName and in my template I'd like to compare it with actual variables: {%for eq in obj.equipment.all %} {%if getSelectedLocation != 'eq.storageLocation.locationName' %} something {%endif%} {%endfor%} (in general, template tag works ok, ie/ if called like {% getSelectedLocation %} returns correct name). But comparison won't work. Is it possible to do it that way? I think I can't move that logic to a view, as it enumerates over obj object foreign key values... Any suggestions? -
Django auth_views Html template not identifying request.Scheme
Html email template for Django Accounts' auth_view doesn't recognize the protocol, http or https. It works on other manual, non auth_views html email templates. Manual Html email template - request.Scheme works. <p>{{ request.Scheme }}://{{ domain }}{% url 'user_activate' uidb64=uid token=token %}</p> Manual html email template activation link http://192.168.1.1:9000/activate/NDY/c9rpjv-8f514370dc5a858e9575958738e5b34q Auth_view Html email template - request.Scheme doesn't work. <p>{{ request.Scheme }}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %}</p> Auth_view link in the email ://192.168.1.1:9000/password_reset_link/NDY/c3lpkf-237q81cs574ad1875551161a43c8c8a9 -
Automatically updated created_by/updated_by with Django authenticated user
I have a BaseModel that looks like this: class BaseModel(models.Model): updated_by = models.ForeignKey(UserTable???) updated_at = models.DateTimeField(auto_now=True) created_by = models.TextField(default=0) created_at = models.DateTimeField(auto_now_add=True) class Meta: abstract = True I want to automatically update the updated_by and created_by fields. But I'm not sure what to put as the target of the ForeignKey. I'm using Django's built in auth_user table, so I don't have a model for that. Also, I'm not clear how I would get the user, since I don't have access to the request object -
How to get the current domain name in Django template?
How to get the current domain name in Django template? Similar to {{domain}} for auth_views. I tried {{ domain }}, {{ site }}, {{ site_name }} according to below documentation. It didnt work. <p class="text-right">&copy; Copyright {% now 'Y' %} {{ site_name }}</p> It can be either IP address 192.168.1.1:8000 or mydomain.com https://docs.djangoproject.com/en/5.0/ref/contrib/sites/ In the syndication framework, the templates for title and description automatically have access to a variable {{ site }}, which is the Site object representing the current site. Also, the hook for providing item URLs will use the domain from the current Site object if you don’t specify a fully-qualified domain. In the authentication framework, django.contrib.auth.views.LoginView passes the current Site name to the template as {{ site_name }}. -
How to manually generate fixtures for Django Polymorphic Models?
I have some Django Polymorphic models: import uuid from django.db import models from polymorphic.models import PolymorphicModel class Fruit(PolymorphicModel): class Meta: abstract = True class Apple(Fruit): variety=models.CharField(max_length=30,primary_key=True) class Grape(Fruit): id=models.UUIDField(primary_key=True, default=uuid.uuid4) colour=models.CharField(max_length=30) Then I can create some fixtures: [ {"model": "test_polymorphic.apple", "pk": "bramley", "fields": {}}, {"model": "test_polymorphic.apple", "pk": "granny smith", "fields": {}}, {"model": "test_polymorphic.grape", "pk": "00000000-0000-4000-8000-000000000000", "fields": { "colour": "red"} }, {"model": "test_polymorphic.grape", "pk": "00000000-0000-4000-8000-000000000001", "fields": { "colour": "green"} } ] and use python -m django loaddata fixture_name to load it into the database which "appears" to be successful. Then if I use: from test_polymorphic import models models.Apple.objects.all() It raises the error: PolymorphicTypeUndefined: The model Apple#bramley does not have a `polymorphic_ctype_id` value defined. If you created models outside polymorphic, e.g. through an import or migration, make sure the `polymorphic_ctype_id` field points to the ContentType ID of the model subclass. Using loaddata bypasses the save() method of the model so the default content-types are not set on the models. I could find the appropriate content types using: from django.contrib.contenttypes.models import ContentType for model_name in ("apple", "grape"): print( model_name, ContentType.objects.get(app_label="test_polymorphic", model=model_name).id, ) Which outputs: apple: 3 grape: 2 and then change the fixture to: [ { "model": "test_polymorphic.apple", "pk": "bramley", "fields": { "polymorphic_ctype_id": … -
I get configure error when i try to launch my site in debug mode
Here's my manage.py: #!/usr/bin/env python """Django's command-line utility for administrative tasks.""" import os import sys def main(): """Run administrative tasks.""" os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'webstore.settings') # webstore is project name try: from django.core.management import execute_from_command_line except ImportError as exc: raise ImportError( "Couldn't import Django. Are you sure it's installed and " "available on your PYTHONPATH environment variable? Did you " "forget to activate a virtual environment?" ) from exc execute_from_command_line(sys.argv) if name == 'main': main() Here's the error: ImproperlyConfigured( django.core.exceptions.ImproperlyConfigured: Requested settings, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings. I've tried to set environment manually, nothing changed -
How to fix django-filer 404 error on DigitalOcean?
I have a django-cms app running on DigitalOcean. Creating folders and uploading files with filer works perfectly. When downloading the uploaded files I get a 404 Error - for example on this url: https://my_app.ondigitalocean.app/en/media/filer_public/39/d9/39d9ff20-1aa8-48e5-9b8f-113fc71e534b/atest.pdf/ The file is present in the filesystem: Everything is working on the local development server. -
ImportError error for a project running on apache: DLL load failed while importing cv2
Importing opencv before deployment worked fine for my django project, but deploying to apache was an error. Later I wrote a project that only used opencv to read images, but still deployed to apache with errors. [Wed Jul 03 15:44:57.683431 2024] [mpm_winnt:notice] [pid 8204:tid 392] AH00455: Apache/2.4.59 (Win64) mod_wsgi/4.9.2 Python/3.8 configured -- resuming normal operations [Wed Jul 03 15:44:57.683431 2024] [mpm_winnt:notice] [pid 8204:tid 392] AH00456: Apache Lounge VS17 Server built: Apr 4 2024 15:03:17 [Wed Jul 03 15:44:57.683431 2024] [core:notice] [pid 8204:tid 392] AH00094: Command line: 'F:\\bushu\\code\\Apache24\\bin\\httpd.exe -d F:/bushu/code/Apache24 -f F:\\bushu\\code\\Apache24\\conf\\httpd-cv2_text.conf' [Wed Jul 03 15:44:57.693432 2024] [mpm_winnt:notice] [pid 8204:tid 392] AH00418: Parent: Created child process 3884 [Wed Jul 03 15:44:58.058334 2024] [mpm_winnt:notice] [pid 3884:tid 396] AH00354: Child: Starting 64 worker threads. [Wed Jul 03 15:45:53.993438 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] mod_wsgi (pid=3884): Exception occurred processing WSGI script 'F:/bushu/code/code/cv2_text/cv2_text/wsgi.py'. [Wed Jul 03 15:45:54.085121 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] Traceback (most recent call last):\r [Wed Jul 03 15:45:54.085121 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] File "F:\\bushu\\code\\Python38\\lib\\site-packages\\django\\core\\handlers\\exception.py", line 55, in inner\r [Wed Jul 03 15:45:54.085121 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] response = get_response(request)\r [Wed Jul 03 15:45:54.085121 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] File "F:\\bushu\\code\\Python38\\lib\\site-packages\\django\\core\\handlers\\base.py", … -
celery cannot connect to redis in docker:kombu.exceptions.OperationalError: Error -3 connecting to redis:6379. Lookup timed out
I'm building a Websocket service in Django, and I chose celery to push messages。But when I run celery using eventlet on the online server, the following error occurred: Traceback (most recent call last): File "/usr/local/bin/celery", line 8, in <module> sys.exit(main()) ^^^^^^ File "/usr/local/lib/python3.12/site-packages/celery/__main__.py", line 15, in main sys.exit(_main()) ^^^^^^^ File "/usr/local/lib/python3.12/site-packages/celery/bin/celery.py", line 236, in main return celery(auto_envvar_prefix="CELERY") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/click/core.py", line 1157, in __call__ return self.main(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/click/core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, **ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/click/core.py", line 783, in invoke return __callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/click/decorators.py", line 33, in new_func return f(get_current_context(), *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/celery/bin/base.py", line 134, in caller return f(ctx, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/celery/bin/worker.py", line 348, in worker worker = app.Worker( ^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/celery/worker/worker.py", line 93, in __init__ self.app.loader.init_worker() File "/usr/local/lib/python3.12/site-packages/celery/loaders/base.py", line 110, in init_worker self.import_default_modules() File "/usr/local/lib/python3.12/site-packages/celery/loaders/base.py", line 104, in import_default_modules raise response File "/usr/local/lib/python3.12/site-packages/celery/utils/dispatch/signal.py", line 276, in send response = receiver(signal=self, sender=sender, **named) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/celery/fixups/django.py", line 97, in on_import_modules self.worker_fixup.validate_models() File "/usr/local/lib/python3.12/site-packages/celery/fixups/django.py", line 135, in validate_models self.django_setup() File "/usr/local/lib/python3.12/site-packages/celery/fixups/django.py", line 131, in django_setup django.setup() File "/usr/local/lib/python3.12/site-packages/django/__init__.py", line 24, in setup …