Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Understanding Django JSONField key-path queries and exhaustive sets
While looking at the Django docs on querying JSONField I noticed a note stating: Due to the way in which key-path queries work, exclude() and filter() are not guaranteed to produce exhaustive sets. If you want to include objects that do not have the path, add the isnull lookup. Can someone give me an example of a query that would not produce an exhaustive set? I'm having a pretty hard time coming up with one. -
EmailMultiAlternatives works fine on localhost but gives SMTPAuthenticationError on production
i already turned on Less secure app access on my google account settings I checked similar questions but nothing solves my problem i don't know why its working fine on my local host but when i upload my website to pythonanywhere i get this issue i think there's some security protocols that blocks the login process if the website is logging my email account from a different ip address i also want to let you guys know that this same process used to work fine in the last week here is my settings.py #=======email service======== EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_HOST = 'smtp.gmail.com' EMAIL_PORT = 587 EMAIL_USE_TLS = True EMAIL_HOST_USER = 'epaydz.cn@gmail.com' EMAIL_HOST_PASSWORD = '************' -
Django Wizard Form : is it possible to have a search engine for a specific step?
I'm struggling with my Django application, to the point of asking my first question on StackOverflow. Te be short, I have a form where the user (a farmer) allow him to add a plant on a culture. It'd be handy if instead of a boring select box, the farmer could just write down a few letters and every related results pop on the screen. The farmer would pick-up the plant, and proceed to the next step. Since he had 330 different seeds, it's not just a fancy functionnality. I'm able to build a "simple" WizardForm, I already have the search engine and my field is populated with a ModelChoiceField()... I feel like I'm soo close yet so far :( I have also considered that WizardForm might not be the right approach for what I'm doing. But I feel like I'm just missing something. Do any of you have any suggestion on it ? Below, you can read a few extract from my code. I will try to clean-up the mess and provide you a readable code. models.py ''' From the model, the only field that interests this question is the second one, id_graine (graine means seed). ''' class Lot(models.Model): id … -
push rejected to heroku
getting this error I have installed all the installation process. Was following this link to push my Heroku app https://www.codementor.io/@jamesezechukwu/how-to-deploy-django-app-on-heroku-dtsee04d4 getting gcc failed with command I have even tried Heroku config: set DISABLE_COLLECTSTATIC=1 but it doesn't help I am doing this for the first time sorry if it's a silly question. C:\Users\great\Desktop\Covid-App\CovidApp>git push heroku master Enumerating objects: 86, done. Counting objects: 100% (86/86), done. Delta compression using up to 8 threads Compressing objects: 100% (81/81), done. Writing objects: 100% (86/86), 35.21 KiB | 1.17 MiB/s, done. Total 86 (delta 13), reused 0 (delta 0), pack-reused 0 remote: Compressing source files... done. remote: Building source: remote: remote: -----> Python app detected remote: -----> Installing python-3.8.5 remote: -----> Installing pip 20.1.1, setuptools 47.1.1 and wheel 0.34.2 remote: -----> Installing SQLite3 remote: -----> Installing requirements with pip remote: ! Your Django version is nearing the end of its community support. remote: ! Upgrade to continue to receive security updates and for the best experience with Django. remote: ! For more information, check out https://www.djangoproject.com/download/#supported-versions remote: Collecting dj-database-url==0.4.2 remote: Downloading dj_database_url-0.4.2-py2.py3-none-any.whl (5.6 kB) remote: Collecting Django==1.11.7 remote: Downloading Django-1.11.7-py2.py3-none-any.whl (6.9 MB) remote: Collecting gunicorn==19.7.1 remote: Downloading gunicorn-19.7.1-py2.py3-none-any.whl (111 kB) remote: Collecting psycopg2==2.7.3.2 remote: Downloading … -
Django - CreateView - Send a custom Error Message if model form is not valid
I have some Class Based Views where I use the Django messages framework to send a success_message if the form POST is_valid. I would also like to send a custom error_message if the form POST is not valid. It was very obvious how to configure the success_message, just use the SuccessMessageMixin and add a "success_message" variable. I have tried the same approach for an error_message, but none one of my attempts showed the error flash message on the form page - my attempts are commented out below in the else: block. Sending an error message to a CBV seems like something that would be a pretty common scenario, yet I cannot find any examples in the Django docs or anywhere else online. Does anyone know how I can get this done? Just to be clear - I am not talking about adding ValidationErrors that are created for specific fields. I have ValidationErrors for fields working fine. This refers to a custom flash message that would be present at the top of the page. #views.py class DocCreateView(LoginRequiredMixin, SuccessMessageMixin, CreateView): model = Doc form_class = DocForm template_name = "doc/doc_form.html" context_object_name = 'doc' success_message = 'Doc successfully created!' error_meesage = "Error saving the … -
I am trying to implement soft delete in django
I am trying to implement soft delete in django but getting the following error: NoReverseMatch at /admin/trip-issue-report/ Reverse for 'soft-delete-trip-issue' with arguments '(3,)' not found. 1 pattern(s) tried: ['admin/soft\-delete\-trip\-issue/$'] My code: models.py class TripIssue(models.Model): trip = models.ForeignKey(Trip, on_delete=models.CASCADE) issue = models.ForeignKey(Issue, on_delete=models.CASCADE) isSolved = models.BooleanField(blank=False, default=False) is_deleted = models.BooleanField(default=False) deleted_at = models.DateTimeField(blank=True, null=True) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) def soft_delete(self): self.is_deleted = True self.deleted_at = timezone.now() self.save() views.py class TripIssueSoftDelete(DeleteView): model = TripIssue success_url = reverse_lazy('trip-issue-report') template_name = 'trip_issue.html' def delete(self, request, *args, **kwargs): self.object = self.get_object() self.object.soft_delete() return HttpResponseRedirect(self.get_success_url()) urls.py path('soft-delete-trip-issue/', views.TripIssueSoftDelete, name="soft-delete-trip-issue"), trip_issue.html template {% for trip_issue in trip_issues %} <tr> <td>{{trip_issue.trip}}</td> <td>{{trip_issue.issue}}</td> <td>{{trip_issue.isSolved}}</td> <td>{{trip_issue.updated_at}}</td> <td><a href="{% url 'dashboard:soft-delete-trip-issue' trip_issue.id %}"><i class="fas fa-minus-circle"></i></a></td> </tr> {% endfor %} </tbody> So I need your help to fix the issue and implement soft delete successfully. Thanks in advance. Happy Coding :) -
Identify which password validator rose an error in django form
I have a simple view for signing up which looks like this: class SignUp(CreateView): template_name = 'reg.html' form_class = SignUpForm success_url = 'login' I want to overwrite standard behavior in form_invalid method. I know that there are couple of built in password validators in django. How should I determine which one exactly rose an error? For example if a password was too short I would show different error text. I could simply overwrite the validator itself, but I don't think that it is good approach. -
How to fix this ConnectionError?
[enter image description here][1] [1]: https://i.stack.imgur.com/cDWLr.png I got this problem after implementing elasticsearch This is my installed apps 'corsheaders', 'allauth', 'allauth.account', 'allauth.socialaccount', 'rest_auth', 'rest_auth.registration', 'rest_framework', 'rest_framework.authtoken', 'oauth2_provider', "elasticsearch_dsl", 'django_elasticsearch_dsl', 'django_elasticsearch_dsl_drf', What can be the problem? -
Unique field value Django model
So, i have two models: RetailStore and Product. Product contains a ForeignKey to RetailStore and a field named sku. Basically what i need is to make sure that the sku field is unique into a store, but not between all stores, e.g: Store1: Product(sku="sku1"), Product(sku="sku2"), Product(sku="sku3"), Product(sku="sku1") <- can't have this last one because it already exists. Store2: Product(sku="sku1"), Product(sku="sku2"), Product(sku="sku3") <- This is ok Store3: [...] <- Same goes for others Store. My Models class RetailStore(StandardModelMixin): cnpj = models.CharField( blank=False, null=False, unique=True, max_length=200, validators=[validate_cnpj], verbose_name="CNPJ" ) [other fields...] class Product(StandardModelMixin, SoftDeletionModel): sku = models.CharField(blank=False, null=False, max_length=200, verbose_name="SKU") [other fields...] retail_store = models.ForeignKey( RetailStore, on_delete=models.CASCADE, blank=True, null=True, related_name="products", verbose_name="Retail Store", ) -
How to access related values with select_related()
I have a QuerySet that I'm attempting to work with the values on related tables. I see the related tables/values when I run the queryset.query, however I'm not sure how to pull those values for use in forms/tables. Here is my QuerySet Object: tpList = AppCustomerTpRel.objects.filter(idcst_rel=selection).select_related('idcst_rel', 'idtrp_rel').values() Here are the related Models. class AppCustomerTpRel(models.Model): id_rel = models.AutoField(primary_key=True) idcst_rel = models.ForeignKey(AppCustomerCst, models.DO_NOTHING, db_column='idcst_rel') idtrp_rel = models.ForeignKey(AppTradingPartnerTrp, models.DO_NOTHING, db_column='idtrp_rel') cust_vendor_rel = models.CharField(max_length=50, blank=True, null=True) sender_id_rel = models.CharField(max_length=50, blank=True, null=True) old_vendor_rel = models.CharField(max_length=50, blank=True, null=True) vendor_name_rel = models.CharField(max_length=50, blank=True, null=True) category_rel = models.CharField(max_length=50, blank=True, null=True) class AppTradingPartnerTrp(models.Model): id_trp = models.AutoField(primary_key=True) tpid_trp = models.CharField(max_length=50, blank=True, null=True) name_trp = models.CharField(max_length=50) description_trp = models.CharField(max_length=100, blank=True, null=True) idtrn_trp = models.ForeignKey('AppTransmissionTrn', models.DO_NOTHING, db_column='idtrn_trp', blank=True, null=True) class AppCustomerCst(models.Model): id_cst = models.AutoField(primary_key=True) is_active_cst = models.BooleanField() name_cst = models.CharField(max_length=50, blank=True, null=True) address_1_cst = models.CharField(max_length=50, blank=True, null=True) address_2_cst = models.CharField(max_length=50, blank=True, null=True) address_3_cst = models.CharField(max_length=50, blank=True, null=True) city_cst = models.CharField(max_length=50, blank=True, null=True) state_cst = models.CharField(max_length=50, blank=True, null=True) zip_cst = models.CharField(max_length=10, blank=True, null=True) country_cst = models.CharField(max_length=50, blank=True, null=True) salesrep_cst = models.CharField(max_length=50, blank=True, null=True) type_cst = models.CharField(max_length=10, blank=True, null=True) is_allowed_flat_cst = models.BooleanField() iddef_cst = models.IntegerField() date_created_cst = models.DateTimeField() date_suspended_cst = models.DateTimeField(blank=True, null=True) date_first_tran_cst = models.DateTimeField(blank=True, null=True) date_last_tran_cst = models.DateTimeField(blank=True, null=True) is_credit_hold_cst = models.BooleanField() old_balance_cst … -
Queryset got bigger after exclusion
This is my shell copy In [18]: Category.objects.all() Out[18]: <QuerySet [<Category: cate uno>, <Category: cate dos>, <Category: cate tres>, <Category: cate cuatro>, <Category: cate cinco>, <Category: cate seis>, <Category: cate siete>, <Category: cate ocho>, <Category: cate ocho>, <Category: cate nueve>, <Category: cate diez>]> In [19]: catesFat = Category.objects.filter(project__isnull = False) In [20]: catesFat Out[20]: <QuerySet [<Category: cate uno>, <Category: cate tres>, <Category: cate cuatro>, <Category: cate uno>, <Category: cate diez>, <Category: cate seis>, <Category: cate dos>, <Category: cate uno>, <Category: cate seis>, <Category: cate siete>, <Category: cate ocho>, <Category: cate dos>, <Category: cate cinco>]> In [21]: It seems fine when I use it in template, but why does it show the redundant queries so it got bigger in shell? -
How to override clean() method for choices in model and field validation?
I want to make check in admin, when I create new equipment I can't save it because wanna raise error. examples: is_active=True First-choice -can is_active=True Second-choice -can is_active=False First-choise - can is_active=True First-choise - ValidationError It must show error others fields also if will have ValidationError is_active=True with already selected choises raise error. Enum choices class EquipmentPage(Enum): FIRST = "First" SECOND = "Second" class Equipment(models.Model): ... page = models.CharField(max_length=7, choices=[(tag.name, tag.value) for tag in EquipmentPage]) is_active = models.BooleanField(default=False) ... Here my not working as expected clean() method def clean(self): if EquipmentPage.FIRST and self.is_active: raise ValidationError(_('Only one equipment can be used')) -
How to filter a reverse related field without additional queries?
How can I filter the reverse relation queryset generated by a ModelViewSet without causing an additional n queries? MRE: models.py: class Product(models.Model): name = models.CharField(max_length=45) image_url = models.URLField() class Item(models.Model): product = models.ForeignKey(Product, on_delete=models.CASCADE) price = models.DecimalField(max_digits=10, decimal_places=2) quantity = models.IntegerField() views.py: class ProductViewSet(viewsets.ModelViewSet): queryset = Product.objects.prefetch_related('items').all() serializer_class = ProductSerializer filter_backends = [filters.DjangoFilterBackend] filter_class = ProductFilter serializers.py: class ItemSerializer(serializers.ModelSerializer): class Meta: model = Item fields = '__all__' class ProductSerializer(serializers.ModelSerializer): items = ItemSerializer(many=True, read_only=True) class Meta: model = Product fields = '__all__' filters.py: import django_filters as filters class ProductFilter(filters.FilterSet): price = filters.RangeFilter(field_name='items__price') quantity = filters.RangeFilter(field_name='items__quantity') class Meta: model = Product fields = { 'name': ['icontains'], } Filtering on the Product model's fields works fine, but the items reverse relation ignores the filtering completely. I found a "solution" from this answer; ie. do the filtering via a SerializerMethodField: item_fieldset = {'price', 'quantity'} class ProductSerializer(serializers.ModelSerializer): items = serializers.SerializerMethodField('get_items') class Meta: model = Product fields = '__all__' def get_items(self, product): params = self.context['request'].query_params filter_fields = item_fieldset.intersection(set(params)) filters = {field: params.get(field) for field in filter_fields} serializer = ItemSerializer(instance=product.items.filter(**filters), many=True) return serializer.data But this cripples the performance of my app. Is there a better way? -
Slice Django Queryset field value
My object has content field which is actually content of the article. I am passing it to template by using XHR. I don't want to slice content in front end. How can I slice it by giving a maximum character limit? It is very long content so doing it in backend will help me to reduce my JSON size. This is how my JSON looks like. I deleted content because it is very long. It will be in results list. -
NodeJS Grant - Oauth with Django Oauth Toolkit app
I'm working with two servers, one a NodeJS app (FeathersJS and Grant for authentication), and the other is a Django app, using django-oauth-toolkit for authentication. https://github.com/simov/grant https://pypi.org/project/django-oauth-toolkit/ I am trying to get the NodeJS app to oauth with the python django app, so here is what I have done so far: Registered Feathers with Django Oauth toolkit - Configured Feathers/Grant with the following options: "key": "xxx", "authorize_url": "https://www.com/o/authorize", "access_url": "https://www.com/o/token" But I'm running into an issue where the grant workflow is not receiving the access token, and am stuck at this point. Has anyone tried integrating two apps as such and been successful in this process? I'd appreciate any pointers, suggestions. Thanks! -
How to hide 0 notification count in django-notifications-hq
I ham trying to hide the notification count when it's 0 in django-notifications-hq I have tried the below method but it is not updating regularly and displaying the number correctly. {% live_notify_badge as nc %} {% if nc > 0|add:0 %} <span class="badge-notifications badge badge-pill badge-danger" style="float:right;margin-bottom:-3px;margin-top: -2px !important; margin-left: 10px !important; font-size: 0.6rem;"> {% live_notify_badge %}</span> {% endif %} -
Is it possible to make option tag a link or button
I'm trying to trigger modal form using a selection from the dropdown list. In using django. The idea is that use is filling a form. He can make a selection from the dropdown list but if he will not find a required item on the list he can add this item. He would be able to do this filling modal form. Now it is triiger with button. The ideal situation would be if there is a button or link on the dropdown list. Something like bootstrap offers, what is called separated link: html - the dropdown list content <option value="">---------</option> {% for salesPersonDistributor in salesPersonsDistributor %} <option value="{{ salesPersonDistributor.pk }}">{{ salesPersonDistributor.name }}</option> {% endfor %} html - from template <form method="post" id="subsidiaryForm" name="text" data-subsidiaries-url="{% url 'ajax_load_subsiriaies' %}" data-salesPersonsDistributor-url="{% url 'ajax_load_salesPersonsDistributor' %}" data-salesPersonsDistributorContact-url="{% url 'ajax_load_salesPersonsDistributorContact' %}" novalidate> <table class="table table-borderless table-condensed"> {% csrf_token %} {{ form.as_table }} </table> <input type="hidden" name="build" value="{{ VCIUpdate }}">, <input id="submit" type="submit" value="save" /> </form> <div class="modal fade" tabindex="-1" role="dialog" id="modal"> <div class="modal-dialog" role="document"> <div class="modal-content"></div> </div> </div> <button id="new_sales_person_distibutor" class="btn btn-primary" type="button" name="button">Dodaj przedstawiciela</button> </div> jquery $(document).ready(function() { $("#new_sales_person_distibutor").modalForm({ formURL: "{% url 'new_sales_person_distibutor' %}" }); }); I have tried to trigger jquery usung vale if … -
Invalid API Key provided in creating token (Stripe)
How to fix Invalid API Key provided: cus_**** card = stripe.Token.create(customer_id, method) charge = stripe.Charge.create( amount=price, currency='usd', description=desc, receipt_email=request.user.email, source=card ) I've tried adding the account id to Token.create like this: card = stripe.Token.create(stripe_account_id, customer_id, method) but that gives the error Invalid API Key provided: acct_**** and I think that's what I'm supposed to be using so I'm not sure what I'm doing wrong. -
Debugging graphql queries in Django
How can I get my GraphQL API to show more query/post data in the console? I'm running a Django app that is powered by GraphQL and served via a react frontend. With regular Django paths I would see something like this in the development server: [04/Sep/2020 11:53:08] "GET /my_app/2020/09/01/5cc4e7cc-7.png HTTP/1.1" 200 11330 But with GraphQL all I see is this: [04/Sep/2020 11:53:18] "POST /graphql HTTP/1.1" 200 32 [04/Sep/2020 11:53:18] "POST /graphql HTTP/1.1" 200 2993 [04/Sep/2020 11:53:29] "POST /graphql HTTP/1.1" 200 11635 Any ideas? -
What happens if I rename the 'manage.py' in django?
I have changed the 'manage.py' to 'server.py' and it worked. But what I want to know is whether it will work if I host the Django App somewhere ? -
I am geeting error in unit testing of django app
I am geting error "ValueError: Cannot assign "'12A20'": "Attendance.rollno" must be a "Student" instance." how to solve it ?? Is another way for testing when foreign key is present in Django? model.py class Student(models.Model): classId=models.ForeignKey(Class,on_delete=models.CASCADE) name=models.CharField(max_length=20) fatherName=models.CharField(max_length=20) motherName=models.CharField(max_length=20) address=models.TextField(max_length=100) section = models.CharField(max_length=2) prevClass=models.IntegerField() prevClassMark=models.IntegerField() prevResult=models.ImageField(upload_to='images/') gender=models.CharField(max_length=6) image=models.ImageField(upload_to='images/') stream=models.CharField(max_length=10,)#choices=Stream) department=models.CharField(max_length=15) dob=models.CharField(max_length=12) rollno = models.CharField(max_length=10) password=models.CharField(max_length=30) class Attendance(models.Model): rollno=models.ForeignKey(Student,on_delete=models.CASCADE) class_id=models.ForeignKey(Class,on_delete=models.CASCADE) date=models.CharField(max_length=11) status=models.CharField(max_length=7) tests.py class AttendanceTest(TestCase): def setUp(self): Attendance.objects.create( rollno='12A20', class_id=121, date='2020-09-03', status='Present' ) Attendance.objects.create( rollno='13A20', class_id=121, date='2020-09-03', status='Present' ) def test_Attendance(self): qs=Attendance.objects.all() self.assertEqual(qs.count(),2) -
How to pass query sets from html to views.py in django using AJAX
I am new to Django.So here, I am trying to pass a two query sets from Django html template to Django views.py. This has to happen on the click of a button and hence, I am using onClick function to pass the parameters to Ajax and from there, I am sending it to views.Here, along with the two query sets, I am passing two other values called rid and category and it is working fine,but the query sets are getting converted to string and hence I am not able to iterate through the query sets after passing it to the views.py page. This is my views.py code: if request.is_ajax(): rid = request.POST.get('rid') category = request.POST.get('category') extracted_records=request.POST.get('extracted_records') show_cards_records=request.POST.get('show_cards_records') return render(request,'cards_update.html',{'extracted_records':extracted_records,'show_cards_records':show_cards_records,'rid':rid}) return render(request,'cardpage.html',{'extracted_records':extracted_records,'show_cards_records':show_cards_records,'rid':'1234'}) This is my main html code: <!-- templates/base.html --> {% load static %} <!DOCTYPE html> <html lang="en" dir="ltr"> <head > <meta charset="utf-8"> <title>CardGame</title> <link rel="stylesheet" href="/static/css/cardpage.css"}> </head> <body> <center> <h1>{{rid}}</h1> <div id='update_cards'> {% include 'cards_update.html' %} </div> </center> </form> </body> <script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js" type = "text/javascript" charset = "utf-8"></script> <script> function func(rid,category,extracted_records,show_cards_records) { $.ajax({ type: 'POST', url: '/Cardpage', data:{ 'rid':rid, 'category':category, 'extracted_records':extracted_records, 'show_cards_records':show_cards_records, }, success: function (response) { $("#update_cards").replaceWith(response); alert("card casted."); } }); } </script> </html> This is … -
How do I displaya list of dictionary of dictionaries in django template?
Here the dictionary employee contains the list of the dictionary. "Emp": [ { "info": [ { "name": john Patrik, "emp_id": "20021", "salary": 3000 "interest":[{"fav_song":"happy_song"}, {"fav_city":"newyork","fav_place":"centralPark"}] }] }] -
Python django threading and dictionary
Hello I'm running django server that fetch some large chunks of data from database and printing it on view as json but this is rather slow, so I thought about using threading to speed up this code and it somewhat worked but still it is quite slow. This my first attempt to use concurrent.futures module so some of my solution are probably ugly. def chartData(request): fixm = datetime.min.time() fixd = datetime.max.time() datee = datetime.date(datetime.now()) dateo = datee - timedelta(days=1) dateo = datetime.combine(dateo, fixm) datee = datetime.combine(datee, fixd) resultproc = {} s1 = S280000020E3120.objects.filter().values('date', 'temprature') s2 = S280119514568Ff.objects.filter().values('date', 'temprature') s3 = S2801195146F4Ff.objects.filter().values('date', 'temprature') s4 = S28011951743Bff.objects.filter().values('date', 'temprature') s5 = S285A1993D983Ff.objects.filter().values('date', 'temprature') s6 = S285A1993Ed66Ff.objects.filter().values('date', 'temprature') s7 = S285A1993F99Fff.objects.filter().values('date', 'temprature') s8 = S280119514D1Eff.objects.filter().values('date', 'temprature') s9 = max31856.objects.filter().values('date', 'temprature') s = [s1, s2, s3, s4, s5, s6, s7, s8, s9] nr = ["1", "2", "3", "4", "5", "6", "7", "8", "9"] resultpr = [resultproc, resultproc, resultproc, resultproc, resultproc, resultproc, resultproc, resultproc, resultproc] # I know this is ugly but I don't know how to properly use it with .map start_time = time.time() with concurrent.futures.ThreadPoolExecutor() as executor: resultproc = executor.map(constructChartData,resultpr, s, nr) print("Thread: ", (time.time() - start_time)) result = { 'ds1':[ list(s1), S280000020E3120.objects.last().sensor.description, ], … -
JavaScript from static is not functioning in my templates while working in django(jinja)
base.html file This is where jinja is used and all js is linked, i have created a partial file of navigation and footer and the problem is in navigation part {% load static %} {% load staticfiles %} <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" /> <meta name="description" content="" /> <meta name="author" content="" /> <title>Home</title> <!-- Favicon--> <link rel="icon" type="image/x-icon" href="{% static 'assets/img/favicon.ico'%}" /> <!-- Font Awesome icons (free version)--> <script src="https://use.fontawesome.com/releases/v5.13.0/js/all.js" crossorigin="anonymous"></script> <!-- Google fonts--> <link href="{% static 'https://fonts.googleapis.com/css?family=Merriweather+Sans:400,700'%}" rel="stylesheet" /> <link href="{% static 'https://fonts.googleapis.com/css?family=Merriweather:400,300,300italic,400italic,700,700italic'%}" rel="stylesheet" type="text/css" /> <!-- Third party plugin CSS--> <link href="{% static 'https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/magnific-popup.min.css'%}" rel="stylesheet" /> <!-- Core theme CSS (includes Bootstrap)--> <link href="{% static 'css/styles.css'%}" rel="stylesheet" /> </head> <body id="page-top"> <!-- Navigation--> {% include 'partials/_navigation.html' %} <!-- Navigation--> <!--content--> {% block content %} {% endblock %} <!--content--> <!-- Footer--> {% include 'partials/_footer.html' %} <!-- Footer--> <!-- Bootstrap core JS--> <script src="{% static 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js'%}"></script> <script src="{% static 'https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.bundle.min.js'%}"></script> <!-- Third party plugin JS--> <script src="{% static 'https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.4.1/jquery.easing.min.js'%}"></script> <script src="{% static 'https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/jquery.magnific-popup.min.js'%}"></script> <!-- Core theme JS--> <script src="{% static 'js/scripts.js'%}"></script> </body> </html> Settings: This is the settings part giving static a path STATIC_URL = '/static/' #Manually Done STATICFILES_LOCATION = 'static' STATIC_URL='/static/' …