Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Rest Framework - How to apply field-level permissions after create/update?
I have implemented field-level permissions by overriding get_fields() as follows: def get_fields(self): viewable_fields = {} fields = super().get_fields() request = self.context.get('request', None) model = self.Meta.model model_name = model._meta.model_name try: user = request.user except AttributeError: return viewable_fields for field_name in fields: if user.has_perm('view_' + model_name + '_' + field_name): viewable_fields[field_name] = fields[field_name] return viewable_fields That works fine for list and detail views, but when I tried to apply that mixin to create/update views, the nested fields were empty. I have removed it from create/update views, but then I get all fields returned after the operation is completed. For example, there's an "internal_notes" field that users with "team" group can view, but others cannot. If I "patch" an update by one of the users who cannot view that field, the "internal_notes" field is returned after the update process completes. Note that I do not pass the "internal_notes" field in the update. I do partial updates (with PATCH), so in my test I only passed "initials" as the field to change. Here's an edited version (some fields omitted for brevity) of the result from a detail view. Note: no "internal_notes", which is correct. "results": { "id": 1, "client": "Acme Honey", "url": "http://demo1.mysite.api/clients/team/1/", "team_member": … -
React Native + Django DRF network error on POST
I'm developing a React Native app. As a backend I'm using DJango DRF. I'm trying to make POST request for creating a new element on backend, this is my code in React: **API.JS** const routes = { accounts: { get: () => requestHelper({ method: "get", url: "accounts/", }), post: (data) => requestHelper({ data, method: "post", url: "accounts/", }), }, }; **API CALL** const formData = new FormData(); const image = { uri: data.image, name: data.timestamp + ".jpg", type: "image/jpeg", }; _.map(data, (item, name) => { formData.append(name, item); }); formData.append("image", image); await api.accounts .post(formData) .then((res) => { console.log(res, "OK"); }) .catch((err) => { console.log(err); }); }; Te request is reaching backend and the new Account is being created on database (including the image). The problem is that,despite that Django is returning 200_OK, the api call is going to the catch statement, and this error appears on console: Network Error Stack trace: node_modules/axios/lib/core/createError.js:15:0 in node_modules/axios/lib/adapters/xhr.js:81:4 in dispatchXhrRequest node_modules/event-target-shim/dist/event-target-shim.js:818:20 in EventTarget.prototype.dispatchEvent node_modules/react-native/Libraries/Network/XMLHttpRequest.js:575:10 in setReadyState node_modules/react-native/Libraries/Network/XMLHttpRequest.js:389:6 in __didCompleteResponse node_modules/react-native/Libraries/vendor/emitter/EventEmitter.js:189:10 in emit node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:425:19 in __callFunction node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:112:6 in __guard$argument_0 node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:373:10 in __guard node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:111:4 in callFunctionReturnFlushedQueue [native code]:null in callFunctionReturnFlushedQueue I think is an Image problem, because I've removed for testing and same error appears. Could you … -
Calling view with template in another app view django
I have a Django project with two Django apps. one as post which both have views called index. I tried using index view of the post app from the index view of the user app. but the get a TemplateDoesNotExist Error -
Facing an issue while trying to apply filter function in get method for django rest framework
Serializers.py class book_detailsSerializer(serializers.ModelSerializer): class Meta: model = book_details fields = '__all__' views.py class book_detailsList(APIView): def get(self,request): book = book_details.objects.all() b_serial = book_detailsSerializer(book) return JsonResponse(b_serial.data) class book_details(models.Model): bookid = models.CharField(max_length=10) booktitle = models.CharField(max_length=20) category = models.CharField(max_length=10) author = models.CharField(max_length=20) availability = models.BooleanField() no_of_copies = models.IntegerField() issuable = models.BooleanField() 1.while trying to return all the books that can be issued facing issue, "AttributeError at /details/isssuable/" where details/issuable is url path 2.Actual error: Got AttributeError when attempting to get a value for field bookid on serializer book_detailsSerializer. The serializer field might be named incorrectly and not match any attribute or key on the QuerySet instance. Original exception text was: 'QuerySet' object has no attribute 'bookid'. Request Method: GET Request URL: http://127.0.0.1:8000/details/isssuable/ Django Version: 3.1.2 Exception Type: AttributeError Exception Value: Got AttributeError when attempting to ?get a value for field bookid on serializer book_detailsSerializer. The serializer field might be named incorrectly and not match any attribute or key on the QuerySet instance. Original exception text was: 'QuerySet' object has no attribute 'bookid'. -
Cronjob running only once in Django
I'm trying to do a cronjob for a Django application using the django-cron lib. The problem is that the cronjob only runs once and it should run every minute. class MyCronJob(CronJobBase): RUN_EVERY_MINS = 1 schedule = Schedule(run_every_mins=RUN_EVERY_MINS, retry_after_failure_mins=RUN_EVERY_MINS) code = 'myapp.my_cron_job' def do(self): # My code To get around this, I also tried to create the cronjob via crontab, but it didn't work either. */1 * * * * source /home/me/.baschrc && source/me/Documents/project/app/source/bin/activate && python source/me/Documents/project/app/manage.py runcrons > source/me/Documents/project/app/cronjob.log -
Single object value from django ORM
If we want to fetch only one field from a single entry, which query is more efficient, or are they generating the same MySQL query internally? Person.objects.only('first_name').get(pk=1).first_name Person.objects.get(pk=1).first_name Is the first query fetching the entire content of the row or just the single field first_name? -
Error while transferring data from sqlite to my sql
Error Name- UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte I have given the commandpython manage.py dumpdata > datadump.json than I have given the command python manage.py loaddata datadump.json and I got mentioned Error. -
Is it possible to integrate Zoom API into the django project [closed]
I would like to ask if it is possible to integrate the Zooma API into the django project, if there is such a thing and one of you knows maybe a tutorial or a tutorial video I would appreciate -
Django: Getting Interface Error, Exception Value: (0, '') when using remote MySQL DB but not local DB
Trying to login to my app, I am getting this error when I am using a MySQL DB hosted remotely but not when I am connecting to my locally hosted XAMPP one. I've read a couple entries on my question but they mostly mention cursors that aren't explicitly closed, which I don't need to since I am using with in all my raw queries. I am using django-allauth for my authentication. Traceback: Environment: Request Method: GET Request URL: http://localhost:8000/accounts/login/?next=/ Django Version: 3.1.2 Python Version: 3.8.6 Installed Applications: ['ewhale_app', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.sites', 'allauth', 'allauth.account', 'users.apps.UsersConfig', 'pages.apps.PagesConfig'] Installed 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'] Traceback (most recent call last): File "C:\Users\Ej\AppData\Local\Programs\Python\Python38\lib\site-packages\django\db\backends\utils.py", line 84, in _execute return self.cursor.execute(sql, params) File "C:\Users\Ej\AppData\Local\Programs\Python\Python38\lib\site-packages\django\db\backends\mysql\base.py", line 73, in execute return self.cursor.execute(query, args) File "C:\Users\Ej\AppData\Local\Programs\Python\Python38\lib\site-packages\MySQLdb\cursors.py", line 206, in execute res = self._query(query) File "C:\Users\Ej\AppData\Local\Programs\Python\Python38\lib\site-packages\MySQLdb\cursors.py", line 319, in _query db.query(q) File "C:\Users\Ej\AppData\Local\Programs\Python\Python38\lib\site-packages\MySQLdb\connections.py", line 259, in query _mysql.connection.query(self, query) The above exception ((0, '')) was the direct cause of the following exception: File "C:\Users\Ej\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\handlers\exception.py", line 47, in inner response = get_response(request) File "C:\Users\Ej\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\handlers\base.py", line 179, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "C:\Users\Ej\AppData\Local\Programs\Python\Python38\lib\site-packages\django\views\generic\base.py", line 70, in view return self.dispatch(request, *args, **kwargs) File "C:\Users\Ej\AppData\Local\Programs\Python\Python38\lib\site-packages\django\utils\decorators.py", … -
Django rich text editor inside django template not for Admin
How can I set rich text editor inside Django Template without using crispy form {{form.media}}. I am not using crispy form right now. What to do. -
Roles in Django
I'm creating web based system, where I have 5 or 6 different roles and access type. I made a research how to achieve this and everything is made only when create group in django admin and assign user into it but only from the administrative part. I need to create this from the views. I already have a form to add users with email and drop down menu to set the role type. Any suggestions will be appreciated, because till now I don't have idea how to achieve this without to assign the users from django admin. my model.py for users: class CustomUserManager(BaseUserManager): """ Custom user model manager where email is the unique identifiers for authentication instead of usernames. """ def create_user(self, email, password, **extra_fields): """ Create and save a User with the given email and password. """ if not email: raise ValueError(_('The Email must be set')) email = self.normalize_email(email) user = self.model(email=email, **extra_fields) user.set_password(password) user.save() return user def create_superuser(self, email, password, **extra_fields): """ Create and save a SuperUser with the given email and password. """ extra_fields.setdefault('is_staff', True) extra_fields.setdefault('is_superuser', True) extra_fields.setdefault('is_active', True) if extra_fields.get('is_staff') is not True: raise ValueError(_('Superuser must have is_staff=True.')) if extra_fields.get('is_superuser') is not True: raise ValueError(_('Superuser must … -
Custom Django-Allauth SignUp form not adding new users
I tried to create a custom Signup Form with allauth but when I submit the form on the frontend it directs to the success_url and upon inspection in the admin panel a new user wasn't created. # forms.py from allauth.account.forms import SignupForm class SimpleSignupForm(SignupForm): mobile_number = PhoneNumberField(required=True) first_name = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control'}), max_length=255, required=True) last_name = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control'}), max_length=255, required=True) address = AddressField(required=True) type = forms.ModelChoiceField(queryset=UserType.objects.all()) def save(self, request): user = super(SimpleSignupForm, self).save(request) user.mobile = self.cleaned_data['mobile_number'] user.address = self.cleaned_data['address'] user.first_name = self.cleaned_data['first_name'] user.last_name = self.cleaned_data['last_name'] user.type = self.cleaned_data['type'] user.save() return user def __init__(self, *args, **kwargs): super(SimpleSignupForm, self).__init__(*args, **kwargs) visibles = self.visible_fields() visibles[0].field.widget.attrs['class'] = 'form-control' # settings.py ACCOUNT_FORMS = {'signup': 'my_app_path.forms.SimpleSignupForm'} On the template file I made sure the <form> tag has method='POST' and that I included {% csrf_token %} in the form. The button is also a a submit type. I've also made sure {{ form.as_p }} has all the required fields when submitting. There are no errors or warnings popping up anywhere. -
Non-ASCII characters are not correctly displayed in PDF when served via HttpResponse
I have generated a PDF file which contains Cyrillic characters (non-ASCII) with ReportLab. For this purpose I have used the "Montserrat" font, which support such characters. When I look in the generated PDF file inside the media folder of Django, the characters are correctly displayed: However, when I try to serve this PDF via HttpResponse, the Cyrillic characters are not properly displayed: The code that serves the PDF is the following: # Return the pdf as a response fs = FileSystemStorage() if fs.exists(filename): with fs.open(filename) as pdf: response = HttpResponse( pdf, content_type='application/pdf; encoding=utf-8; charset=utf-8') response['Content-Disposition'] = 'inline; filename="'+filename+'"' return response I have tried nearly everything with success. Actually, I do not understand why, if ReportLab embeddes correctly the font (local file inside media folder), the file provided to the browser is not embedding the font. -
stop or kill thread in python
I am creating a function that creates threads. if I recall the function running threads should be terminated. and new threads should be created. def callme(): t1 = thread(target=somefunction, args=(,)) t2 = thread(target=somefunction, args=(,)) t1.start() t2.start() t1.join() t2.join() def somefunction(): for i in range(10000000): print(i) callme() #callme1 sleep(2) callme() #callme2 if I callme1 than 2 threads should be created after 2 seconds I call callme2 then, threads of callme1 should be killed or stopped. and 2 threads of callme2 runs I am using some kind of this technique in Django if I fetch the URL than some view function calls, which contains these types of thread structures. -
'function' object has no attribute 'all' which was working fine before
My code was working fine before now, all of a sudden is starts to show 'function' object has no attribute 'all', its an api, this is the serializers and error is from the return statement return OrderItemSerializer(obj.items.all(), many=True).data class OrderSerializer(serializers.ModelSerializer): order_items = serializers.SerializerMethodField() total = serializers.SerializerMethodField() coupon = serializers.SerializerMethodField() class Meta: model = Order fields = ( 'id', 'order_items', 'total', 'coupon' ) def get_order_items(self, obj): return OrderItemSerializer(obj.items.all(), many=True).data What do i do? -
How to create a timetable for school with models in django
Hi I'm new in Django and I want to create a web page that you can insert there a timetable of a school class, but I'm having a hard time to write the models for that task. I made classes for a table, days and lessons, but I can't figure out how to not repeat information because every user can input as many time tables that they want, and every time table have the 7 weekdays, therefor I'll have the same day object more then once. here my models: from django.urls import reverse from django.db import models # Create your models here. class Table(models.Model): name = models.CharField(max_length = 100, unique=True) class Day(models.Model): # this spesific the table the those days belong to table = models.ForeignKey(Table,on_delete=models.CASCADE) name = models.CharField(max_length = 10) # here we get this day lessons info in a list of dictionaris in a form of json lessons = models.TextField(null=True) def __str__(self): return self.table.name +' : ' + self.name # here the class contain a lesson information class Lesson(models.Model): table = models.ForeignKey(Table,on_delete = models.CASCADE) name = models.CharField(max_length = 50) def __str__(self): return self.name I'll be happy to hear a better way to create this data stracture. thank you. -
DoesNotExist at /my-cart/ Product matching query does not exist
I am working on a django project. But an error occurs just after creating MyCartView. Please someone help me to resolve this error: Error screenshot 1 Error screenshot 2 This is 'urls.py' of 'shop' app inside the project - urls.py This is 'views.py' - ProductDetailView and MyCartView This is 'mycart.html' - mycart.html -
Python Django Web application not able to deploy on Heroku using Waitress server
Django , Herouku , Waitress Hey I have tried to deployed my django application several times on Heroku and then i finally succeeded . It is working fine on localhost ,however, when i use the link provided by heroku, the page says "Application error An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command heroku logs --tail". i then use heroku logs --tail to find the errors and this is what comes up *2020-11-04T11:18:12.000000+00:00 app[api]: Build started by user ###@gmail.com 2020-11-04T11:18:37.568356+00:00 app[api]: Deploy 0f1e9788 by user ###@gmail.com 2020-11-04T11:18:37.568356+00:00 app[api]: Release v8 created by user ###@gmail.com 2020-11-04T11:18:37.580530+00:00 app[api]: Scaled to web@1:Free by user ###@gmail.com 2020-11-04T11:18:42.950948+00:00 heroku[web.1]: Starting process with command waitress-serve --port=6549 ietwebsite.wsgi:application 2020-11-04T11:18:46.124484+00:00 app[web.1]: bash: waitress-serve: command not found 2020-11-04T11:18:46.190476+00:00 heroku[web.1]: Process exited with status 127 2020-11-04T11:18:46.289712+00:00 heroku[web.1]: State changed from starting to crashed 2020-11-04T11:18:46.293953+00:00 heroku[web.1]: State changed from crashed to starting 2020-11-04T11:18:47.000000+00:00 app[api]: Build succeeded 2020-11-04T11:18:49.777532+00:00 heroku[web.1]: Starting process with command waitress-serve --port=24388 ietwebsite.wsgi:application 2020-11-04T11:18:51.662371+00:00 app[web.1]: bash: waitress-serve: command not found 2020-11-04T11:18:51.711684+00:00 heroku[web.1]: Process exited with status 127 2020-11-04T11:18:51.755205+00:00 heroku[web.1]: State changed from starting … -
Django - remember Ajax post request context with elements attributes changed
I'm working on a invites project, where each guest has their own link. He has two options: to confirm or not. When one of these buttons is pressed, an ajax post is made and if it is successful, certain elements attributes are changed (some receive hide attr, others receive show attr), following as an "I changed my mind" button to appear. What I want to achieve: when reloading the page, the attributes of the elements should be set according to the ajax post made previously (ie certain elements should be under hide attr, the two buttons should be hidden, and so on). Here is what happens at each ajax post: -
Django - serialize complex context structure with models and data
In django view I want to be able to serialize whole context, that is usually used to send to template (typically by calling render and passing locals). I want to experiment with SPA+API and possibilities to go forward with and I'd like to create function, that would serialize locals to json and return it as json response. Now problem is, that locals is typically mix of lists, dists and querysets of models. I can serialize models using django.core.serializers or using django-rest-framework. I can serialize dict with primitive types using json library, but I don't know any simple way how to do mix of those. Ideal would be way to go through locals dictionary and replace all found models with their serialized representations and then put it all together, maybe even specify before what serializer (in sense of drf) to use for which model. But I really don't want to reinvent wheel in case it already exists. Anoher question is - is this even a good idea to try to do this? Return json context as alternative to server side rendering? I am in prototyping stage so I am still thinking of how to move forward and any input in the … -
Set a variable in Jinja2 with Django
I'm trying to create a variable in a Jinja Template with Django. I have a class A with a manytomany field a. I want to check if a contains b, c or d, then display a certain div, but I want it displayed only once, even if all b, c and d are in a. I want to do something like: {% for i in A.a.all %} {% if i == b or i == c or i == d %} create a variable and set its value to true {% endif %} {% endfor %} {% if variable == true %} display the div {% endif %} Thanks. -
Django update formset
I created a formset form, but I am facing a problem. When I want to update the created form and delete the empty line, I get. an error, since the empty line is not completely deleted, but becomes hidden, and the form does not pass validation forms.py from django import forms from django.forms.models import inlineformset_factory from crispy_forms.helper import FormHelper from crispy_forms.layout import Layout, Field, Fieldset, Hidden, Div, Column, Row, HTML, ButtonHolder, Submit, MultiField import re from .custom_layout_object import Formset from .models import CsvFile, CsvFileColl DELIMITER_CHOICES = ( (',', 'Comma(,)'), ('\t', 'Tabular(\\t)'), (':', 'Colon(:)'), (';', 'Semicolon(;)'), ) QUOTERCHAR_CHOIES = ( ('"', 'Double-quote(")'), ('\'', 'Quote(\')'), ) TYPE_CHOIES = ( ('Integer', 'Integer'), ('Full Name', 'Full Name'), ('Email', 'Email'), ('Company', 'Company'), ('Job', 'Job'), ('Date', 'Date'), #('Phone Number', 'Phone Number'), ) class CsvFileForm(forms.ModelForm): name = forms.CharField(max_length=255, widget=forms.TextInput(attrs={ 'class': 'form-control', 'placeholder': 'Enter file name here' })) column_separator = forms.ChoiceField(choices=DELIMITER_CHOICES) string_character = forms.ChoiceField(choices=QUOTERCHAR_CHOIES) class Meta: model = CsvFile exclude = ['owner', 'date_creating', 'date_modification', 'csv_file', 'status', 'size'] def __init__(self, *args, **kwargs): super(CsvFileForm, self).__init__(*args, **kwargs) self.helper = FormHelper() self.helper.form_tag = True self.helper.layout = Layout( Div( Row( HTML("<h3>New Schema</h3>"), Submit('submit', 'Submit', css_class='ml-auto mr-4 btn-success'), ), Row( Div( Field('name'), Field('column_separator'), Field('string_character'), css_class='col-4 mt-2' ), ), Fieldset('Schema columns', Formset('files')), HTML("<br>"), css_class='container' ) … -
I am sending registration activation email using celery in django but celery gives some error
I am sending a registration activation email using celery in Django. forms.py from django import forms from .models import User from django.contrib.auth.forms import UserCreationForm, AuthenticationForm from .tasks import send_confirmation_mail_task from django.conf import settings from phonenumber_field.formfields import PhoneNumberField from django.contrib.auth.forms import PasswordResetForm as PasswordResetFormCore class RegisterForm(UserCreationForm): first_name = forms.CharField(required = True) last_name = forms.CharField(required = True) mobile_no = PhoneNumberField(widget=forms.TextInput(attrs={'placeholder': '+91 8866776644'})) date_of_birth = forms.DateField(input_formats=settings.DATE_INPUT_FORMATS, widget=forms.DateInput(attrs={'type': 'date', 'class':'datepicker'})) class Meta: model = User fields = ('username', 'email', 'first_name', 'last_name', 'mobile_no', 'date_of_birth', 'address', 'password1', 'password2') def send_email(self): send_confirmation_mail_task.delay( self.cleaned_data['username'], self.cleaned_data['email'] ) tasks.py from __future__ import absolute_import, unicode_literals from celery.decorators import task from celery.utils.log import get_task_logger from .email import send_confirmation_mail from django.contrib.auth.forms import PasswordResetForm logger = get_task_logger(__name__) @task(name="send_confirmation_mail_task") def send_confirmation_mail_task(username, email): logger.info("Sent Confirmation Email") return send_confirmation_mail(username, email) email.py from django.template import Context from django.contrib.sites.shortcuts import get_current_site from django.utils.encoding import force_bytes, force_text from django.utils.http import urlsafe_base64_encode, urlsafe_base64_decode from django.template.loader import render_to_string from .tokens import account_activation_token from django.core.mail import EmailMessage from django.conf import settings from django.contrib.sites.models import Site from accounts.models import User def send_confirmation_mail(username, email): user = User.objects.filter(pk=user.id) current_site = Site.objects.get_current().domain message={ 'username': username, 'email': email, 'domain': current_site, 'uid': urlsafe_base64_encode(force_bytes(user.pk)).decode(), 'token': account_activation_token.make_token(user), } email_subject = 'Activation Mail' email_body = render_to_string('activation_mail.html', message) email = EmailMessage( email_subject, email_body, … -
django - multiple registration types
I'm trying to have multiple signup forms with allauth django package. But I cannot use multiple forms. urls.py path('accounts/signup/student/', StudentSignupView.as_view(), name='account_signup_student'), forms.py class StudentSignupForm(SignupForm): def save(self, request): # this is not run !!! user = super(StudentSignupForm, self).save(request) return user If I put this in the settings file save method is running: ACCOUNT_FORMS = {'signup': 'customauth.forms.StudentSignupForm'} but I want to be able to use different forms not just one. I have tried the solution from here: How to create multiple signup pages with django-allauth? -
django.setup() giving me ModuleNotFoundError: when ran in pycharm
I have setup a django project and an app for that project as per below. After I changed the model I am able to makemigration and migrate. I can run the server and the admin page displays my app as expected. I am able to run python manage.py shell, import and manipulate my models in the shell. However when I try to import my model from another python file (in pycharm) I am getting an error stating that the module for my app cannot be found. OS: Distributor ID: LinuxMint Description: Linux Mint 19.3 Tricia Release: 19.3 Codename: tricia IDE PyCharm 2020.2.3 (Community Edition) Build #PC-202.7660.27, built on October 6, 2020 Runtime version: 11.0.8+10-b944.34 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Linux 5.4.0-52-generic GC: ParNew, ConcurrentMarkSweep Memory: 1871M Cores: 8 Non-Bundled Plugins: Statistic, com.alayouni.ansiHighlight, com.intellij.ideolog, org.toml.lang, ru.meanmail.plugin.requirements, com.jetbrains.plugins.ini4idea Current Desktop: X-Cinnamon Python: python 3.6 Django Django==3.1.3 I have read the previous related question: django-modulenotfounderror-no-module-named-restaurants and django-modulenotfounderror but I think my issue is somewhat different. I have not moved files around or change folder names, I really tried to keep it as per the tutorial as possible (I even recreate the exat poll app example from django doc and …