Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How to set custom text for django on_delete function?
I have a model named 'Clients' and another model named 'Information'. class Information(models.Model): client_name = models.ForeignKey(Clients, on_delete=models.SET(get_deleted_client_intance)) I want to set a custom text when a name is deleted from 'Clients' model. The below function creates a new name 'deleted' as a new entry and is saved in 'Clients' model. I don't want that. I want if I delete a name it says 'deleted' or 'removed' on it's place. def get_deleted_client_intance(): return Clients.objects.get_or_create(name='deleted')[0] How can I do this? -
Use Count with aggregate(Sum) in django ORM, Custom Queryset Fields
i want to use query in which I need No of Invoices and Total Amount of Invoices in a Queryset. Invoice.objects.aggregate(total_amount=Sum('order__order_items__amount')) Invoice.objects.count() how can i handle above queries in a single query. -
Efficient way to re-order objects in Django
I have written a query to re-order objects based on the values I get in the API request. Below is the sample code I have written: @action(detail=False, permission_classes=[], methods=["PUT"]) def reorder_modules(self, request, *args, **kwargs): """ ReOrdering Modules Sample request data { <module_id>: <ordering_number> 12: 2, 13: 1, 14, 3, } """ updatabale_modules = [] for module_id, module_order in request.data.get("modules", {}).items(): _mod = Module.objects.get(id=module_id) _mod.order = module_order updatabale_modules.append(_mod) Module.objects.bulk_update(updatabale_modules, ["order"]) return Response({"detail": "successfully reordered course modules"}, status=HTTP_200_OK) Is there any way to avoid looping and getting each module? If that's possible I should be able to save making a few queries. -
How to annotate foreignkey
class Bookmark(CoreModel): """Bookmark Model Definition""" spot = models.ForeignKey( "spots.Spot", related_name="bookmarks", on_delete=models.CASCADE ) class Spot(models.Model): """Spot Model Definition""" name = models.CharField(max_length=50) coords = models.PointField(srid=4326) this is my model bookmarks = Bookmark.objects.filter(user_id=user_id).annotate( distance=Distance("spot__coords", ref_location) ) for bookmark in bookmarks: print(bookmark.spot.distance) <- error this is my queryset bookmark.distance is working, but i want bookmark.spot.distance "distance" appears in "bookmark". How can I annotate "distance" in "spot"? -
Request response in django
I have question? like if user request to the server then server process and in the processing if server gets another request then what will happen with the response i am talking about django -
While Creating a new user in Django, I'm seeing this error: for model in model_or_iterable: TypeError: 'function' object is not iterable
I am new to Django and currently, I'm building a web application which requires user authentication. I'm trying to make a sign-up page for new users. I tried to register my User model on the admin.py page but now I'm seeing this error. It says I'm having the error at the 8th line of the admin.py file. Here's my admin.py file. from django.contrib import admin from .models import User # Register your models here. class User_display(admin.ModelAdmin): list_display = ("id","username","password") admin.site.register(User,User_display) Right now, I have only the User model. Here's my views.py file. def register(request): if request.method == "POST": username = request.POST["username"] email = request.POST["email"] password = request.POST["password"] confirm_password = request.POST["confirm_password"] if(password != confirm_password): return render(request,"precisionmedicine/register.html",{ 'message' : "Sorry! Password didn't matche." }) try: user = User.objects.create_user(username, email, password) user.save() except IntegrityError: return render(request, "network/register.html", { "message": "Username already taken." }) login(request,user) return HttpResponseRedirect(reverse("profile",kwargs={id: request.user.id})) else: return render(request,"precisionmedicine/register.html") def profile(request,id): id = request.user.id return render(request,"precisionmedicine/profile.html",{ 'id' : id }) I don't exactly get this problem. Please let me know if I need to share more parts of my code. I need to solve this immediately. -
filter price range by django-filter
I added a price range filter by Django-filter but seems it doesn't work filters.py from django_filters import FilterSet from .models import Apartment class ApartmentFilter(FilterSet): class Meta: model = Apartment fields = { 'price': ['lt','gt'] } views.py class ApartmentViewSet(viewsets.ModelViewSet): queryset = Apartment.objects.all().order_by('-timestamp') serializer_class = ApartmentSerializer permission_classes = [ permissions.IsAuthenticatedOrReadOnly, IsOwnerApartmentOrReadOnly] filter_backends = [filters.SearchFilter, DjangoFilterBackend, filters.OrderingFilter] filter_class = ApartmentFilter search_fields = ['address'] filterset_fields = ['category', 'district'] ordering_fields = ('price',) -
Django upload and download files in google drive using googledriveapi
I am new to django and trying to create a web app to upload and download files to the google drive using gdriveapi. I have gone through the python quickstart for Google drive and tried the code in manage.py where it is working. How to write the same code to obtain credentials and upload and download in the django app? How to write the view and model in django to obtain credentials and upload files to gdrive? -
Other keys for error messages in Django model
When you want to set error messages in Django model field use: class UserCreationForm(forms.ModelForm): password1 = forms.CharField( label='password', widget=forms.PasswordInput(attrs={'class': 'form-control form-control-lg'}), error_messages={ 'required': ("required"), '?': ("..."), } ) How can we fine other keys like required? -
Download Excel File in Django
we have several complicated, long-running functions that generate data reports. These services started taking longer as we scaled up, and we were getting concerned that our report generation functions might time out, or jam the server for other users. We didn’t see a lot of guides on implementing async downloads on apps that use Django for both the front and the back end, So I'm looking for some guide how can i implement async download properly, for production level. -
Django: How to render a Model from a tempalte to another?
I have an app were I'm trying to make a course with modules in it, and inside the course page I want to link a page with the modules of the course in it but I get "TypeError at /modules modules_page() missing 1 required positional argument: 'id'". Sorry for my bad explaining. I appreciate every answer, thanks in advance! Models.py class Course(models.Model): title = models.CharField(max_length=30) description = models.TextField(null=True, max_length=150) #completion_time = models.CharField(max_length=30) course_image = models.ImageField(blank=True, null=True, upload_to="images/") watching = models.ManyToManyField(User, blank=True, related_name="watchlist") category = models.ForeignKey(Category, on_delete=models.CASCADE ,related_name="listing_category") author = models.ForeignKey(User, on_delete=models.PROTECT, related_name="author") ended = models.BooleanField(default=False) creation_date = models.DateTimeField(default=timezone.now) class Module(models.Model): title = models.CharField(max_length=255, null=True) description = models.TextField(blank=True, max_length=2550, null=True) module_image = models.ImageField(blank=True, null=True, upload_to="images/") creation_date = models.DateTimeField(default=timezone.now) module_author = models.ForeignKey(User, on_delete=models.PROTECT, related_name="module_author") deadlined = models.BooleanField(default=False) course = models.ForeignKey(Course, on_delete=models.CASCADE, related_name="modules", null=True) Views.py def courses_page(request): courses = Course.objects.all() return render(request, "auctions/index.html", { "courses": courses }) # THIS FUNCTION IS NOT WORKING def modules_page(request, id): if not request.user.is_authenticated: return render(request, "auctions/login.html") course = Course.objects.get(id=id) ended = Course.ended return render(request, "auctions/modules_page.html", { "course": course, "course_ended": "Course has ended.", "commentform": CommentForm() }) Urls.py path("", views.index, name="index"), path("auction/course/<str:id>", views.course, name="course"), path("modules", views.modules_page, name="modules_page"), Template.html: <!-- Modules --> <h3><span class="badge badge-secondary badge-pill mx-1">{{ course.modules.count }}</span><a href="{% … -
request.user returning AnonymousUser in ModelViewSet, but working properly in APIView
I am trying to customize get_queryset() in my DocumentViewSet so the GET method will return all Document objects created by request.user (currently logged in user). However, I am stuck in this error:django.core.exceptions.ValidationError: ['“AnonymousUser” is not a valid UUID.'] I assume this is caused by getting AnonymousUser as my self.request.user. The weird part is that my other APIView that deals with request.user are working flawlessly; The only difference I could find between the two is type of viewset: ModelViewSet vs APIView. Would appreciate any help! document.views class DocumentViewSet(viewsets.ModelViewSet): model = Document serializer_class = DocumentSerializer list_serializer_class = DocumentListSerializer permission_classes = (AllowAny,) # for testing, will change later def get_queryset(self): user = self.request.user return Document.objects.filter(user=user) def perform_create(self, serializer): print(self.request.user) serializer.save(user=self.request.user) document.models class Document(models.Model): id = HashidAutoField(primary_key=True) user = models.ForeignKey(User, on_delete=models.CASCADE, blank=True, null=True) title = models.CharField(max_length=100, default="Untitled") template = models.CharField(max_length=100, default="") editorState = models.JSONField(default=[]) updated = models.DateTimeField(auto_now=True) created = models.DateTimeField(auto_now_add=True) def __str__(self): return self.title user.models class User(AbstractUser): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) username = None first_name = models.CharField(max_length=100, default="unknown") last_name = models.CharField(max_length=100, default="unknown") profile_pic = models.CharField(max_length=200, default="unknown") email = models.EmailField(unique=True, db_index=True) secret_key = models.CharField(max_length=255, default=get_random_secret_key) USERNAME_FIELD = "email" REQUIRED_FIELDS = [] class Meta: swappable = "AUTH_USER_MODEL" users.api & selectors This is the APIView which … -
Cannot assign 3, must be a model instance while bulk create in django rest
I am trying to do a bulk create and update in a view. But however, when I bulk create the following error. ValueError: Cannot assign "3": "LmsGrade.exam" must be a "LmsExamModel" instance. I have done bulk_create several times before but none of the time it ask for a instance instead of id. But I think its because i did in the serializer class and serializer class pre validates everything before performing an operation. MY models: class LmsGrade(TimeStampAbstractModel): exam = models.ForeignKey( "lms_exam.LmsExamModel", on_delete=models.CASCADE, related_name="lms_grades" ) student = models.ForeignKey( Student, on_delete=models.CASCADE, related_name="grades" ) marks_obtained = models.PositiveIntegerField(blank=True) grade_obtained = models.CharField(max_length=2, blank=True) present = models.BooleanField(default=True) My view: def create(self, request, *args, **kwargs): grades = self.request.data grades_to_create = [] grades_to_update = [] grades = [ { "id": LmsGrade.objects.filter( exam_id=grade.get("exam"), student_id=grade.get("student"), ) .first() .id if LmsGrade.objects.filter( exam_id=grade.get("exam"), student_id=grade.get("student"), ).first() is not None else None, **grade, } for grade in grades ] [ grades_to_update.append(grade) if grade["id"] is not None else grades_to_create.append(grade) for grade in grades ] [grade.pop("id") for grade in grades_to_create] LmsGrade.objects.bulk_create( [LmsGrade(**item) for item in grades_to_create] ) # test = [LmsGrade(**item) for item in grades_to_create] LmsGrade.objects.bulk_update( [ LmsGrade(id=item.get("id"), marks_obtained=item.get("marks_obtained"),grade_obtained=item.get("grade_obtained"),present=item.get("present")) for item in grades_to_update ], ["value"], batch_size=1000 ) qs = LmsGrade.objects.filter(exam__id=request.data.get("exam")) serializer = self.get_serializer(data=qs, many=True) serializer.is_valid(raise_exception=True) serializer.save() … -
Django: how to save image in django?
i am trying to save image in django, but it seems not to be working as expected and i can't really tell what is going with the code. the the way i am submitting the form is not a straight forward way of doing form.save but i am trying to create a topic, if there is no existing topic from the drop down, other informations get saved but the image does not get saved. views.py @login_required def CreateRoom(request): topics = Topic.objects.all() if request.method == "POST": form = ChatRoomForm(request.POST, request.FILES) topic_name = request.POST.get("topic") topic , created = Topic.objects.get_or_create(name = topic_name ) new_room = Chatroom.objects.create( host=request.user , roomname = request.POST.get("roomname") , topic = topic , description = request.POST.get("description" ), image = request.POST.get("image" ) ) new_room.participants.add(request.user.id) return redirect("chats:chat-room" , pk=new_room.id) else: form = ChatRoomForm() context = {"form": form, "button_value": "Create" , "topics" : topics} return render(request, "chat/room_form.html", context) create-room.html <form action="" method="POST" enctype="multipart/form-data"> {% csrf_token %} <label for="room_topic"> Topic </label> <input value = "{{room.topic.name}}" type="text" name="topic" list="topic-list" placeholder = "Topic for the room.." required /> <datalist id="topic-list"> <select id="room_topic"> {% for topic in topics %} <option value="{{topic.name}}">{{topic.name}}</option> {% endfor %} </select> </datalist> {{form.image}} {{form.roomname}} {{form.description}} <input type="submit" value="{{button_value}}" /> </form> -
How to pass Django formset form variable to JavaScript function
Basically I am using formsets, each form has a form ID and a deleted button amongst other things. When the delete button is clicked i'd like to call a function and pass the form ID to it, how can i achieve this? {% for form in formset %} {{ form.form_id_test }} <button id="delete-form" type="button" class="btn btn-primary mb-2" onclick="deleteFormFunc({{ form.form_id_test }})"> Delete Form </button> {% endfor %} I am not able to pass the arguments like this, basically syntax error. -
I'm trying to deployment django project on EC2 but error appear:Failed at step USER spawning
I'm trying to deployment django project on EC2 but an error appears I don't not what is wrong I do every thing correct [Unit] Description=gunicorn daemon After=network.target [Service] User=ubuntu Group=www-data WorkingDirectory=/home/ubuntu/project_wishlist ExecStart=/home/ubuntu/project_wishlist/venv/bin/gunicorn --workers 3 --bind unix:/home/ubuntu/project_wishlist/wishlist.sock wishlist.wsgi:application [Install] WantedBy=multi-user.target ● gunicorn.service - gunicorn daemon Loaded: loaded (/etc/systemd/system/gunicorn.service; disabled; vendor preset: disabled) Active: failed (Result: exit-code) since Sun 2022-06-26 22:51:26 UTC; 17min ago Main PID: 3739 (code=exited, status=217/USER) Jun 26 22:51:26 ip-172-31-83-229.ec2.internal systemd[1]: Started gunicorn daemon. Jun 26 22:51:26 ip-172-31-83-229.ec2.internal systemd[3739]: Failed at step USER spawning /home/ubuntu/project_wishlist/venv/bin/gunicorn: No such process Jun 26 22:51:26 ip-172-31-83-229.ec2.internal systemd[1]: gunicorn.service: main process exited, code=exited, status=217/USER Jun 26 22:51:26 ip-172-31-83-229.ec2.internal systemd[1]: Unit gunicorn.service entered failed state. Jun 26 22:51:26 ip-172-31-83-229.ec2.internal systemd[1]: gunicorn.service failed. Hint: Some lines were ellipsized, use -l to show in full. Failed at step USER spawning /home/ubuntu/project_wishlist/venv/bin/gunicorn: No such process -
Why is my code throwing 'NoneType' object has no attribute 'basic_investment_return'?
Why is this line of code withdraw.investment.basic_investment_return -= withdraw.basic_withdraw_amount throwing this error 'NoneType' object has no attribute 'basic_investment_return' Views @login_required def create_withdrawal_view(request): if request.method == 'POST': basic_withdraw_form = BasicWithdrawalForm(request.POST) if basic_withdraw_form.is_valid(): withdraw = basic_withdraw_form.save() withdraw.investment.basic_investment_return -= withdraw.basic_withdraw_amount print(withdraw.investment.basic_investment_return) withdraw.save() messages.success(request, 'your withdrawal of {} is successfull '.format(withdraw.basic_withdraw_amount)) else: messages.success(request, 'your withdrawal of {} is unsuccessfull '.format(withdraw.basic_withdraw_amount)) else: basic_withdraw_form = BasicWithdrawalForm() context = {'basic_withdraw_form': basic_withdraw_form} return render(request, 'create-basic-withdrawal.html', context) models class Investment(models.Model): basic_investment_return = models.IntegerField(default=0, null=True, blank=True) class Withdraw(models.Model): investment = models.ForeignKey(Investment, on_delete=models.CASCADE, null=True) basic_withdraw_amount = models.IntegerField(default=0, null=True, blank=True) Forms class BasicInvestmentForm(forms.ModelForm): class Meta: model = Investment fields = ['basic_deposit_amount'] class BasicWithdrawalForm(forms.ModelForm): class Meta: model = Withdraw fields = ['basic_withdraw_amount'] -
Django app with Plotly/Dash callback and Celery/Redis
I have a Django project where one of my apps provides interactive data visualization using Dash/Plotly and is deployed to Heroku. As my database grew bigger, the time it takes to collect the relevant data, normalize it, and plot it, is now often larger than 30s, therefore the requests are timing out and my plots are not showing up anymore, which is sad, because they were working great :/ What I'm trying to do now is to use Celery so that the data collection and normalization is dispatched to a worker and run asynchronously having Redis as a broker, but this is getting extremely confusing as I don't have any experience with these frameworks and I couldn't find an example of such an application. I'm posting below a simplified and analogous app without any Celery stuff, that works exactly how I want (the user provides a seed and the app plots a scatter plot with random numbers generated from that seed). The project tree is: djcel/ djcel/ worker/ dash_apps/ test_apps/ plot.py templates/ worker/ scatter_plot.html urls.py views.py And the main files are: plot.py from dash import dcc from dash import html from dash.dependencies import Input, Output from django_plotly_dash import DjangoDash import … -
Django Rest can't write custom Throttle and getting ImportError:
folder structure api/api_views.py api_views.py class BurstRateThrottle(UserRateThrottle): scope = 'burst' class SustainedRateThrottle(UserRateThrottle): scope = 'sustained' settings.py REST_FRAMEWORK = { 'DEFAULT_THROTTLE_CLASSES': [ 'api.api_views.BurstRateThrottle', 'api.api_views.SustainedRateThrottle' ], 'DEFAULT_THROTTLE_RATES': { 'burst': '60/min', 'sustained': '1000/day' } } Getting this error : Could not import 'api.api_views.BurstRateThrottle' for API setting 'DEFAULT_THROTTLE_CLASSES'. ImportError: Module "api.api_views" does not define a "BurstRateThrottle" attribute/class. -
AttributeError: 'Language' object has no attribute 'lang_proficiency'
My models look like these : first have user profile class UserProfile(models.Model): """user profiling """ user = models.OneToOneField(User, on_delete=models.CASCADE) location = models.CharField(max_length=255) languages = models.ManyToManyField('Language', through="UserLanguage") then have a language many to many relation class Language(models.Model): name = models.CharField(max_length=50) then have a through table to store this data class UserLanguage(models.Model): language = models.ForeignKey(Language, on_delete=models.CASCADE) user_profile = models.ForeignKey(UserProfile, on_delete=models.CASCADE) class ProficiencyStatus(models.TextChoices): FLUENT = 'FL', _('FLUENT') CONSERVATION = 'CT', _('CONSERVATIONAL') lang_proficiency = models.CharField( max_length=2, choices=ProficiencyStatus.choices, default=ProficiencyStatus.FLUENT, ) now issue is when I am inserting data in this table like : language_obj = Language.objects.create(name=language.get('name')) user_lang_obj = UserLanguage.objects.create(language=language_obj, user_profile=user_profile, lang_proficiency='FL') user_profile.languages.add(language_obj) I am getting error like: AttributeError: 'Language' object has no attribute 'lang_proficiency' -
Django Custom user model, the model saved in a separated file inside folder
I am new to Django and working on a project that needs a custom user. I created folders for models, views, URLs, and serializers. Each feature has its own file in these folders. Everything works fine until I rename models.py file to users_model.py or move it to the models folder that I created. When I makemigrations the following error appears: django.core.exceptions.ImproperlyConfigured: AUTH_USER_MODEL refers to model 'app.AppUser' that has not been installed My code: users_model.py class AppUser(AbstractBaseUser): . . . class MyUserManager(BaseUserManager): def create_user(self, email, username, password): . . def create_superuser(self, email, username, password): . . Admin.py . . admin.site.register(AppUser) sittings.py INSTALLED_APPS = [ . . "app", ] AUTH_USER_MODEL = "app.AppUser" I tried AUTH_USER_MODEL = "app.models.users_model.AppUser" ValueError: Invalid model reference 'app.models.users_model.AppUser'. String model references must be of the form 'app_label.ModelName'. I tried AUTH_USER_MODEL = "app.models.AppUser" ValueError: Invalid model reference 'app.models.AppUser'. String model references must be of the form 'app_label.ModelName'. -
How to combine multiple models into one view template in django
I have two models class Post(models.Model): title = models.CharField(max_length=100) body = RichTextField(max_length=1000000) created_at = models.DateTimeField(default=datetime.now, blank = True) image = ResizedImageField(size=[250, 200], upload_to='img') and class Politics(models.Model): title = models.CharField(max_length=100) body = RichTextField(max_length=1000000) created_at = models.DateTimeField(default=datetime.now, blank = True) image = ResizedImageField(size=[250, 200], upload_to='img',blank = True) I want to combine them both into one template view and render them on the index.html Here is my view function def index(request): politics = Politics.objects.all() return render(request, 'index.html', {'politics':politics, 'posts': Post.objects.all()}) However, only the 'politics' object is being rendered. What could be wrong? -
django AttributeError when querying data from the database
I keep getting AttributeError: 'QuerySet' object has no attribute 'title' error whenever i use obj=Userpost.objects.all() . How will i format it so that i can use it to query all data in the database? this is my snippet code obj=Userpost.objects.all() context={ 'title':obj.title, 'content':obj.content, 'date':obj.date, } -
Django Rest Framework with shortuuid, generics.RetrieveUpdateDestroyAPIView returning 404 {"detail": "Not found."}
I was remaking a social media site as a revision of Django and the rest framework, I didn't want to use the django default linear id count and didn't like how long the uuid library's ids was, so I used the shortuuid library. I've used them on the posts and the comments just to keep the anonymity of the count of both posts and comments. On the posts side everything works for the CRUD stuff (which should be proof that the issue isn't from the shortuuid library, as far as I know), although with the comments the Create Retrieve works perfectly but the Update Destroy doesn't. so here is the code we are working with: starting with the models to know what kind of data we are working with (models.py): from shortuuid.django_fields import ShortUUIDField ... # posts likes etc class Comment(models.Model): id = ShortUUIDField(primary_key=True, length=8, max_length=10) user = models.ForeignKey(User, on_delete=models.CASCADE) post = models.ForeignKey(Post, on_delete=models.CASCADE) body = models.TextField(max_length=350) created = models.DateTimeField(auto_now_add=True) updated = models.DateTimeField(auto_now=True) active = models.BooleanField(default=True) class Meta: ordering = ['created'] def __str__(self): return f'on {self.post} by {self.user}' objects = models.Manager() serializers.py: class CommentSerializer(ModelSerializer): username = SerializerMethodField() def get_username(self, comment): return str(comment.user) class Meta: model = Comment fields = ['id', … -
Django Apache - internal Server Error mod_wsgi
So I set up my django and it seemed to be working fine until I noticed my admin panel would not be styled with css. I also could not access one of my views via url getting an Internal Server Error. The Apache Error Log looks like this but I dont really get what I messed up. [Sun Jun 26 19:46:29.256896 2022] [wsgi:error] [pid 19419] [client 192.168.2.138:61502] mod_wsgi (pid=19419): Failed to exec Python script file '/home/pi/myproject/myprojectenv/myproject/myproject/wsgi.py'. [Sun Jun 26 19:46:29.257249 2022] [wsgi:error] [pid 19419] [client 192.168.2.138:61502] mod_wsgi (pid=19419): Exception occurred processing WSGI script '/home/pi/myproject/myprojectenv/myproject/myproject/wsgi.py'. [Sun Jun 26 19:46:29.257906 2022] [wsgi:error] [pid 19419] [client 192.168.2.138:61502] Traceback (most recent call last): [Sun Jun 26 19:46:29.258141 2022] [wsgi:error] [pid 19419] [client 192.168.2.138:61502] File "/home/pi/myproject/myprojectenv/myproject/myproject/wsgi.py", line 16, in <module> [Sun Jun 26 19:46:29.258201 2022] [wsgi:error] [pid 19419] [client 192.168.2.138:61502] application = get_wsgi_application() [Sun Jun 26 19:46:29.258274 2022] [wsgi:error] [pid 19419] [client 192.168.2.138:61502] File "/home/pi/myproject/myprojectenv/lib/python3.7/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application [Sun Jun 26 19:46:29.258324 2022] [wsgi:error] [pid 19419] [client 192.168.2.138:61502] django.setup(set_prefix=False) [Sun Jun 26 19:46:29.258458 2022] [wsgi:error] [pid 19419] [client 192.168.2.138:61502] File "/home/pi/myproject/myprojectenv/lib/python3.7/site-packages/django/__init__.py", line 24, in setup [Sun Jun 26 19:46:29.258508 2022] [wsgi:error] [pid 19419] [client 192.168.2.138:61502] apps.populate(settings.INSTALLED_APPS) [Sun Jun 26 19:46:29.258575 2022] [wsgi:error] [pid 19419] …