Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
What can I do to troubleshoot Django's failure to connect to Postgres in Docker-Compose on Ubuntu server?
I am trying to deploy my django app on Ubuntu server. It is actually working on localhost with windows machine. Dockerfile # pull official base image FROM python:3.11.2-slim-buster # set working directory WORKDIR /usr/src/app # set environment variables ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 # updated # install system dependencies RUN apt-get update \ && apt-get -y install gcc postgresql \ && apt-get clean # install dependencies RUN pip install --upgrade pip COPY ./requirements.txt . RUN pip install -r requirements.txt # new # copy entrypoint.sh RUN apt-get update && apt-get install -y netcat COPY ./entrypoint.sh /usr/src/app/entrypoint.sh RUN chmod +x /usr/src/app/entrypoint.sh # add app COPY . . # new # run entrypoint.sh ENTRYPOINT ["/usr/src/app/entrypoint.sh"] docker-compose version: '3.8' services: qutqaruv: build: ./app command: gunicorn qutqaruv_core.wsgi --bind 0.0.0.0:8001 volumes: - ./app/:/usr/src/app/ - static_volume:/static ports: - "8001:8001" env_file: - ./app/.env.dev depends_on: - qutqaruv-db nginx: image: nginx:1.22.1 ports: - "82:8081" volumes: - ./nginx/nginx-setup.conf:/etc/nginx/conf.d/default.conf:ro - static_volume:/static depends_on: - qutqaruv qutqaruv-db: image: postgres:15 volumes: - postgres_data:/var/lib/postgresql/data/ environment: - POSTGRES_USER=qutqaruv - POSTGRES_PASSWORD=qutqaruv - POSTGRES_DB=qutqaruv_dev volumes: postgres_data: static_volume: entrypoint #!/bin/sh if [ "$DATABASE" = "postgres" ] then echo "Waiting for postgres..." while ! nc -z $SQL_HOST $SQL_PORT; do echo $SQL_HOST $SQL_PORT sleep 0.1 echo "Got lost in this process" … -
openpyxl multiple headers and content
I'm using openpyxl for the first time in my django project. I got the task to make a two-part excel, that should be looking approximately like this: So basically i want to shaw all users of a certain organisation. This is what I have so far: def export_organisation(self, org_id): organization = Organization.objects.get(pk=org_id) wb = Workbook() ws = wb.active ws.title = "OKR" headers = [ ['Organisation Name', 'Signup Date', 'Language'], ['First Name', 'Last Name', 'Email'] ] line = 1 # Start from the first row for header_row in headers: ws.append(header_row) # Format bold the cells in the first row ft_bold = Font(bold = True) for cell in ws[ws.max_row]: cell.font = ft_bold line = ws.max_row+1 ws['A' + str(line)] = organization.name ws['B' + str(line)] = organization.signup_date.strftime("%d/%m/%Y") ws['C' + str(line)] = organization.language for user in organization.users.all(): ws['D' + str(line)] = user.first_name ws['E' + str(line)] = user.last_name ws['F' + str(line)] = user.email line+=1 # Filename with team name and date wb.save('{}.xlsx'.format(org_id)) But this gives me following output: Is there a way to make it look like the first image? If yes, what did I miss? -
How to annotate and combine some fields using Django annotate ORM?
I have a product table with 2 fields: Name Tag A 12 B 13 I want to fetch the rows annotating and adding a field type, which is a list , type=[1,2], such that I get the output as: Name Tag Type A 12 1 B 13 1 A 12 2 B 13 2 What should the query be to get the desired result? The query should be Product.objects.annotate(type=?) -
Running tests on Django multitable inheritance model causes IntegrityError
Running tests on Django multitable inheritance model causes IntegrityError Hello, I created a parent class and two children classes like that from django.db import models class A(models.Model): .... class B(A): .... class C(A): .... Whenever I try to run tests that create instance of class B I get this error django.db.utils.IntegrityError: duplicate key value violates unique constraint "app_b_pkey" E DETAIL: Key (a_ptr_id)=(2) already exists. -
Removed a container using command docker rm -f container_name, then when execute docker inspect container_name it returns a json output is it a bug
I removed a container using the following command docker rm -f container_name then when I execute docker inspect container_name i get the json output is it a bug ? When a docker container is removed, and after that a docker inspect is done it should return nothing. -
How to Join on Django Using ORM
Hello everybody I am at my wits' end here, I need help with doing a simple join between 2 tables using DJANGO ORM. The ultimate goal is to return a json response compatible with datatable which contains the product details and product category name instead of the category id. Like this { "draw": 1, "recordsTotal": 1, "recordsFiltered": 1, "data": [ { "productid": 4, "sku": "000001", "shortcode": "CBG", "category": 2, "categoryname": "Burgers", "productname": "Cheese Burger", "description": "This is a cheese burger", "barcode": "000001", "treshhold": 10, "isactive": true } ] } Here are my models class ProductCategory(models.Model): categoryid = models.AutoField(primary_key=True) shortcode = models.CharField(max_length=10) categoryname = models.CharField(max_length=50,unique=True) isactive= models.BooleanField(default=True) class Meta: db_table="tblProductCategory" class Product(models.Model): productid = models.AutoField(primary_key=True) sku = models.CharField(max_length=20,unique=True) shortcode = models.CharField(max_length=10) category = models.ForeignKey(ProductCategory, on_delete=models.SET_DEFAULT,default=0) productname = models.CharField(max_length=50) description = models.CharField(max_length=50) barcode = models.CharField(max_length=20) treshhold = models.IntegerField() isactive= models.BooleanField(default=True) class Meta: db_table="tblProduct" Here is my view def get_product(request): recordsTotal = 0 draw = int(request.GET['draw']) start = int(request.GET['start']) length = int(request.GET['length']) products = Product.objects.filter(sku__icontains = request.GET['sku']).select_related('category') recordsTotal = products.count() recordsFiltered = recordsTotal page = start / length + 1 paginator = Paginator(products, length) try: object_list = paginator.page(page).object_list except PageNotAnInteger: object_list = paginator.page(draw).object_list except EmptyPage: object_list = paginator.page(paginator.num_pages).object_list data = [model_to_dict(product) for product … -
makemigrations-command doesn't do anything
My production django-server uses postgres 12.12, django 32 and python 3.7. My test-server uses the exactly same software, but postgress 12.15. After adding a new table 'etusivu_heroimg' I copied contents of the production postgres into my test postgres database and run python manage.py makemigrations and python manage.py migrate --fake. The table was created and related features worked. Then I checked that the production side had exactly same code as the test server before migration commands, even the app-specific migration-directories were same. But when I ran the migration commands on the production side the new table wansn't created. (pika-env) [django@tkinfra01t pika]python manage.py makemigrations Migrations for 'etusivu': etusivu/migrations/0003_heroimg.py - Create model HeroImg (pika-env) [django@tkinfra01t pika]$ python manage.py migrate Operations to perform: Apply all migrations: admin, auth, conf, contenttypes, core, django_comments, etusivu, generic, kasitesivu, page_types, pages, redirects, sessions, sites Running migrations: No migrations to apply. Your models in app(s): 'admin', 'auth', 'conf', 'contenttypes', 'core', 'django_comments', 'generic', 'page_types', 'pages', 'redirects', 'sessions', 'sites' have changes that are not yet reflected in a migration, and so won't be applied. Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them. (pika-env) [django@tkinfra01t pika]python manage.py makemigrations No changes detected However the django_migrations-table was … -
How can I render dynamic QR codes in a slider using Django data?
Help, please I need to render in slider dynamic qr-codes. I receive data from admin model (Django). It work for text, but link for qrs are the same. <div id="carouselExampleIndicators" class="carousel slide" data-bs-ride="carousel"> <div class="carousel-inner"> {% for a in advertising %} <div class="carousel-item carousel-item1 {% if forloop.first %}active{% endif %}" data-bs-interval="2000"> <h3 class="install-app">{{a.advertising_text}}</h3> <div class="qr-wrapper"></div> </div> {% endfor %} </div> </div> And script qrCodeMaker(); function qrCodeMaker(qr) { const qrs = document.querySelectorAll(".qr-wrapper"); console.log('qrs', qrs) qrs.forEach(function (qr) { q = new QRCode(qr, { // {% for a in advertising %} text: "{{a.URL}}", // {% endfor %} colorDark: "#002F43", colorLight: "#F5F7F7" } ) }) } -
django-allauth redirect confirm page
I have an app on DJango. In the login part I have implemented authentication with Microsoft using DJango allatuh. When I press the "sign in" button with microsoft, before redirecting to the microsof, it redirects me to a page where I have to press the "continue" button. I want to remove this second page so that it automatically redirects me to the microsoft page. I have this on my "settings.py" file: SOCIALACCOUNT_PROVIDERS = { 'microsoft': { 'APP': { 'client_id': '', 'secret': '', }, 'SCOPE': ['User.Read'], 'AUTH_PARAMS': { 'prompt': 'select_account', }, 'INIT_PARAMS': { 'prompt': 'select_account', }, 'callback_url': 'https://myapp.test.com/accounts/microsoft/login/callback/', }, } ACCOUNT_EMAIL_VERIFICATION = 'None' ACCOUNT_EMAIL_REQUIRED = False I don't know what to change -
How do I enable email verification for new user in CVAT server?
I am trying to enable email verification for new users that'll be registering on the server. I followed the documentation and added the following options in the "base.py" file. But this doesn't seem to work. # https://github.com/pennersr/django-allauth ACCOUNT_EMAIL_VERIFICATION = 'mandatory' EMAIL_HOST = 'smtp.gmail.com' EMAIL_FROM = '<email>' EMAIL_HOST_USER = '<email>' EMAIL_HOST_PASSWORD = '<password>' EMAIL_PORT = 587 EMAIL_USE_TLS = True ACCOUNT_AUTHENTICATION_METHOD = 'username' ACCOUNT_CONFIRM_EMAIL_ON_GET = True ACCOUNT_EMAIL_REQUIRED = True EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' # set UI url to redirect after a successful e-mail confirmation #changed from '/auth/login' to '/auth/email-confirmation' for email confirmation message ACCOUNT_EMAIL_CONFIRMATION_ANONYMOUS_REDIRECT_URL = '/auth/email-confirmation' ACCOUNT_EMAIL_VERIFICATION_SENT_REDIRECT_URL = '/auth/email-verification-sent' INCORRECT_EMAIL_CONFIRMATION_URL = '/auth/incorrect-email-confirmation' OLD_PASSWORD_FIELD_ENABLED = True Code - https://toscode.gitee.com/wangdong_cn_admin/cvat/blob/master/cvat/settings/base.py Documentation - https://toscode.gitee.com/wangdong_cn_admin/cvat/blob/master/cvat/apps/documentation/installation.md#email-verification -
Django path('challenges/',include(challenges.urls)) NameError: name 'challenges' is not defined
When I comment urlpatterns = [ path('admin/', admin.site.urls), #path('challenges/',include(challenges.urls)) ] it is working fine but for urlpatterns = [ path('admin/', admin.site.urls), path('challenges/',include(challenges.urls)) ] it is throwing an error enter image description here why the error is occurring when I am using urlpatterns = [ path('admin/', admin.site.urls), path('challenges/',include(challenges.urls)) ] -
Problem in adding tags with taggit in Django
class Events(models.Model): user_name = models.TextField() e_url = models.URLField(null=True, blank=True) tags = TaggableManager() def __str__(self) -> str: return self.e_name def create_event(self, value): self.user_name = value['username'] self.e_url = value['url'] self.tags = value['tags'] Tags are not storing. When i store them from admin view its working properly. Bur when i try from my webpage its not working. Here value['tags'] contain string with comma separated tag name e.g. 'python,cpp,django'. My tags table is storing nothing in this case MEDIA_URL = '/media/' MEDIA_ROOT = BASE_DIR / 'media' -
django-log-viewer: LOG_VIEWER_FILES_PATTERN
I have 2 types of log files, with various "filenames": filename.log filename.log.1 How to configure this in LOG_VIEWER_FILES_PATTERN? This does not work: LOG_VIEWER_FILES_PATTERN = "*.log??" Note: django-log-viewer version 1.1.7 -
In my autocomplete search bar in django app i want that user always gets the most relevant search when he type his query in search bar
So suppose in my app there is a product name "DispoVan 10ml 21mg" and when user gives its query in search bar as 'DispoVan' it works fine but as he mis spell or do some typo error in search query like "dispo 1" search bar did not suggest him any product. i want that if user searches for any product and even if he do some typing error in the name of the product he should get the relevant product. even is there is a space in the search query,any relevant matches should be shown to him. This is my view which is showing list of all the products which matches to search. def search_address(request): address = request.GET.get('query') payload = [] print(address) if address: prod = Product.objects.filter(Q(name__icontains=address)).values_list('name',flat=True) for prod in prod: payload.append(prod) return JsonResponse({'status':200, 'data':payload}) -
What causes 'Broken pipe' errors in a Django application on GKE, and how can I prevent them?
I have deployed a Django application on a Google Kubernetes Engine (GKE) cluster, and it has been functioning well. However, recently I encountered a "Broken pipe" error with the message "Broken pipe from ('35.191.194.192', 57892)" in my application logs. Notably, I did not release any updates during this time, and there were no indications of a broken error in the load balancer logs. and , the error disappeared after some days, even though no new updates were deployed. I would like to understand the root cause behind this issue and learn how to prevent it from occurring in the future. I did not take any specific action to address the issue since it resolved itself after some days. However, I expected to understand the cause of the "Broken pipe" error and find ways to avoid it in the future. -
Got "token": [ "Ensure this field has no more than 500 characters." ] in drf social oauth2
REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': ( 'oauth2_provider.contrib.rest_framework.OAuth2Authentication', 'drf_social_oauth2.authentication.SocialAuthentication', ), } AUTHENTICATION_BACKENDS = ( 'social_core.backends.google.GoogleOAuth2', # drf-social-oauth2 'drf_social_oauth2.backends.DjangoOAuth2', # Django 'django.contrib.auth.backends.ModelBackend', ) SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = 'my key' SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = 'my secrect' # Define SOCIAL_AUTH_FACEBOOK_SCOPE to get extra permissions from Facebook. # Email is not sent by default, to get it, you must request the email permission. SOCIAL_AUTH_GOOGLE_OAUTH2_SCOPE = [ 'https://www.googleapis.com/auth/userinfo.email', 'https://www.googleapis.com/auth/userinfo.profile', ] I am using drf-social-oauth2 for Google login. After getting a Google credential from React site. i tried to use 'curl -X POST -d "grant_type=convert_token&client_id=<django-oauth-generated-client_id>&client_secret=<django-oauth-generated-client_secret>&backend=google-oauth2&token=<google_token>" http://localhost:8000/auth/convert-token' But I got "token": ["Ensure this field has no more than 500 characters."] -
How can I fix the 'zsh: command not found' error when trying to set up PostgreSQL for my Django project?
I am on the django official tutorial trying to set up PostgressSQL as the database for my project.I run the command CREATE DATABASE database_name I am getting the error message zsh: command not found. What have I tried so far: It instructs me to install the appropriate database bindings which I believe is psycopg2. I have installed psycopg2. After that it tells me to replace the engine and name values which I have done so substituting the blank strings for values. I don't think I am supposed to share my password or database name so I left it blank. DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': '', 'USER': '', 'PASSWORD':'', 'HOST': 'localhost', 'PORT': '5432', # default PostgreSQL port } } I went ahead and replaced the engine and name values as they told me. So I am wondering why It acts like I do not have postgress installed when I ran the installer and pgadmin and sucessfuly set it up. A programmer more experienced than myself was able to create a project without fail. Link to django tutorial here: https://docs.djangoproject.com/en/4.2/intro/tutorial02/. What have I tried already, and what steps have I taken to solve the problem: I have tried researching … -
django uwsgi: Server Error (500) - while accessing view model without "q" parameter
I started facing an issue since upgrading my server from Ubuntu 18.04 LTS to Ubuntu 20.04 LTS. It seems that I'm encountering an issue (Server Error (500)) with only one model, specifically with the URI /admin/mymodule/mymodel/. Please refer uwsgi logs below: [pid: 27771|app: 0|req: 4/8] 192.168.1.101 () {72 vars in 1623 bytes} [Fri May 26 06:11:11 2023] GET /admin/mymodule/mymodel/ => generated 145 bytes in 210 msecs (HTTP/1.1 500) 6 headers in 184 bytes (1 switches on core 0) But when trying the same URI with query parameter (/admin/mymodule/mymodel/?all=&q=2022-12-19), it is working fine. Please refer uwsgi logs below: [pid: 27768|app: 0|req: 3/9] 192.168.1.101 () {70 vars in 1627 bytes} [Fri May 26 06:11:15 2023] GET /admin/mymodule/mymodel/?all=&q=2022-12-19 => generated 100205 bytes in 1013 msecs (HTTP/1.1 200) 9 headers in 463 bytes (1 switches on core 0) [pid: 27770|app: 0|req: 3/10] 192.168.1.101 () {68 vars in 1468 bytes} [Fri May 26 06:11:16 2023] GET /admin/jsi18n/ => generated 3187 bytes in 12 msecs (HTTP/1.1 200) 6 headers in 189 bytes (1 switches on core 0) I don't understand the behavior as I'm able to access all other view models and custom views successfully without any issues. And able to access this view with any … -
Retrieve bank account number through plaid in Django
I am creating a financial app using django. I want a user can connect to any bank using Plaid and on the UI, I want to see the bank account number and balance. I am not sure how to retrieve the dummy bank account number I tried to connect to any bank using Plaid and I did that successfully. I have my account id and access token -
custom django sub-admin custom permission provided by admin
I have a django custom django admin panel and now i have create a new app where admin will be able to register sub admin once subadmin is registered he will get into another app where he has to select the sub admin from the drop down and will see the different app name with two option read or rea/write admin has to select one and that specific app with that select permission will be allocated the subadmin Pleas let me know how i can achieve this -
Django - Function Based View update record - error - Record Already exists
I am trying to update an existing record using Django 4.2, Crispy Forms, and Function Based View. The field currency_code in the table Currency is used as a ForeignKey in another table(s). I cannot update the currency record without getting the message that the record already exists. Below is the code and screenshot: MODELS.PY: class Currency(models.Model): currency_code = models.CharField(max_length=3) currency_name = models.CharField(max_length=80) class Meta: verbose_name_plural = "Currencies" def __str__(self): return self.currency_code class Forex(models.Model): currency_code = models.ForeignKey(Currency, on_delete=models.CASCADE) forex_rate = models.DecimalField(max_digits=8, decimal_places=4) last_updated_on = models.DateTimeField(auto_now=True) class Meta: verbose_name_plural = "Forex Rates" def __str__(self): return self.currency_code.currency_code FORMS.PY: class UpperCase(forms.CharField): def to_python(self,value): if value: return value.upper() class CurrencyForm(forms.ModelForm): currency_code = UpperCase(label='Currency Code', min_length=3, max_length=3, error_messages={'required': 'Currency Code Cannot Be Blank'}, required=True) currency_name = UpperCase(label='Currency Name', min_length=5, max_length=80, error_messages={'required': 'Currency Name Cannot Be Blank'}, required=True) class Meta: model = Currency fields = ['currency_code', 'currency_name'] # Method 2 for checking duplicates working ok def clean_currency_code(self): currency_code = self.cleaned_data.get('currency_code') if Currency.objects.filter(currency_code=currency_code).exists(): raise forms.ValidationError('Currency Code {} already exists!'.format(currency_code)) return currency_code VIEWS.PY: def currency_edit(request, id): obj = Currency.objects.get(id=id) if request.method == 'POST': form = CurrencyForm(data=request.POST, instance=obj) if form.is_valid(): form.save() return redirect('currency_list_page') else: form = CurrencyForm(instance=obj) return render(request, 'main/currency_edit.html', locals()) CURRENCY_EDIT.HTML <form action="{% url 'currency_edit_page' id %}" class="row g-3 … -
Is there the parameter to pass a billing address to "Payments" on Stripe Dashboard after a payment on Stripe Checkout?
I'm trying to pass a billing address to Payments on Stripe Dashboard but I couldn't find the parameter to do it in payment_intent_data. So instead, I used payment_intent_data.metadata as shown below. *I use Django: # "views.py" from django.shortcuts import redirect import stripe checkout_session = stripe.checkout.Session.create( line_items=[ { "price_data": { "currency": "USD", "unit_amount_decimal": 1000, "product_data": { "name": "T-shirt" }, }, "quantity": 2 } ], payment_intent_data={ "shipping":{ "name": "John Smith", "phone": "14153758094", "address":{ "country": "USA", "state": "California", "city": "San Francisco", "line1": "58 Middle Point Rd", "line2": "", "postal_code": "94124" } }, "metadata":{ # Here "name": "Anna Brown", "phone": "19058365484", "country": "Canada", "state": "Ontario", "city": "Newmarket", "line1": "3130 Leslie Street", "line2": "", "postal_code": "L3Y 2A3" } }, mode='payment', success_url='http://localhost:8000', cancel_url='http://localhost:8000' ) return redirect(checkout_session.url, code=303) Then, I could pass a billing address to Payments on Stripe Dashboard as shown below, but if there is the parameter to pass a billing address to Payments on Stripe Dashboard, it is really useful: I know that there are address parameter when creating a customer and address parameter when updating a customer but both address doesn't have name and phone parameters. # "views.py" from django.shortcuts import redirect import stripe def test(request): customer = stripe.Customer.search(query="email:'test@gmail.com'", limit=1) shipping={ "name": "John … -
Django cant link user to profile page from login
I have been trying to make a redirect link for the login of my django site, its supposed to take the user back to their profile page once they hit the login button, im trying to identify the user based on their id, which is defined in the models section, but for some reason it wont let me reference it by id, which is weird because it lets me do this for updating, and also viewing specific profiles sign in form {% extends 'base.html' %} {% block content %} <main class="form-signin w-100 m-auto"> <form action='<int:id>/' method='GET'> {{form.as_p}} <input type='Submit' value='Save ' /> </form> </main> {% endblock %} Models form where the id is defined from django.db import models from django import forms from django.utils.formats import date_format import datetime from datetime import date, timedelta from django.urls import reverse # Create your models here. class User(models.Model): GENDERS = [ ("F","FeMale"), ("M","Male"), ("O","Other"), ("N/A","Choose not to identify"), ("AH!","Attack Helicopter"), ] email = models.CharField(max_length=30,default=False) username = models.CharField(max_length=30,default=False) password = models.CharField(max_length=30,default=False) remember_login= models.BooleanField(blank=True) FA2 = models.BooleanField(default=False) dob = models.CharField(max_length=30) gender = models.CharField(max_length=4, choices=GENDERS) def get_absolute_url(self): return reverse("users:user-profile", kwargs={"id":self.id}) #could make a list of users to reference based on id, but this would prob be visible … -
blog post image slideshow
What I've got in my mind is that there is a blog section on my Django website. there are posts in this blog section. every post has a main photo. when you click on the main photo and post summary you can see more about that post. in the post details, there is a photo slide show which shows a couple of photos from the database. I defined my model like this: model.py: from django.db import models from django.contrib.auth.models import User class Post(models.Model): author = models.ForeignKey(User, on_delete=models.DO_NOTHING, null=True) image = models.ImageField(upload_to='blog_images/', default='blog_images/default.jpg') title = models.CharField(max_length=255) content = models.TextField() status = models.BooleanField(default=False) def __str__(self) -> str: return self.title class Images(models.Model): post = models.ForeignKey(Post, default=None, on_delete=models.CASCADE) images = models.ImageField(upload_to='blog_images/', default='blog_images/default.jpg') and of course, we have admin site settings. admin.py: from django.contrib import admin from .models import Post, Images class ImagesAdmin(admin.StackedInline): model = Images @admin.register(Post) class PostAdmin(admin.ModelAdmin): inlines = [ImagesAdmin] list_display = ('title',) admin.site.register(Images) at last, we have views! views.py: from django.shortcuts import render from blog.models import Post, Images def blog_single(request, **kwargs): posts = Post.objects.filter(status=1) if pid := kwargs.get('pid'): post = posts.get(id=pid) images = Images.objects.filter(post__id=post.id) context = {'post':post, 'images':images} return render(request, 'blog/blog-single.html', context) The problem is that I cannot find a way to … -
Wagtail error that 'wagtail.models.i18n.Locale' is not in installed apps
I'm attempting to upgrade from Wagtail 4.1 LTS to 5.0. I've paid attention to the documentation and the upgrade considerations, and changed all my import statements and models accordingly. I wasn't using any localization support other than anything enabled by default, for example, I didn't have WAGTAIL_I18N_ENABLED in my settings.py When I attempt to makemigrations I am getting the error that RuntimeError: Model class wagtail.models.i18n.Locale doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS. I am unsure how to resolve this as I am not using anything to do with localization, and I can't see anything relating to it in upgrade considerations. The error seems to be coming from files specific to wagtail base code and not any of my applications. What steps can I take to troubleshoot and resolve this?