Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How to send email with pdf attachment using python Django?
I want to send an email with an invoice to the user after the payment process. How can I do it with Django. I tried a few codes but it is not working. -
How to automatically do calcuations using Javascript in django templates?
I have models: class Payments(models.Model): paymentid = models.IntegerField(primary_key=True) bookingid = models.ForeignKey('Roombookings', models.DO_NOTHING, db_column='bookingid') paymenttype = models.CharField(max_length=255) paymentamount = models.IntegerField(blank=True, null=True) class Meta: managed = False db_table = 'payments' class Roombookings(models.Model): bookingid = models.IntegerField(primary_key=True) customername = models.CharField(max_length=500, blank=True, null=True) customeraddress = models.CharField(max_length=550, blank=True, null=True) bookingfrom = models.DateField(blank=True, null=True) bookingto = models.DateField(blank=True, null=True) assignroomid = models.ForeignKey('Rooms', models.DO_NOTHING, db_column='assignroomid', blank=True, null=True) noofguests = models.IntegerField(blank=True, null=True) class Meta: managed = False db_table = 'roombookings' class Rooms(models.Model): roomid = models.IntegerField(primary_key=True) roomnumber = models.IntegerField() roomprice = models.IntegerField() roomtype = models.CharField(max_length=255) roomcapacity = models.IntegerField() class Meta: managed = False db_table = 'rooms' I want an automatic calculation of paymentamount when a bookingid is entered which works under the formula of 'bookingto-bookingfrom' date * roomprice from another table My django views function: def payments(request): if request.method == 'POST': form = PaymentsForm(request.POST) if form.is_valid(): form.save() return redirect('/payments done/') return render(request,'files/payments.html',{'form': PaymentsForm()} In templates, I'm just using: <form action="" method="POST" > {% csrf_token %} {{form.as_p}} <input type = "submit" value ="Submit"> </form> In the templates section, In the javascript part, I want to autofill the payment amount by doing some calculation. -
why is "no results to fetch" Django error when DB record created
code: print('fork 1:'+str(self.mySessionID)) print('fork 2:'+str(myTimeStarted)) print('fork 3:'+str(self.__uid)) print('fork 4:'+str(why_started)) try: MySessions.objects.create( session_id=self.mySessionID, when_started=myTimeStarted, who_started=self.__uid, why_started=str(why_started) ) except Exception as Sht: print("! "+str(Sht)) # ! no results to fetch reply: fork 1:59092 fork 2:2022-04-23 16:44:59.656620+03:00 fork 3:870806915 fork 4:WAITING FOR ::: vLVlhYyZvIM ! no results to fetch (DB record had been created Ok though;) the problem is, if I do NOT put it all in try-except, the script stops; and I do not want to put all of those db-record-creation blocks inside of try-except, that be stupid I think.) the question is WHY is this error being thrown? -
Django crispy-forms bug: Multiple Image input doesn't show different file names
I have a crispy form with an image input field that accepts multiple images: images = forms.ImageField(widget=forms.FileInput(attrs={'class': 'form-control', 'multiple': True}), required=False) The form works perfectly fine and the images are uploaded and can be processed in the backend. However, there is a weird frontend bug: Usually when you select multiple images for upload on a crispy image field, it shows all the file names of the selected images as a list in that widget. However, in my case it just shows the name of one of the files, multiple times (to be precise: for every file selected it shows the name of one of the files once). For example, if I select three files with different names, one of which is called 'kangaroo.png', the widget looks like this: Now I've pinned down the problem to this little snippet: <div class="custom-file "> <input type="file" name="images" class="form-control fileinput fileUpload form-control-file custom-file-input" multiple accept="image/*" id="id_images"> <label class="custom-file-label" for="id_images">Choose file</label> <script type="text/javascript" id="script-id_images"> document.getElementById("script-id_images").parentNode.querySelector('.custom-file-input').onchange = function (e){ var filenames = ""; for (let i=0;i<e.target.files.length;i++){ filenames+=(i>0?", ":"")+e.target.files[0].name; } e.target.parentNode.querySelector('.custom-file-label').innerHTML=filenames; } </script> </div> The problem lies in the line that reads: filenames+=(i>0?", ":"")+e.target.files[0].name;. It should clearly be: filenames+=(i>0?", ":"")+e.target.files[i].name;. And sure enough, when I looked into … -
UserCreationForm doesn't save the password commit=False (No password set)
I create a registration form on HTML ajax pull the data and send it to UserCreationForm via a function in views.py. But when I check the user I realized the password is not saved. I am using ajax so I took the data per field. And in the view function, I had to add the field values one by one. I used set_password but didn't help. Any help will very appreciated thank you My Form: class RegisterForm(UserCreationForm): username = forms.CharField(max_length=100 , widget=forms.TextInput( attrs={'class': "form-control"})) email = forms.EmailField(max_length=100, widget=forms.EmailInput()) password1 = forms.CharField(widget=forms.PasswordInput( attrs={'class': "form-control"})) password2 = forms.CharField(widget=forms.PasswordInput( attrs={'class': "form-control"})) email.widget.attrs.update({'class': 'form-control'}) class Meta: model = User fields = ['username', 'email', 'password1', 'password2'] def save(self, commit=True): user = super(UserCreationForm, self).save(commit=False) user.email = self.cleaned_data['email'] user.set_password(self.cleaned_data['password1']) if commit: user.save() return user My View: def home(request): register_form = RegisterForm() workshop_form = WorkshopCreateForm if request.method == 'POST': register_form = RegisterForm(request.POST) username = request.POST.get('username') print(username) email = request.POST.get('email') password1 = request.POST.get('pass1') password2 = request.POST.get('pass2') if register_form.is_valid(): pended_form = register_form.instance pended_form.username = username pended_form.email = email if password1 == password2: pended_form.set_password(password1) pended_form.save() ctx = { 'username': pended_form.username, 'password': pended_form.password, 'created': True, 'success': True, 'status':'You created your account', } return JsonResponse(ctx) else: ctx = { 'username': '', 'password': '', … -
How to test Django view that have a request to API?
I Have a view post that gets post by its id. In the test, I would like to create a new post and then check via API, if the post is available. The problem that I have is that post is being added to the test database but when executing the GET request it makes a request to the development database. views.py def post(request: HttpRequest, id: str): context = {"form": PostForm} url = env("BASE_URL") if id: post = requests.get(f"{url}/api/v1/post/{id}").json() context["post"] = post return render(request, "post.html", context) test_view.py class BlogPageTest(TestCase): @classmethod def setUpTestData(cls): cls.user = UserProfile.objects.create( name="TestUser", email="test@mail.com", password="pass" ) def test_post_render(self): client = APIClient() client.force_authenticate(user=self.user) post = Post.objects.create( title="Test post", body="Test post data", user=self.user, ) post.save() response = client.get(reverse("post", kwargs={"id": str(post.id)})) -
Django monkey patching model with method seems to work correctly as instance method - am I missing something?
I am using Django 3.2 and I am having to monkey patch a model, based on some conditional logic. myapp/models.py class Foo(models.Model): # fields ... # methods ... pass in console from myapp.models import Foo def something(obj): return obj.id # Monkey patching the class (model) setattr(Foo, 'mysomething', something) # Fetch an instance form db f = Foo.objects.all().first() f.mysomething() # return 1 (correct) My surprise is the fact that the something method is not accepting an argument, and instead, seems to be using the argument specified in the definition (obj) as a synonym for self - and therefore, the method is acting like an instance method. Can anyone explain the technical reason why this is happening - and is this documented (and therefore consistent) behaviour I can rely on in my code? -
Django: NOT NULL constraint failed: course_courserating.user_id
i am trying to create a logic where users can review and rate a course, the logic in my views.py looks fine but i keep gettting this errror NOT NULL constraint failed: course_courserating.user_id i removed some null=True from my models but it still keeps showing the error. views.py if request.method == "POST": form = CourseRatingForm(request.POST) if form.is_valid(): rating_form = form.save(commit=False) user = request.user course = course rating_form.save() messages.success(request, f'You review was sent successfully!') return redirect("course:course-detail", course.slug) else: form = CourseRatingForm models.py class Course(models.Model): course_title = models.CharField(max_length=10000) slug = models.SlugField(unique=True) class CourseRating(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) course = models.ForeignKey(Course, on_delete=models.CASCADE, null=True) rating = models.CharField(max_length=1000, choices=USER_COURSE_RATING) review = models.TextField() date = models.DateTimeField(auto_now_add=True) active = models.BooleanField(default=False) def __str__(self): return f"{self.course.course_title} - {self.rating}" -
Deploying 'Django for beginners' app to Heroku fails with ModuleNotFoundError: No module named '_tkinter'
I am following William Vincents Django for Beginners, and I'm about to push the blog app to Heroku at the end of chapter 8. I have checked the code several times, and everything is just as in the book, but it fails every time with ModuleNotFoundError: No module named '_tkinter'. Here is the log from Heroku: -----> Building on the Heroku-20 stack -----> Determining which buildpack to use for this app -----> Python app detected -----> Using Python version specified in runtime.txt ! Python has released a security update! Please consider upgrading to python-3.10.4 Learn More: https://devcenter.heroku.com/articles/python-runtimes -----> Installing python-3.10.3 -----> Installing pip 22.0.4, setuptools 60.10.0 and wheel 0.37.1 -----> Installing SQLite3 -----> Installing requirements with pip Collecting asgiref==3.5.0 Downloading asgiref-3.5.0-py3-none-any.whl (22 kB) Collecting Django==4.0.4 Downloading Django-4.0.4-py3-none-any.whl (8.0 MB) Collecting gunicorn==20.1.0 Downloading gunicorn-20.1.0-py3-none-any.whl (79 kB) Collecting sqlparse==0.4.2 Downloading sqlparse-0.4.2-py3-none-any.whl (42 kB) Collecting tzdata==2022.1 Downloading tzdata-2022.1-py2.py3-none-any.whl (339 kB) Collecting whitenoise==5.3.0 Downloading whitenoise-5.3.0-py2.py3-none-any.whl (19 kB) Installing collected packages: whitenoise, tzdata, sqlparse, gunicorn, asgiref, Django Successfully installed Django-4.0.4 asgiref-3.5.0 gunicorn-20.1.0 sqlparse-0.4.2 tzdata-2022.1 whitenoise-5.3.0 -----> $ python manage.py collectstatic --noinput Traceback (most recent call last): File "/tmp/build_8fe73f22/manage.py", line 22, in <module> main() File "/tmp/build_8fe73f22/manage.py", line 18, in main execute_from_command_line(sys.argv) File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/__init__.py", line 446, in … -
Django models: dynamic inheritance from classes defined in standalone app
I am using Django 3.2 I have written a standalone app social that has models defined like this: from abc import abstractmethod class ActionableModel: # This MUST be implemented by ALL CONCRETE sub classes @abstractmethod def get_actionable_object(self): pass # This MUST be implemented by ALL CONCRETE sub classes @abstractmethod def get_owner(self): pass def get_content_info(self): actionable_object = self.get_actionable_object() ct = ContentType.objects.get_for_model(actionable_object) object_id = actionable_object.id return (ct, object_id) # ... class Likeable(models.Model, ActionableModel): likes = GenericRelation(Like) likes_count = models.PositiveIntegerField(default=0, db_index=True) last_liked = models.DateTimeField(editable=False, blank=True, null=True, default=None) # ... in my project (that uses the standalone app), I have the following code: myproject/userprofile/apps.py class UserprofileConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' name = 'userprofile' verbose_name = _('User Profile') def ready(self): # Check if social app is installed from django.apps import apps if apps.is_installed("social"): # check some condition # inherit from social.Likeable # ... ? How can I dynamically get my model userprofile.models.UserAccount to derive from Likeable? -
using for loop in django channels async consumer
I'm using AsyncConsumer for my app and at some point I realized I need to use a for loop to iterate through a queryset but I'm facing asynchronous issues. My code looks something like this: class ChatConsumer(AsyncConsumer): ... async def websocket_receive(self, event): .... chatgroup = await self.get_chatgroup(self.group_id) for member in chatgroup.member_chatgroup.all(): await self.new_notification() ... async def new_notification(self, member, message): await self.channel_layer.group_send( self.notification_group_name, { "type": "notify.message", "message": message, } ) Now I know that's totally incorrect, but the thing is I don't know what is correct, and I didn't find any answer on the internet. So I'd appreciate any useful help. -
How to Disable Preselection List Display from Django Admin
Hi I want to disable the preselection from django admin, here is my code from django.contrib import admin from django.db import models class Person(models.Model): name = models.CharField(max_length=50) birthday = models.DateField() def decade_born_in(self): return self.birthday.strftime('%Y')[:3] + "0's" decade_born_in.short_description = 'Birth decade' class PersonAdmin(admin.ModelAdmin): list_display = ('name', 'decade_born_in') -
How to convert python list to JSON array?
If I have python list like pyList=[‘x@x.x’,’y@y.y’] And I want it to convert it to json array and add {} around every object, it should be like that : arrayJson=[{“email”:”x@x.x”},{“ email”:”y@y.y”}] any idea how to do that ? -
Django - How I get a value from form and send it using a button?
I would like to get value from SKU field to GET request using button "Buscar medidas", that will call a function "fretemagalu" in my views.py (replacing test with SKU value) <p> <label for="sku"><b>SKU</b></label><br> <input id="sku" type="text" name="sku" value="{{ sku }}"> <button class="btn btn-primary ml-2" type="button" onclick="location.href='{% url 'fretemagalu' 'test' %}'">Buscar medidas</button> </p> The example from the form is in image bellow. Thanks in advanced. Form -
Nginx 502 bad getaway in Django register and login page
I've deployed a Django app with nginx and gunicorn. It's works fine except it's login form and register form. When I submit either of forms I get "502 bad get away" error message. /etc/nginx/sites-available/config server { listen 80; server_name croyal.net; server_name www.croyal.net; location = /favicon.ico { access_log off; log_not_found off; } location /static/ { root /var/www; } location / { include proxy_params; proxy_pass http://unix:/run/gunicorn.sock; } } -
AttributeError: 'google.protobuf.pyext._message.RepeatedCompositeCo' object has no attribute 'append' When running django gunicorn server
I have developed a road segmentation model with django. It works fine on development server. I am testing the application with gunicorn server. The application loads a tensorflow based Unet model from .h5 file. The model gets loaded successfully on development server. But not on gunicorn. System check identified no issues (0 silenced). April 23, 2022 - 10:23:03 Django version 4.0.4, using settings 'segmentation_site.settings' Starting development server at http://127.0.0.1:8000/ Quit the server with CONTROL-C. Works perfectly on development server. But not on production gunicorn --bind 127.0.0.1:8000 segmentation_site.wsgi.application [2022-04-23 03:24:15 -0700] [8192] [INFO] Starting gunicorn 20.0.4 [2022-04-23 03:24:15 -0700] [8192] [INFO] Listening at: http://127.0.0.1:8000 (8192) [2022-04-23 03:24:15 -0700] [8192] [INFO] Using worker: sync [2022-04-23 03:24:15 -0700] [8194] [INFO] Booting worker with pid: 8194 2022-04-23 10:24:16.356150: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory 2022-04-23 10:24:16.356246: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine. tensorflow imported. 2022-04-23 10:24:19.782405: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory 2022-04-23 10:24:19.782526: W tensorflow/stream_executor/cuda/cuda_driver.cc:269] failed call to cuInit: UNKNOWN ERROR (303) 2022-04-23 … -
How to map the login template with built-in login form in Django?
I am quite new to Django and I am trying to create login template. I avoid using crispy-forms to have more control and knowledge on how the data is displayed on website. I am using Django built-in login form. Unfortunately I am stuck, because my current login.html seems to be invalid and nothing happens after sending POST with username and password. This is how it looks like: login.html <main class="form-signin"> <form method="post" class="from-group"> <h1 class="display-3 text-center mb-4 fw-normal" style="font-family:'Faster One'; box-shadow: none;">Test</h1> <h1 class="h3 mb-3 fw-normal">Please sign in</h1> {% csrf_token %} <div class="form-floating"> <input type="text" class="form-control" id="floatingInput" placeholder="name@example.com"> <label for="floatingInput">Username</label> </div> <div class="form-floating mt-3"> <input type="password" class="form-control" id="floatingPassword" placeholder="Password"> <label for="floatingPassword">Password</label> </div> <button class="w-100 btn btn-lg btn-primary" type="submit" value="Log in">Sign in</button> </form> </main> urls.py urlpatterns = [ path('admin/', admin.site.urls), path('', views.home, name='home'), path('accounts/', include("django.contrib.auth.urls")), ] [23/Apr/2022 09:59:41] "POST /accounts/login/ HTTP/1.1" 200 2358 [23/Apr/2022 09:59:46] "POST /accounts/login/ HTTP/1.1" 200 2358 POST is sent with 200 OK message, but besides that nothing happens - I am still in the login page, user is not authenticated, validation doesn't work etc. So my question is what I did wrong and how does the mapping between login form/view and html template works exactly? -
'str' object has no attribute 'all',
I want to get last data choiced by the user of a field1(a foreignkey type) from a form1(model1) already submitted and display it on a another field2(Exist on form2(model2)), Here is my models.py: Model1: field1 = models.ForeignKey(ProfileSize, on_delete=models.CASCADE) Model2: field2 = models.ForeignKey(ProfileSize, on_delete=models.CASCADE) The story that I have declared a field2 as a foreignkey in model2 and I have did ModelChoiceField in forms.py To display to me just the last data entered by the user in the field1(exist in the form1) , Here is my forms.py: class FormAssembly(forms.ModelForm): field1 = forms.ModelChoiceField(queryset=Model1.objects.none(),) I have did it with this queryset in views.py def assembly(request): if request.method == 'POST': form = FormAssembly(request.POST, ) form.fields['field2'].queryset = Model1.objects.filter(user=request.user).last().field1.name it shows me error 'str' object has no attribute 'all', My Question how i can filter correctly the foreignkey to get data from another form using the queryset, -
Django no reverse match on heroku but not locally
I am getting NoReverseMatch at /post/1/ Reverse for 'blog_home' not found. 'blog_home' is not a valid view function or pattern name. this error on my django website hosted on heroku, but the code works fine when I host the website locally. I think that it has something to do with heroku. My urls.py urlpatterns = [ path('', PostListView.as_view(), name='blog-home'), path('post/<int:pk>/', PostDetailView.as_view(), name='post-detail') ] Error: Environment: Request Method: GET Request URL: http://<appname>.herokuapp.com/post/1/ Django Version: 2.2.1 Python Version: 3.9.0 Template error: In template /app/django_web_app/blog/templates/blog/base.html, error at line 0 Reverse for 'blog_home' not found. 'blog_home' is not a valid view function or pattern name. 1 : {% load staticfiles %} 2 : <!doctype html> 3 : <html lang="en"> 4 : <head> 5 : 6 : <!-- Required meta tags --> 7 : <meta charset="utf-8"> 8 : <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> 9 : 10 : Exception Type: NoReverseMatch at /post/1/ Exception Value: Reverse for 'blog_home' not found. 'blog_home' is not a valid view function or pattern name. Python version: 3.9 Django version: 2.2.1 -
Many to Many relationship between different types of users - Django
I am building a toy project consisting in a healthcare information system. I want to have two types of users: patients and doctors. A patient could have multiple doctors and a doctor could have multiple patients. What is the best way to represent this relationship? Currently I have something similar to this: class User(AbstractUser): def serialize(self): return { "id": self.id, "username": self.username, } class Doctor(models.Model): user = models.ForeignKey(User, on_delete=models.SET(get_sentinel_user)) patients = models.ManyToManyField(Patient) class Patient(models.Model): user = models.ForeignKey(User, on_delete=models.SET(get_sentinel_user)) doctors = models.ManyToManyField(Doctor) However I'm pretty sure this doesn't work. What is the right way to represent this type of relationship using django models? Thanks! -
Invalid field name(s) given in select_related: 'images'. Choices are: user_changed, video, prices, attributes, apiconnections
models.py: class ProductModel(models.Model): name = models.CharField(max_length=150, unique=True) type = models.CharField(max_length=100, blank=True) sku = models.CharField(max_length=100, unique=True) barcode = models.CharField(max_length=50, unique=True) description = models.TextField(blank=True) categories = models.ManyToManyField(CategoryModel, blank=True) video_url = models.CharField(max_length=190, blank=True) datetime_created = models.DateTimeField(auto_now_add=True) datetime_updated = models.DateTimeField(auto_now=True) user_changed = models.ForeignKey(User, on_delete=models.SET_NULL, null=True, blank=True) old_id = models.CharField(max_length=50, unique=True, blank=True, null=True, default="") def __str__(self): return self.name class Images(models.Model): product_id = models.ForeignKey(ProductModel, db_index=True, on_delete=models.CASCADE, verbose_name='Товар') image = models.ImageField(upload_to="products/images/", blank=True, default="products/noimage.jpeg") image_small = models.ImageField(upload_to="products/images_small/", blank=True, default="products/noimage.jpeg") image_ori = models.ImageField(upload_to="products/images_ori/", blank=True, default="products/noimage.jpeg") default = models.BooleanField(default=False) def __str__(self): return self.product_id.name class Video(models.Model): product_id = models.OneToOneField(ProductModel, db_index=True, on_delete=models.CASCADE) video = models.FileField(upload_to="products/videos/", blank=True) def __str__(self): return self.product_id.name in views.py this code works perfectly: products = ProductModel.objects.all().select_related('prices', 'apiconnections', 'video').prefetch_related('categories') while this one gives me error Invalid field name(s) given in select_related: 'images'. Choices are: user_changed, video, prices, attributes, apiconnections: products2 = ProductModel.objects.all().select_related('images') I've also tried to use prefetch_related to connect all my images to products. It didn't work. -
Remove default preselction from Django admin
Heyy guys, In my djan admin all the filter are getting pre selected by default and i do not want to do that ,can any one please help me . I do not want see all the filter getting preselcted . -
display user information with their corresponding profile picture in a table
I want to display user information from Django default User model in the table with their profile picture my Profile model is `class Profile(models.Model): user = models.OneToOneField(User, null=True, blank=True, on_delete=models.CASCADE) forget_password_token = models.CharField(max_length=100) image = models.ImageField(upload_to="images",default="default/user.png") def str(self): return f'{self.user} profile' ` I want to do like this user data in the profile column i want to display user profile picture please help me to achieve this -
How to place multiple values in another column by selecting one option?
I want to Select one option and auto-fill up the other column. For example: | Product Name| Price | | ----------- | --------- | | T-Shirt | 100 | | Mobile | 200 | | Laptop | 500 | Now, i will select Product Name and price will place automatically. To be clear please check the image! and Video -
I get this error when i try use django allauth
Traceback (most recent call last): File "manage.py", line 21, in <module> main() File "manage.py", line 17, in main execute_from_command_line(sys.argv) File "/usr/local/lib/python3.8/dist-packages/django/core/management/__init__.py", line 446, in execute_from_command_line utility.execute() File "/usr/local/lib/python3.8/dist-packages/django/core/management/__init__.py", line 440, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python3.8/dist-packages/django/core/management/base.py", line 414, in run_from_argv self.execute(*args, **cmd_options) File "/usr/local/lib/python3.8/dist-packages/django/core/management/base.py", line 455, in execute self.check() File "/usr/local/lib/python3.8/dist-packages/django/core/management/base.py", line 487, in check all_issues = checks.run_checks( File "/usr/local/lib/python3.8/dist-packages/django/core/checks/registry.py", line 88, in run_checks new_errors = check(app_configs=app_configs, databases=databases) File "/usr/local/lib/python3.8/dist-packages/django/core/checks/urls.py", line 42, in check_url_namespaces_unique all_namespaces = _load_all_namespaces(resolver) File "/usr/local/lib/python3.8/dist-packages/django/core/checks/urls.py", line 61, in _load_all_namespaces url_patterns = getattr(resolver, "url_patterns", []) File "/usr/local/lib/python3.8/dist-packages/django/utils/functional.py", line 49, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/usr/local/lib/python3.8/dist-packages/django/urls/resolvers.py", line 696, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "/usr/local/lib/python3.8/dist-packages/django/utils/functional.py", line 49, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/usr/local/lib/python3.8/dist-packages/django/urls/resolvers.py", line 689, 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 "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 671, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 848, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/home/platon/python/django/itmagazine/itmagazine/urls.py", line 27, in <module> path('accounts/', include('allauth.urls')) File "/usr/local/lib/python3.8/dist-packages/django/urls/conf.py", line 38, in include urlconf_module = import_module(urlconf_module) File "/usr/lib/python3.8/importlib/__init__.py", line …