Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
LoginRequiredMixin not redirecting with TemplateView in django 3
I am new to Django. I am trying to restrict the dashboard page using LoginRequiredMixin as described in the official docs https://docs.djangoproject.com/en/3.0/topics/auth/default/. I am doing this with TemplateView. I also do it with View. But the problem is it always gives me access to this page although I remain logged out. I don't know what I have missed is just followed the documentation. Here is my main url conf: urlpatterns = [ path('', include('user.urls')), path('admin/', admin.site.urls), path('dashboard/', include('dashboard.urls')), ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) Here is my dashboard urls conf: urlpatterns = [ path('', views.DashboardView.as_view(), name='dashboard'), ] Here is my user urls conf: urlpatterns = [ path('login/', views.LoginView.as_view(), name='login'), path('logout/', views.LogoutView.as_view(), name='logout'), ] Here is my Dashboard view: class DashboardView(LoginRequiredMixin, TemplateView): login_url = '/login' redirect_field_name = 'redirect_to' template_name = "user/dashboard.html" Here is my login view: class LoginView(FormView): template_name = "user/login.html" form_class = LoginForm def form_valid(self, form): username = form.cleaned_data['username'] password = form.cleaned_data['password'] user = authenticate(username=username, password=password) if user is not None: login(self.request, user) return redirect('dashboard') I searched in google and stack overflow also but that solution didn't work for me. -
Django: Data not being submitted to database, but no error
I am creating a Django app for a To do List. I am using a bootstrap modal with Json for the Insertion into database. However, when I click the submit button, it says that data has been submitted into the database, but when I check the database, nothing is there. urls.py: urlpatterns = [ path('', TaskListView.as_view(), name='task_list'), re_path(r'^create/$', views.task_create, name='task_create'), ] views.py: @login_required def task_create(request): data = dict() #, data=request.POST if request.method == 'POST': form = TaskForm(request.user, data=request.POST) if form.is_valid(): form.save(commit=False) data['form_is_valid'] = True else: data['form_is_valid'] = False else: form = TaskForm(request.user) context = {'form': form} data['html_form'] = render_to_string('partial_task_create.html', context, request=request ) return JsonResponse(data) JavaScript: $("#modal-task").on("submit", ".js-task-create-form", function () { var form = $(this); // {% url 'task_create' %} ................. $.ajax({ url: form.attr("action"), data: form.serialize(), type: form.attr("method"), dataType: 'json', success: function (data) { if (data.form_is_valid) { alert("Task created!"); // <-- This is just a placeholder for now for testing } else { $("#modal-task .modal-content").html(data.html_form); } } }); return false; }); section of main template : <div class="modal fade" id="modal-task"> <div class="modal-dialog"> <div class="modal-content"> </div> </div> </div> partial template for modal: {% load widget_tweaks %} <form method="post" action="{% url 'task_create' %}" class="js-task-create-form" novalidate> {% csrf_token %} <div class="modal-header"> <h4 class="modal-title" style="margin-left:90px;">Create … -
Django log create new log file after file size reach 1050KB
I decide to create a log file and this log file i wish to have a maximun size limit (1050kb). If the log(testlog.log) size is full, i wish to create a new log file which is (testlog_1.log). I try below code but the file doest not create when it come to 1050KB. log_format = "%(asctime)s::%(levelname)s::%(name)s::"\ "%(filename)s::%(lineno)d::%(message)s" today = date.today() # dd/mm/YY d1 = today.strftime("%d%m%Y") filenameDate=d1 filenameDate=str(filenameDate) logpath="D:\\Pin\\"+filenameDate+".log" logging.basicConfig(filename=logpath, level="DEBUG", format=log_format) log = logging.getLogger() handler = RotatingFileHandler(logpath, maxBytes=1 * 1024 * 1024, backupCount=100, mode="a", delay=False) if (log.hasHandlers()): log.handlers.clear() log.addHandler(handler) fmt = logging.Formatter(log_format) handler.setFormatter(fmt) please help. -
How to create "add to favorites" functional using Django Rest Framework
I just can’t find any information about the implementation of the system of adding to favorites for registered users. The model has a Post model. It has a couple of fields of format String. The author field, which indicates which user made the POST request, etc. But how to make it so that the user can add this Post to his “favorites”, so that later you can get a JSON response with all the posts that he added to himself. Well, respectively, so that you can remove from favorites. Are there any ideas? -
how to render DICOM image to the template (front end ) in Django
i'm using function in views.py that generates list of slices of DICOM image and i need away to show this image in the front end of Django app , in any python script i can show image by matplotliiip library how can i render it to template -
How to use Django annotate?
I'd like to ask, how I could shrink this to one command? I understand that annotate is proper way to do this,but don't understand how. Here is my code, which is too slow: sum = 0 for contact in self.contacts.all(): sum += (contact.orders.aggregate(models.Sum('total'))['total__sum']) return sum I'd like to get Sum for each contact, all records in total column of relevant orders. Code above produces sum, but is sluggishly slow. It is my understand it can be done with annotate,but not sure how to use it. Help please -
duplicate entries to the database
I'm creating an application in the style of an electronic journal and I have a strange problem with adding ratings ... well, the mechanism itself works, but it adds two the same values to the database, below is the code from the views.py file, maybe someone will know what causes this error class MarkCreateView(CreateView): model = Mark form_class = MarkForm template_name = 'projects/mark.html' success_message = 'Success: mark set' # TODO: double marks def form_valid(self, form, **kwargs): form.instance.course = get_object_or_404(Course, pk=self.kwargs.get('pk')) return super().form_valid(form) def get_context_data(self, **kwargs): course = Course.objects.get(pk=self.kwargs.get('pk')) context = super(MarkCreateView, self).get_context_data(**kwargs) context['max_mark'] = course.points context['course'] = course return context def get_success_url(self, **kwargs): pk = self.object.course.id return reverse('course', kwargs={'pk': pk}) -
Autocomplete multiple field in Django
I want to get value from multiple field for autocomplete function. I've select category from select box before typing product name in input field. And I want to filter product where product category match the selected category. I try to send category to function but it show 'Not found: /autocomplete_product' function first() { ... defining variable section ... wrapper.append(category,product, amount, btnDel); $('#cover').append(wrapper); $(wrapper).find("input[name^='product']").autocomplete({ source: "/autocomplete_product?category", minLength: 2, }); } urls.py path('autocomplete_product/<category>', views.autocomplete_product, name='autocomplete'), views.py def autocomplete_product(request, category): data = request.GET print(category) product = data.get("term") if product: products = Product.objects.filter(product_name__icontains=product, del_flag=False) else: products = Product.objects.all() results = [] for pd in products: print('pd name: ', pd.product_name) for pd in products: pd_json = {} pd_json['id'] = pd.id pd_json['label'] = pd.product_name pd_json['value'] = pd.product_name results.append(pd_json) data = json.dumps(results) mimetype = 'application/json' return HttpResponse(data, mimetype) I don't need a direct solution. You can give me an example for learn how to solve it. -
if div is not active than formset doesn't have remove button
I am using multiple formsets on the same page. But only one formsets should be visible at the moment. I use bootstrap nav-item for that. <ul class="nav nav-tabs"> <li class="nav-item"><a class="nav-link active" data-toggle="tab" href="#1"> 1 </a></li> <li class="nav-item"><a class="nav-link " data-toggle="tab" href="#2"> 2 </a></li> <li class="nav-item"><a class="nav-link " data-toggle="tab" href="#3"> 3 </a></li> </ul> <div class="tab-content"> <div id="1" class="tab-pane fade in active show"> {% include "1.html" %} </div> <div id="2" class="tab-pane fade"> {% include "2.html" %} </div> <div id="3" class="tab-pane fade"> {% include "3.html" %} </div> </div> The problem is that if div with formsets doesn't have class "active" than it doesn't show delete-fields. If i click on the link 2 or 3 I see formsets with "Add" buttons, but without "remove". My <td> </td> where i should have <a class="delete-row" href="javascript:void(0)"> delete row </a> function is empty. But if i include < div class="tab-pane fade in active"> in all div's I have correct HTML and all works fine: <div class="tab-content"> <div id="1" class="tab-pane fade in active show"> {% include "1.html" %} </div> <div id="2" class="tab-pane fade in active"> {% include "2.html" %} </div> <div id="3" class="tab-pane fade in active"> {% include "3.html" %} </div> </div> But of course in that … -
on heroku, celery beat database scheduler doesn’t run periodic tasks
I have an issue where django_celery_beat’s DatabaseScheduler doesn’t run periodic tasks. Or I should say where celery beat doesn’t find any tasks when the scheduler is DatabaseScheduler. In case I use the standard scheduler the tasks are executed regularly. I setup celery on heroku by using a dyno for worker and one for beat (and one for web, obviously). I know that beat and worker are connected to redis and to postgres for task results. Every periodic task I run from django admin by selecting a task and “run selected task” gets executed. However, it is about two days that I’m trying to figure out why there isn’t a way for beat/worker to find that I scheduled a task to execute every 10 seconds, or using a cron (even restarting beat and remot doesn’t change it). I’m kind of desperate, and my next move would be to give redbeat a try. Any help on how to how to troubleshoot this particular problem would be greatly appreciated. I suspect the problem is in the is_due method. I am using UTC (in celery and django), all cron are UTC based. All I see in the beat log is “writing entries..” every on … -
How to set up error reporting to file not to email
I have a project deployed to hosting. I configured nginx and gunicorn as mentioned in documentation I turned DEBUG to False in settings.py file to avoid security risks. But turning debug to false deprive me from useful information. I read this article https://docs.djangoproject.com/en/3.0/howto/error-reporting/ about handling 404 error handling and sending it to admin's email adress I think that is what I need but I want to save this error information to special directory not to my email. Can I doing this? -
Django inspectdb not respecting primary key on two columns (postgres)
I am hooking up to an existing Postgres database with Django, using inspectdb to generate my models.py file. The tables in the Postgres were created like this: CREATE TABLE "a" ( "id" uuid NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'::uuid, CONSTRAINT "PK.a" PRIMARY KEY ("id") ) CREATE TABLE "c" ( "id" uuid NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'::uuid, CONSTRAINT "PK.c" PRIMARY KEY ("id") ) CREATE TABLE "b" ( "aid" uuid NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'::uuid, "cid" uuid NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'::uuid, CONSTRAINT "PK.b" PRIMARY KEY ("aid","cid"), CONSTRAINT "FK_a" FOREIGN KEY ("aid") REFERENCES "a" ("id") MATCH SIMPLE ON UPDATE NO ACTION ON DELETE CASCADE, CONSTRAINT "FK_c" FOREIGN KEY ("cid") REFERENCES "c" ("id") MATCH SIMPLE ON UPDATE NO ACTION ON DELETE CASCADE ) I then run python manage.py inspectdb --database primary > models_test.py, which results in the following models_test.py. class A(models.Model): id = models.UUIDField(primary_key=True) class Meta: managed = False db_table = 'a' class B(models.Model): aid = models.OneToOneField(A, models.DO_NOTHING, db_column='aid', primary_key=True) cid = models.ForeignKey('C', models.DO_NOTHING, db_column='cid') class Meta: managed = False db_table = 'b' unique_together = (('aid', 'cid'),) class C(models.Model): id = models.UUIDField(primary_key=True) class Meta: managed = False db_table = 'c' note the OneToOneField defined on aid. If I instead create table b as: CREATE TABLE "b" ( "aid" … -
Displaying message through window alert in Django templates
I have a django template in which a logged in user can check his/her account balance. The balance is obtained in the django template through a form labelled as 'form0'. Now I want to display this user balance through an alertbox. Given below are the relevant files: HTML: {% extends "base.html" %} {% load bootstrap4 %} {% block content %} <form action="/profiles/userLogin/" method="POST"> <button class="material-icons floating-btnz" name="form0" onClick='showMessage()></button> </form> <script> function showMessage(){ alert("Your balance is " + balance); } </script> {% endblock %} views.py: if request.method=="POST": if 'form0' in request.POST: x = employee.objects.get(name = request.user) y = x.balance return render(request, 'profiles/userLogin.html', {'balance': y}) models.py: class employee(models.Model): name = models.OneToOneField(User, on_delete=models.CASCADE) id = models.CharField(max_length=20, primary_key=True) balance = models.IntegerField(default=0) How can I implement this requirement in my system? Any help is appreciated. -
How to allow an empty foreign key in Django?
I'm very new to Django so this may be the dumbest question ever. I have 2 models set up in django; 'Class' and 'Profile'. The 'Profile' class has a foreign key that references 'Class'. When creating a profile on the front end I am unable to leave the form blank as ("Profile.group" must be a "Class" instance.). I want to be able to create a profile that doesn't have to belong to a class. class Class(models.Model): class_name = models.CharField(max_length=5) # a few other things that don't matter def __str__(self): return self.class_name class Profile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) # a few other things that don't matter group = models.ForeignKey(Class, on_delete=models.SET_NULL, null=True, blank=True) and in form.py class ProfileRegisterForm(forms.ModelForm): # a few other things group = forms.CharField(max_length=5, required=False) If there is anything important that I've missed out please let me know, it's my first time posting here so I don't know what the standard is. -
Reverse for '' not found '' is not a valid view function or pattern name
I'm getting the above message when trying to view the cart page in my Ecommerce site. I can see that this is a fairly common question but after trawling through multiple other threads here, none of the solutions are working. In the current iteration of my code I have added an app_name to the cart app and then referenced this in my html, but no joy. Traceback: Environment: Request Method: GET Request URL: http://127.0.0.1:8000/cart/ Django Version: 2.2.5 Python Version: 3.8.1 Installed Applications: ['pages.apps.PagesConfig', 'accounts.apps.AccountsConfig', 'products.apps.ProductsConfig', 'cart.apps.CartConfig', 'search.apps.SearchConfig', 'crispy_forms', 'storages', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles'] Installed Middleware: ('whitenoise.middleware.WhiteNoiseMiddleware', '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') Template error: In template C:\Users\Vegeta\OneDrive\Visual Studio Code\milestone-project-four\pages\templates\base.html, error at line 0 Reverse for '' not found. '' is not a valid view function or pattern name. 1 : {% load static %} 2 : 3 : <!DOCTYPE html> 4 : <html lang="en"> 5 : 6 : <head> 7 : <meta charset="utf-8" /> 8 : <!-- Set the viewport to allow responsiveness --> 9 : <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" /> 10 : <!-- Bootstrap CSS --> Traceback: File "C:\Users\Vegeta\OneDrive\Visual Studio Code\milestone-project-four\env\lib\site-packages\django\core\handlers\exception.py" in inner 34. response = get_response(request) File "C:\Users\Vegeta\OneDrive\Visual Studio Code\milestone-project-four\env\lib\site-packages\django\core\handlers\base.py" in _get_response 115. response … -
Django Form Wizard - Using an image formset for a related post model
So I'm using the Django Form Wizard to split a simplified PostForm. In one of the steps, visitors can upload different images related to the Post. Within the done method for the SessionWizardView, I'm saving the instance first and then check for the images within the formset. However I get the following error message; save() prohibited to prevent data loss due to unsaved related object I tried setting the related Post id for the formset but I'm missing something here, formsets are still something I can't really follow.. Any help is appreciated! models.py class Post(models.Model) title = models.CharField(max_length=200) description = models.TextField(max_length=1000) def __str__(self): return self.title class Image(models.Model): post = models.ForeignKey('Post', on_delete=models.SET_NULL, null=True) file = models.ImageField(upload_to='images/', null=True, blank=True) alt = models.CharField(max_length=200, blank=True) views.py FORMS = [ ('title', PostCreateForm), ('image', ImageFormset) ] TEMPLATES = { 'title': 'post_form_title.html', 'image': 'post_form_image.html' } class PostWizardView(SessionWizardView): form_list = FORMS file_storage = FileSystemStorage(location=os.path.join(settings.MEDIA_ROOT, 'temp/')) def get_template_names(self): return [TEMPLATES[self.steps.current]] def done(self, form_list, form_dict, **kwargs): instance = Post() for form in form_list: instance = construct_instance(form, instance) instance.save() post_id = instance.pk if 'image' in form_dict: formset = form_dict['image'] if formset.is_valid(): formset.save(commit=False) for form in formset: form.post = post_id formset.save() forms.py class PostCreateForm(forms.ModelForm): class Meta: model = Image fields = '__all__' … -
Unable to implement a floating button in Django template
I am trying to create a floating button as shown in this video. However I am unable to implement the same. I am basically tying to add this to one my django templates. Here is the code of the HTML: {% extends "base.html" %} {% load bootstrap4 %} {% block content %} <button class="material-icons floating-btnz">Add</button> Some more code here {% endblock %} <style> .floating-btnz{ width: 80px; height: 80px; background: #009879; display: flex; border-radius: 50%; color: #ffffff; font-size: 40px; align-items: center; justify-content: center; text-decoration: none; box-shadow: 2px 2px 5px rgba(0,0,0, 0.25); outline: blue; border: none; cursor: pointer; } </style> I have included the material icon cdn in my base.html. It seems to me that the cdn is not working. Upon checking in the web console, the css is loading but not showing up on the button. Where am I going wrong? Any help is appreciated. -
How to logging information about 404 error while Debug = False
I have a django project on production. In my settings.py file Debug=False to avoid security risks which arrises when Debug=True I heard about python logging module which I am trying to set up. But after reading documentation like I understand I should put logging instances in each piece of code where error can be arrised, but what if I need to handle 404 errors? How I can handle them? Please anyone guide me -
How do I add TypeScript files in a Django project made with Visual Studio 2019
Is it possible to use TypeScript instead of JavaScript in a Django project developed using Visual Studio? At the moment I just tried to add a .ts file and import it to a HTML file. It fails when finding non-Javascript syntax though. I was wondering what I was missing. Do I have to configuration Visual Studio for it? (TypeScript sdk is already installed). Is it going to compile the .ts files into JavaScript by itself or do I have to go through extra steps? -
Inherit and rename the table from default setting
I would like to rename the default table comes from Django. Meta does copy the table but the columns are totally difference How can i over come with it? -
how to see if a value is present in a list in django template. tried using IN operator but does'nt work
I'm trying to enable a button dynamically but the IN operator on my html does not work. I tried converting everything to string as well but it still did not work. Models.py class Product(models.Model): name=models.CharField(max_length=100) image=models.ImageField(default='default.jpg',upload_to='productimages') description=models.TextField() category=models.CharField(max_length=100) price=models.FloatField() def __str__(self): return f'{self.name}' class Cart(models.Model): cart2user= models.ForeignKey(User, on_delete=models.CASCADE) cart2product=models.ForeignKey(Product, on_delete=models.CASCADE) quantity=models.IntegerField(default=1) views.py def home(request): productobj=Product.objects.all() cartobj=Cart.objects.filter(cart2user=request.user) cartobjlist=[x.cart2product for x in cartobj] print(cartobjlist) return render(request,'home.html',{'productobj':productobj,'cartobjlist':'cartobjlist'}) home.html {% for pobj in productobj%} <div class="col-xl-3 eachproduct"> <form action="{%url 'home'%}" method="GET"> {% csrf_token%} <img src="{{pobj.image.url}}" height="300px" width="100%"> <h3 class="name" name="{{pobj}}" value={{pobj}}>{{pobj.id}}</h3> <h3 class="price" name="price" value={{pobj.price}}>${{pobj.price}}</h3> {% if pobj in cartobjlist %} <a href="{% url 'cart'%}" class="btn buttoncart">Go to cart</a> {% else %} <a href="addtocart/{{pobj.id}}" class="btn buttoncart">Add to cart</a> {%endif%} </form> </div> {%endfor%} -
Error while migrating the django application
My database code: I think there is a problem in the database. This is working quite well in the localhost. while coming to deploying it shows the following error. Please help me out*** strong text ---------------------- DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'telusko', 'USER' : 'postgres', 'PASSWORD': 'XXXXXXX', 'HOST' : 'localhost', 'PORT' : '', } } --------------------------------------- ERROR ---------------------------------------- Traceback (most recent call last): File "/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/base/base.py", line 217, in ensure_connection self.connect() File "/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/base/base.py", line 195, in connect self.connection = self.get_new_connection(conn_params) File "/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/postgresql/base.py", line 178, in get_new_connection connection = Database.connect(**conn_params) File "/app/.heroku/python/lib/python3.7/site-packages/psycopg2/__init__.py", line 126, in connect conn = _connect(dsn, connection_factory=connection_factory, **kwasync) psycopg2.OperationalError: could not connect to server: Connection refused Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432? The above exception was the direct cause of the following exception: 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 "/app/.heroku/python/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line utility.execute() File "/app/.heroku/python/lib/python3.7/site-packages/django/core/management/__init__.py", line 375, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/app/.heroku/python/lib/python3.7/site-packages/django/core/management/base.py", line 323, in run_from_argv self.execute(*args, **cmd_options) File "/app/.heroku/python/lib/python3.7/site-packages/django/core/management/base.py", line 364, in execute output = self.handle(*args, **options) File "/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/base/base.py", line 217, in ensure_connection self.connect() File "/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/base/base.py", line 195, in connect … -
Need Help Setting Up A Comment Section For A Django Blog
I just started learning django and i am stuck on creating a comment section for logged in users on a blog, and the ability for users to reply to that comment. I am using class based views and i will like to add the comment to the DetailView (in my case PostDetailView). models.py from django.db import models from django.utils import timezone from django.contrib.auth.models import User from django.urls import reverse class Post (models.Model): title = models.CharField (max_length=100) content = models.TextField () date_posted = models.DateTimeField (default=timezone.now) author = models.ForeignKey(User, on_delete=models.CASCADE) image = models.ImageField(default='default.jpg', upload_to='blog_images', blank=True) def __str__(self): return self.title def get_absolute_url(self): return reverse('post-detail', kwargs={'pk': self.pk}) class Comment(models.Model): post = models.ForeignKey('blog.Post', on_delete=models.CASCADE, related_name='comments') author = models.ForeignKey(User, on_delete=models.CASCADE) content = models.TextField() date_posted = models.DateTimeField(default=timezone.now) approved_comment = models.BooleanField(default=False) def approve(self): self.approved_comment = True self.save() def __str__(self): return self.content def get_absolute_url(self): return reverse('post-detail', kwargs={'pk': self.pk}) views.py from django.shortcuts import render, get_object_or_404, redirect from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin from django.contrib.auth.models import User from django.views.generic import ListView, DetailView, CreateView, UpdateView, DeleteView from .models import Post, Comment from .forms import CommentForm #from django.http import HttpResponse def home(request): context = { 'posts': Post.objects.all() } return render (request, 'blog/home.html', context) class UserPostListView(ListView): model = Post template_name = 'blog/user_posts.html' # <app>/<mode>_<view_type>.html context_object_name … -
Tell me how to release password change for Django users?
Tell me how to create the ability to change the password using my html form? I do not want to use annual ChangePasswordForm. I’ve been suffering for 1 hour and can’t find a solution. -
facing TemplateDoesNotExist error. django version - 3.7.4
Request Method: GET Request URL: http://localhost:8000/ Django Version: 3.0.2 Exception Type: TemplateDoesNotExist Exception Value: home.html Exception Location: C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\loader.py in get_template, line 19 Python Executable: C:\Users\hp\AppData\Local\Programs\Python\Python37-32\python.exe Python Version: 3.7.4 Python Path: ['C:\Users\hp\Desktop\mmpos\Django_project', 'C:\Users\hp\AppData\Local\Programs\Python\Python37-32\python37.zip', 'C:\Users\hp\AppData\Local\Programs\Python\Python37-32\DLLs', 'C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib', 'C:\Users\hp\AppData\Local\Programs\Python\Python37-32', 'C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site-packages', 'C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site-packages\win32', 'C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site-packages\win32\lib', 'C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site-packages\Pythonwin'] Server time: Sun, 16 Feb 2020 10:36:49 +0000