Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
how do you do you migrate to database in test in docker?
i have a simple django app that i am changing to use docker the docker-compose is this version: "3.8" services: ab: build: context: . ports: - "8000:8000" volumes: - ./src:/src environment: - SECRET_KEY=${SECRET_KEY} - EMAIL_ADDRESS=${EMAIL_ADDRESS} - EMAIL_PASSWORD=${EMAIL_PASSWORD} - DB_NAME=askb_db - DB_HOST=db - DB_USER=${DB_USERNAME} - DB_PASSWORD=${DB_PASSWORD} command: > sh -c "python3 manage.py runserver 0.0.0.0:8000" depends_on: - db - migrations db: image: postgres:10-alpine environment: - POSTGRES_DB=askb_db - POSTGRES_USER=${DB_USERNAME} - POSTGRES_PASSWORD=${DB_PASSWORD} i want to run my tests but in order to do that i have to migrate my data to database before that. how should i do that? i have been thinking of adding a new service named migrations.is it the right way of doing that?if yes then my service is going to be like below : migrations: build: context: . volumes: - ./src:/src command: > sh -c "python3 manage.py migrate" depends_on: - db but as you can see its sort of a copy of ab and it does not work.what is the right way of doing that? -
IntegrityError at /accounts/register/ NOT NULL constraint failed: accounts_userbankaccount.gender
while preparing registration form i cannot save/register a user. it is not saved in admin panel.it shows the above error.kindly help me. VIEWS from django.contrib import messages from django.contrib.auth import get_user_model,logout from django.contrib.auth.views import LoginView from django.shortcuts import HttpResponseRedirect from django.urls import reverse_lazy from django.views.generic import TemplateView, RedirectView from .forms import UserRegistrationForm User = get_user_model() class UserRegistrationView(TemplateView): model = User form_class = UserRegistrationForm template_name = 'accounts/user_registration.html' def dispatch(self, request, *args, **kwargs): if self.request.user.is_authenticated: return HttpResponseRedirect( reverse_lazy('transactions:transaction_report') ) return super().dispatch(request,*args, **kwargs) def post(self, request, *args, **kwargs): registration_form = UserRegistrationForm(self.request.POST) if registration_form.is_valid(): user = registration_form.save() user.save() # login(self.request, user) messages.success( self.request, ( f'Thank You For Creating A Bank Account. ' f'Your Account Number is {user.account.account_no}. ' ) ) return HttpResponseRedirect( reverse_lazy('accounts:user_login') ) return self.render_to_response( self.get_context_data( registration_form=registration_form, ) ) def get_context_data(self, **kwargs): if 'registration_form' not in kwargs: kwargs['registration_form'] = UserRegistrationForm() return super().get_context_data(**kwargs) class UserLoginView(LoginView): template_name='accounts/user_login.html' redirect_authenticated_user = False class LogoutView(RedirectView): pattern_name = 'home' def get_redirect_url(self, *args, **kwargs): if self.request.user.is_authenticated: logout(self.request) return super().get_redirect_url(*args, **kwargs) MODELS from decimal import Decimal from django.contrib.auth.models import AbstractUser from django.core.validators import ( MinValueValidator, MaxValueValidator, ) from django.db import models from .managers import UserManager class User(AbstractUser): username = None email = models.EmailField(unique=True, null=False, blank=False) objects = UserManager() USERNAME_FIELD = 'email' … -
Google-auth authentication in django when the user abnormally close the browser?
I am performing Google-auth authentication but when the user abnormally close the browser, it results in freezes the application. flow = InstalledAppFlow.from_client_secrets_file( settings.GOOGLE_OAUTH2_CLIENT_SECRETS_JSON, self.SCOPES,redirect_uri='show_courses') creds = flow.run_local_server(port=0) HOW TO HANDLE THIS IF USER CLOSE THE BROWSER BEFORE COMPLETING AUTHENTICATION -
HTML block inputs until correct POST is send
I'm trying to make word-guesser Django app. User is given 5 rows of input boxes and every input box corresponds to specific word's letter. First, user has to guess first row etc. (Game Wordle is pretty similar). And the main thing is: I want to have only first row active, then after user hits the button, post request is send, blocking first row and unlocking second one etc. Any tips, please? Here's my html code: {% block content %} <a href="/words/get" style="margin-left: 48%">new word</a> <div class="boxes-row" style="text-align: center;"> {% for num in '12345' %} <form method="POST" autocomplete="off"> {% csrf_token %} <div class="d-flex justify-content-center align-items-center"> {% for index in word_length %} <div class="word-box"> <!-- Get row and column numbers with actual corresponding values from letters dict --> {% with input_name="row"|add:num|add:"_col"|add:index %} {% for key, value in letters.items %} {% if key == input_name %} <input type="text" class="letter-input authInput" autocomplete='off' name="{{ input_name }}" maxlength="1" value="{{ value.upper }}" oninput="jumpToNextInput(this)" /> {% endif %} {% endfor %} {% endwith %} </div> {% endfor %} <button type="submit" class="btn btn-success" style="margin-left: 1rem;">Save</button> </div> </form> {% endfor %} I tried various JS functions, but i'm not really into this language at the moment. -
Stop celery task from django admin panel
I'm trying to stop a Celery task from the Django admin panel. I have a model called TaskModel which includes a task_id, and I've created a custom action in TaskModelAdmin to stop tasks during their execution. Here's my TaskModel: class TaskModel(models.Model): task_id = models.CharField(max_length=50, blank=False) def stop(self): try: celery.control.revoke(self.task_id, terminate=True, signal='SIGKILL') return "Task stopped" except Exception as e: return "Error" And here's the relevant part of my TaskModelAdmin: class TaskModelAdmin(admin.ModelAdmin): @admin.action() def stop_tasks(modeladmin, request, queryset): for task in queryset.all(): task.stop() I've read in the Celery documentation that I can use the revoke method with the terminate=True flag to stop tasks, but it doesn't seem to work, and the tasks complete successfully. Can anyone help me understand why this approach is not working as expected and suggest a solution to stop Celery tasks from the Django admin panel? Thank you! -
How to drop email field in django-registartion?
I am using the third party app django-registration as my django project's registration system. I create the registration_form.htlm: <form method="post"> {% csrf_token %} <h1 class="h3 mb-3 fw-normal">Sign up</h1> <div class="form-floating"> <input class="form-control" id="floatingInput" placeholder="name" name="username" /> <label for="floatingInput">User</label> </div> <div class="form-floating"> <input class="form-control" placeholder="Email" name="email" /> <label for="floatingPassword">Email</label> </div> <div class="form-floating"> <input type="password" class="form-control" id="floatingPassword" placeholder="Password" name="password1" /> <label for="floatingPassword">Password</label> </div> <div class="form-floating"> <input type="password" class="form-control" id="floatingPassword" placeholder="Password" name="password2" /> <label for="floatingPassword">Password</label> </div> <div class="checkbox mb-3"> <label> <input type="checkbox" value="remember-me" /> Remember me </label> </div> <button class="w-100 btn btn-lg btn-primary" type="submit"> Sign Up </button> </form> And as you can see above, I have to specify the email or the form doesn't work. So is there any skill that to make the email completion optional, which means if a user doesn't provide email, the form can still be submitted successfully. -
how i can make multiple cart storing product as Cart(object) directly into session?
i am working on a point of sale, i want to add functionality for making multiple order at same time... for example i have added some products in cart meanwhile i want to open same view with empty cart to proceed new order and hold current cart with products added to cart, then later on i can use the hold cart class Cart(object): def init(self, request): self.session = request.session cart = self.session.get(settings.CART_SESSION_ID) if not cart: cart = self.session[settings.CART_SESSION_ID] = {} self.cart = cart def add(self, product, quantity, update_quantity): product_id = str(product.id) if product_id not in self.cart: self.cart[product_id] = {'quantity': 1.0, 'price': str(product.price), 'tax': str(product.tax)} else: self.cart[product_id]['quantity'] = str(float(self.cart[product_id]['quantity']) + quantity) self.save() def save(self): self.session[settings.CART_SESSION_ID] = self.cart self.session.modified = True pos_view.py class POSView(View): def get(self, request, cart_id=None): cart = Cart(request) for item in cart: item['update_quantity_form'] = {'quantity': item['quantity'], 'update': True} category =Category.objects.all() all_products = Product.objects.all() template_name = 'pos/pos.html' data = {'cart': cart, 'all_products' : all_products, 'category' : category} return render(request, template_name, data) def cart_add(request, id): cart = Cart(request) product = get_object_or_404(Product, id=id) cart.add(product=product, quantity=1.0, update_quantity=1.0) return redirect('pos_view') -
Django Rest Framework Many to Many field data from frontend
models.py class PostCategory(models.Model): name = models.CharField(max_length=200, unique=True) user = models.ForeignKey(User, on_delete=models.CASCADE) def __str__(self): return self.name class Post(models.Model): title = models.CharField(max_length=255) user = models.ForeignKey(User, on_delete=models.DO_NOTHING) content = models.TextField() post_categories = models.ManyToManyField(PostCategory, blank=True) def __str__(self): return self.title serializers.py class PostSerializer(serializers.ModelSerializer): user = serializers.PrimaryKeyRelatedField(read_only=True, default=serializers.CurrentUserDefault()) class Meta: model = Post exclude = [] def create(self, validated_data): # Retrieve the currently logged-in user user = self.context['request'].user # Add the author user to the validated data validated_data['user'] = user # Create and return the Post instance post = Post.objects.create(**validated_data) return post views.py class PostCreateView(APIView): def post(self, request): if request.user.is_authenticated: serializer = PostSerializer(data = request.data, context={'request': request}) if serializer.is_valid(): serializer.save() return Response(serializer.data, status=status.HTTP_201_CREATED) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) Passing Data via POST Method from Frontend FormData(3) { title → "Title 1", content → "Content 1", post_categories → "web framework,javascript"} Hi I am using Django REST Framework and trying to implement many to many relationship. I am sending data from frontend to drf backend Now The Error i am facing is post_categories [ "Incorrect type. Expected pk value, received str." ] Which is obvious I believe the error is correct but i dont know how to fix it. I also think once i fix this i will face another … -
How to configure django braces?
How to configure django braces in my django project after successfully installation? pip install django-braces I have installed successfully but don't know how to configure it in my settings.py file. Please help me out on this. -
name '<Class name>' is not defined error in django
I have started with learning django so while doing it i made a class in models.py named "Members" but when i am trying view/add data from python shell into it, it is giving me the following error: enter image description here heres the code: `from django.db import models class Members(models.Model): firstname = models.CharField(max_length=255) lastname = models.CharField(max_length=255) phone = models.IntegerField() joined_date = models.DateField()` `from django.db import models class Members(models.Model): firstname = models.CharField(max_length=255) lastname = models.CharField(max_length=255) phone = models.IntegerField() joined_date = models.DateField()` -
Why am i getting less points after reading the .png with OpenCV using imread?
I have wrapper.py which integrates C++ DLL to my python code. While integrating a C++ function that uses OpenCV, i am not getting desired output. The respective function in .DLL returns an object which is obtained as in after implementing imread. After reading the image in python code through the respective function of the DLL file, i getting an array of only 4 values and not all the values of the image which the array should represent. This is a function in .DLL file extern "C" __declspec(dllexport) cv::Mat ReadImage(const char* imagePath) { cv::Mat image; // Attempt to read the image image = cv::imread(imagePath); if (image.empty()) { // Handle the error: Log the error message std::cerr << "Error reading image: " << imagePath << std::endl; } return image; } This is a function which integrates the c++ output in wrapper.py def read_image(image_path): image_data = mydll.ReadImage(image_path.encode('utf-8')) print(type(image_data)) if not image_data: return None else: # Convert LP_c_ulong to a bytes object image_bytes = ctypes.string_at(image_data, ctypes.sizeof(ctypes.c_uint)) # Create a NumPy array from the bytes image_array = np.frombuffer(image_bytes, dtype=np.uint8) print('Image Array : \n', image_array.shape, image_array) image = cv2.imdecode(image_array, cv2.IMREAD_COLOR) print('Image : \n', image) return image_data This is how i am expecting it to work in … -
Django Queryset counting number of rows based on aggregated field condition
I have following model: class Purchase(models.Model): date = models.DateField() cost = models.IntegerField(null=False) ... I need to return amount of purchases for each day, with cost that exceeded its average cost of purchases for this day. i tried using: Purchase.objects.values('date').annotate( avg_cost=Avg('cost', output_field=FloatField() ).annotate( purchases_above=Sum(Case(When(cost__gt=F('avg_cost'), then=1), default=0, output_field=IntegerField())) ) but i get error django.core.exceptions.FieldError: Cannot compute Count('<Case: CASE WHEN <Q: (AND: ('cost__gt', F(avg_cost)))> THEN Value(1), ELSE Value(0)>'): '<Case: CASE WHEN <Q: (AND: ('cost__gt', F(avg_cost)))> THEN Value(1), ELSE Value(0)>' is an aggregate I am doing something wrong? Is this even possible? -
How to Version API requests at the Query Level?
I have set up a Django application with a DRF API and Namespace versioning. Already several services are consuming data from my API. Now I have a table like this: class Province(models.Model): id = models.BigAutoField(primary_key=True) name = models.CharField() country = models.ForeignKey() I need to update the country field name to: countryId = models.ForeignKey() I don't want to break the queries of the existing consumers so I implemented logic I thought would allow me to maintain different versions of the API. class ProvinceViewset(viewsets.ReadOnlyModelViewSet) def get_serializer_class(self): if self.request.version == 'v1': return ProvinceSerializerV1 else: return ProvinceSerializerV2 return super().get_serializer_class() class ProvinceSerializerV1(serializers.ModelSerializer): country = serializers.PrimaryKeyRelatedField(source='countryId',read_only=True) class Meta: model = Province exclude = ['countryId'] class ProvinceSerializerV2(serializers.ModelSerializer): class Meta: model = Province fields = '__all__' If my API is queried, this effects the fields that are returned, but it has no impact on the queries required by the API For example: localhost:8000/api/v1/provinces?country=1 Does not work, and the required url to filter by country is still the new format: localhost:8000/api/v1/provinces?countryId=1 { "id": 1, "name": "AB", "country": "CA", } Is there a correct way to version the API such that the expected query parameters are not just the latest fields in the model? -
django ckeditor 5 multi-line toolbar
I'm trying to use django-ckeditor-5 and it works fine, but when I try to make a multiline toolbar and add "-" to the toolbar config nothing happens. here is my config: https://pastebin.com/G52EgEVt As you saw in my config, I did put a "-" before bulleted list, but nothing changes: Here is my models.py: class Post(models.Model): title = models.CharField(max_length=120, null=False, blank=False, verbose_name='عنوان') body = CKEditor5Field(config_name='extends', verbose_name='بدنه') -
Django and React version error issues when using materials library
So i'm following a video on youtube that shows how to make a music controller using django and react. While installing the different packages for react I ran into this issue: log file for the error the exact command that is throwing the error is this: npm install @material-ui/core I tried the solutions given here, but nothing worked for me. can someone point me in the right direction? -
Save form data in Django on each http request
I’m new to web programming and Python. I’m having a Django app with multiple questions, each of which has a form (a text field) placed on a separate page. On top there’s a ribbon with buttons - one for every single question, as well as “save and go to next question” button. The problem: form data is lost when other than “save and go next” button is used. I don’t want to lose form data, I want to save on each page change. What I did: I’m about to finish my prototype where I did a small url scheme change: Before: UID/question_ID_to_be_opened After: UID/question_ID_to_be_opened/previous_question_ID The modified view function shall handle the save of “previous_question_ID”, but this don’t look quite elegant. Shall I use signals, or redirects, or something else? There is an autosave script too, it is based on a timer - perhaps I can trigger it manually? Best regards, Ivan -
Python Django - images not showing in templates
My images won't show up in my templates, but it does display a little 'frame' where the image should be displayed. I've tried several things but won't work. I have the exact same settings in my other project and it works fine there. This is what I'm seeing: result on localhost:8000 My settings.py: from pathlib import Path import os import mimetypes BASE_DIR = Path(__file__).resolve().parent.parent SECRET_KEY = 'django-insecure-xxxx' DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'cvapp', ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'collabcenter.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': ['templates'], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'collabcenter.wsgi.application' # Database # https://docs.djangoproject.com/en/4.1/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': BASE_DIR / 'db.sqlite3', } } # Password validation # https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization # https://docs.djangoproject.com/en/4.1/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/4.1/howto/static-files/ STATIC_URL = '/static/' STATIC_ROOT= os.path.join(BASE_DIR, 'static') STATICFILES_DIR = … -
Django project. creat new file
when typing in the command line:>django startproject myfirstproject, Gives this error: "Django" is not inside or outside command, executable program, or batch file. how to fix or what can i do? I wanted to create a Django project but it didn't work for me -
Running a .jrxml file using django .Error fill report: Erro fill internal: java.lang.NullPointerException
I am trying to run a .jrxml file to turn it into a .pdf file using a django app that is connected to the database, I keep getting this error: Running a .jrxml file using django .Error fill report: Erro fill internal: java.lang.NullPointerException from pyreportjasper import PyReportJasper from platform import python_version def advanced_example_using_database(): try: input_file = 'C:/Users/m.mostafa/Desktop/loan_data.jrxml' output_file = 'output.pdf' pyreportj=PyReportJasper() con={ 'driver': 'oracle.jdbc.driver.OracleDriver', 'username': 'xxxx', 'password': 'xxxx', 'database':'PREE', } pyreportj.config( input_file, output_file, db_connection=con, output_formats=["pdf", "rtf"], parameters={'python_version': python_version()}, ) pyreportj.process_report() except Exception as e: print(e) -
How to redirect old url to new url while migrating to new site in react and django?
I have an old website and new website built with React and django. I'm in the process of migrating from the old site to the new one and need to implement SEO-friendly URL redirects. There are more that 500 old url that needs to be redirected to new ones. I came to know about redirect apps in django (https://docs.djangoproject.com/en/4.1/ref/contrib/redirects/) but dont get how to achieve it on the frontend. I'm not sure how to properly set up SEO-friendly URL redirects from my old url to the new ones while preserving SEO attributes. If I add all those urls in react and call an API to find where i have to redirect will it affect seo? or is there any better way to do this? -
Issue with Rendering Checkboxes and Labels in Django Template
I'm facing issues in my Django template while trying to create checkboxes for food options. I created a form titled cuisine_choices, and I am able to successfully loop through the selection of food from my template, but its not allowing me to properly display it. When I use the following code: {% for food in cuisine.choices %} <input type="checkbox" name="food">{{ food }} {% endfor %} I encounter an unexpected behavior where I get the correct amount of checkboxes but with no label attached to it. However, when I write the code like this: {% for food in cuisine.choices %} <input type="checkbox" name={{ food }}> {% endfor %} I get the properly labeled checkboxes, except each label ends in ">. For example: Mexican"> Chinese"> Italian"> Indian"> Japanese"> French"> Thai"> Mediterranean"> American"> While trying to figure out what was wrong I tried the following code: {% for food in cuisine.choices %} <input type="checkbox" name="Food">Test {% endfor %} And I got the correct amount of checkboxes, each labeled as "Test". Can someone please explain why this is happening and how I can correctly render checkboxes with their labels in my template? -
Django istartswith performance
I have a model with column "name" and I am running query with istartswith and I am using postgresql. I have added django.db.models.Index with Postgresql opclass Index(fields=('name',), name="partial_name_pat_idx", opclasses=("varchar_pattern_ops",), condition=Q(published=True)) But I can't figure out how do make I make use of index for case insensitive search, I have tried with django model function Upper('name') but it is not supported in fields argument. If I pass Upper(F('name')) in expressions django is restricting me to use opclasses=("varchar_pattern_ops",). Is there any way I can create index for queries with LIKE operator and UPPER function on field name? -
Page not found (404) No Product matches the given query
Page not found (404) “C:\Users\TOSHIBA\Desktop\Miniproject\cake_studio\add_to_cart\1” does not exist Request Method: GET Request URL: http://127.0.0.1:8000/add_to_cart/1 Raised by: django.views.static.serve trying to add product in to the cart, getting this error and not get correct data for my website -
Django Restrict the Parent Foreign key to be set as Itself
I am new to Django, I am trying to create a project where a WBS can have other WBS as their parent. My Problem is that when I open the form for edit, I want to simply not display the self in the WBS drop-down so that it can't be set as self parent to avoid strange recursive relationship. def validate_not_self(value): if value and value == value.parent_wbs: raise ValidationError("A WBS cannot be its own parent.") class WBS(models.Model): name = models.CharField(max_length=100) project = models.ForeignKey(Project, on_delete=models.CASCADE) num = models.IntegerField(default=0) parent_wbs = models.ForeignKey('self', on_delete=models.CASCADE, null=True, blank=True, related_name='child_wbs', validators=[validate_not_self]) created_on = models.DateTimeField(auto_now_add=True) created_by = models.IntegerField(blank=True, default=0) modified_on = models.DateTimeField(auto_now=True) # This field will be automatically updated on each save modified_by = models.IntegerField(blank=True, default=0) # You can specify your own logic for updating this field def __str__(self): return self.name -
Urgent !! Django web server has a sqlite3 problem and can't run! Help~~
Web server is Django4.2.1 with nginx1.18.0. The original Ubuntu20.4 venv(python3.8.10,gcc 9.4.0) directory inside web directory PycharmProjects/WebProjects. It may be due to the installation of python 3.11 in other environments. I do not know why the venv of Python3.8 is affected. An error occurred while running python3 manage.py runserver XXXX: `(venv) dave@dave-X299-WU8:~/PycharmProjects/WebProject$ python3 manage.py runserver Watching for file changes with StatReloader Performing system checks... Exception in thread django-main-thread: Traceback (most recent call last): File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner self.run() File "/usr/lib/python3.8/threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "/home/dave/PycharmProjects/WebProject/venv/lib/python3.8/site-packages/django/utils /autoreload.py", line 64, in wrapper fn(*args, **kwargs) File "/home/dave/PycharmProjects/WebProject/venv/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 133, in inner_run self.check(display_num_errors=True) File "/home/dave/PycharmProjects/WebProject/venv/lib/python3.8/site-packages/django/core/management/base.py", line 485, in check all_issues = checks.run_checks( File "/home/dave/PycharmProjects/WebProject/venv/lib/python3.8/site-packages/django/core/checks/registry.py", line 88, in run_checks new_errors = check(app_configs=app_configs, databases=databases) File "/home/dave/PycharmProjects/WebProject/venv/lib/python3.8/site-packages/django/core/checks/urls.py", line 14, in check_url_config return check_resolver(resolver) File "/home/dave/PycharmProjects/WebProject/venv/lib/python3.8/site-packages/django/core/checks/urls.py", line 24, in check_resolver return check_method() File "/home/dave/PycharmProjects/WebProject/venv/lib/python3.8/site-packages/django/urls/resolvers.py", line 494, in check for pattern in self.url_patterns: File "/home/dave/PycharmProjects/WebProject/venv/lib/python3.8/site-packages/django/utils/functional.py", line 57, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/home/dave/PycharmProjects/WebProject/venv/lib/python3.8/site-packages/django/urls/resolvers.py", line 715, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "/home/dave/PycharmProjects/WebProject/venv/lib/python3.8/site-packages/django/utils/functional.py", line 57, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/home/dave/PycharmProjects/WebProject/venv/lib/python3.8/site-packages/django/urls/resolvers.py", line 708, in urlconf_module return import_module(self.urlconf_name) File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File …