Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Make django ModelForm required False?
I am using Django to develop my site, and let's say that I have a tabbed template that has two specific ModelForm that I want to make it required False if user does't fill the data in the form but if user fill some fields the form must be checked if it is valid or not. Note: the user can fill one form and leave the other but when use start to fill the other form it must be checked if its valid or not. My Template <section class="{{ document.form_flexbox|default:" col-lg-12 " }} connectedSortable hidden"> <!-- form input card--> <form {% if form.is_multipart or formset.is_multipart %} enctype="multipart/form-data" {% endif %} action="{{ name_space }}" method="post" id="baseFormInput"> <div class="card card-primary card-outline"> <div class="card-header"> <h3 class="card-title"> <i class="fas fa-keyboard mr-1"></i> {{ document.title_form }} </h3> <div class="card-tools"> <!-- <button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#modal-permission" title="Date range"> {% trans 'Object Permissions' %} <i class="fas fa-lock"></i> </button> --> <button type="button" class="btn btn-tool" data-card-widget="collapse"> <i class="fas fa-minus"></i> </button> </div> </div> <!-- /.card-header --> <div class="card-body"> <ul class="nav nav-tabs" id="custom-tabs-three-tab" role="tablist"> <li class="nav-item" role="presentation"> <a class="nav-link active" id="home-tab" data-toggle="tab" href="#custom-tabs-three-home" role="tab" aria-controls="home" aria-selected="true">Move Order</a> </li> <li class="nav-item" role="presentation"> <a class="nav-link" id="profile-tab" data-toggle="tab" href="#custom-tabs-three-store" role="tab" aria-controls="profile" aria-selected="false">Exchange Store</a> … -
ModuleNotFoundError: No module named 'crispy_formsdjango'
Very green here. I am getting this error when I try to migrate: ModuleNotFoundError: No module named 'crispy_formsdjango' Part of me thinks there is some typo because of the formatting 'crispy_formsdjango', but I have no idea where that would be. settings.py: INSTALLED_APPS = [ 'blog.apps.BlogConfig', 'users.apps.UsersConfig', 'crispy_forms' 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', ] Installation: (venv) C:\Users\zacha\PycharmProjects\django1\django1>pip install django-crispy-forms Requirement already satisfied: django-crispy-forms in c:\users\zacha\pycharmprojects\django1\venv\lib\site-packages (1.11.2) No idea if this is helpful.. when attempting to runserver I receive this error: OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: '<frozen importlib._bootstrap>' I'm feeling like this migrate is higher upstream then this error, but its what I tracked back to here from. Thanks! -
gunicorn service is not starting even with all configuration files are correct
gunicorn service is not starting even though i configured everything correctly its not working please take a look on my directory structure directory structure This is my service file [Unit] Description=gunicorn daemon Requires=gunicorn.socket After=network.target [Service] User=developer Group=www-data WorkingDirectory=/home/developer/myprojectdir ExecStart=/home/developer/myprojectdir/myprojectenv/bin/gunicorn \ --access-logfile - \ --workers 3 \ --bind unix:/run/gunicorn.sock \ bharathwajan.wsgi:application [Install] WantedBy=multi-user.target This is my socket file [Unit] Description=gunicorn socket [Socket] ListenStream=/run/gunicorn.sock [Install] WantedBy=sockets.target when i try to check the logs of gunicorn using 'sudo journelctl -u gunicorn' its showing me no module named myproject.wsgi (here myproject is bharathwajan) ModuleNotFoundError: No module named 'bharathwajan.wsgi' Jun 02 11:06:36 ubuntu-s-1vcpu-1gb-blr1-01 gunicorn[195812]: [2021-06-02 11:06:35 +0000] [195812] [INFO] Booting worker with pid: 195812 Jun 02 11:06:36 ubuntu-s-1vcpu-1gb-blr1-01 gunicorn[195811]: [2021-06-02 11:06:36 +0000] [195811] [INFO] Worker exiting (pid: 195811) Jun 02 11:06:36 ubuntu-s-1vcpu-1gb-blr1-01 gunicorn[195813]: [2021-06-02 11:06:36 +0000] [195813] [INFO] Booting worker with pid: 195813 Jun 02 11:06:36 ubuntu-s-1vcpu-1gb-blr1-01 gunicorn[195812]: [2021-06-02 11:06:36 +0000] [195812] [ERROR] Exception in worker process Jun 02 11:06:36 ubuntu-s-1vcpu-1gb-blr1-01 gunicorn[195812]: Traceback (most recent call last): Jun 02 11:06:36 ubuntu-s-1vcpu-1gb-blr1-01 gunicorn[195812]: File "/home/bharathwajan/bharathwajan/django/lib/python3.8/site-packages/gunicorn/arbiter.py",> Jun 02 11:06:36 ubuntu-s-1vcpu-1gb-blr1-01 gunicorn[195812]: worker.init_process() Jun 02 11:06:36 ubuntu-s-1vcpu-1gb-blr1-01 gunicorn[195812]: File "/home/bharathwajan/bharathwajan/django/lib/python3.8/site-packages/gunicorn/workers/base> Jun 02 11:06:36 ubuntu-s-1vcpu-1gb-blr1-01 gunicorn[195812]: self.load_wsgi() Jun 02 11:06:36 ubuntu-s-1vcpu-1gb-blr1-01 gunicorn[195812]: File "/home/bharathwajan/bharathwajan/django/lib/python3.8/site-packages/gunicorn/workers/base> Jun 02 11:06:36 ubuntu-s-1vcpu-1gb-blr1-01 gunicorn[195812]: … -
Accessing all children from different apps of abstract base class in django
I'm trying to access all Child classes including their data from all the apps in this project which are inherited from an abstract class and show it in Django Admin panel.From this admin panel one can view and edit the data and changes will be reflected globally in this project. How it can be done ? Thanks in advance -
Django from is not loading
I have created a Django form and I am trying to load it in a HTML page . But unfortunately its not working. It's just showing the submit button which i have added manually.I have tried everything bt nothing seems working. Here are my files. views.py from home.models import Details, Image_Data from django.shortcuts import render, redirect from django.shortcuts import render, redirect from datetime import datetime from django.contrib import messages from .forms import DetailsForm def register_new(request): form = DetailsForm return render(request, 'register1.html', {'form': form}) register_new.html {% extends 'base.html'%} {% block title %}Register1{% endblock title %} {% block body %} <div class="container my-3" > <h1 class="display-3" align="center">Register Here</h1> <br> <h1 class="display-6" >STEP 1: </h1> <form action="" method="post"> {% csrf_token %} {{ from.as_p }} <input type="Submit" value="Save" class = "btn btn-secondary" style="background: #0a9396"> </form> </div> {% endblock body %} forms.py from django import forms from django.forms import ModelForm from .models import Details, Image_Data class DetailsForm(ModelForm): class meta: model = Details fields = ('name', 'username', 'password', 'email') # tupple name = forms.CharField(label='Your name', max_length=100) username = forms.CharField(max_length=100) models.py class Details(models.Model): name = models.CharField(max_length=122) username = models.CharField(max_length=122) email = models.EmailField(max_length=122) password = models.CharField(max_length=20) date = models.DateField() def __str__(self): return self.name urls.py urlpatterns = [ path("register_new", … -
Error when getting the value of a field with type OneToOneField
I encountered a problem that I can't get the value of a field with type OneToOneField. I am linking 2 models using Tabularinline. And I want to get the value from the linked model when I create the object. I am trying to use signals, namely post_save. When I save I get this error: "Servers has no info". How can I get info object when creating Servers object or after creating it? class Servers(models.Model): name = models.CharField(max_length=120) class ServerInfo(models.Model): info = models.TextField() server = models.OneToOneField(Servers, on_delete=models.CASCADE, related_name="info") @receiver(post_save, sender = Servers) def create_server2(instance, sender, **kwargs): print(instance.info) -
How to build a HttpResponse containing a file in Django to a jquery request?
I am making a request to a django server with the $.post method- $.post('/merger/merge/', JSON.stringify(mergeList), function(data, status, jqXHR) { console.log('inside'); var a = document.createElement('a'); a.href = window.URL.createObjectURL(data); a.download = "merged-pdf.pdf"; a.style.display = "none"; document.body.appendChild(a); a.click(); document.body.removeChild(a); }, 'application/octet-stream' ); mergeList is an array with filenames. This is the code that returns the file- viewresponse = HttpResponse(open("merged.pdf", "rb").read(), content_type = "application/octet-stream", status=200) viewresponse['Content-Disposition'] = "attachment; filename=\"merged.pdf\"" return viewresponse However the methods fails with the folowing error- parsererror No conversion from text to application/octet-stream How do I fix this error? -
store UUID in session using middleware
I want to tag all requests with a UUID (if the request doesn't have it in the first place). I want to store the UUID in the session, so I wrote this middleware. class MachineIDMiddleware: """ tags requests with machine UUIDs. The machine-ID is set in the session. """ MID_KEY = "machine_id" def __init__(self, get_response): self.get_response = get_response def __call__(self, request): print(request.session.get(self.MID_KEY)) if self.MID_KEY not in request.session: # set the machine-ID for the request # if it has not been set already (making # sure that it is serializable). next_id = str(uuid.uuid4()) request.session[self.MID_KEY] = next_id return self.get_response(request) However, from my client, I noticed that the UUID keeps changing for every request. From my client, I noticed that the sessionid cookie also changed for every request made. As a result, a new UUID was generated for every request. This is not what I want, though. I want to maintain only one UUID per person (who might be anonymous). How can I achieve this? Thanks a lot! -
How do I login into the admin page if I disable password?
I am making a passwordless app (using token auth from DRF so login using email otp, social auth etc) so my user model has password = none. class User(AbstractUser): email = models.EmailField(verbose_name='email', unique=True, blank=False, max_length=60) username = models.CharField( verbose_name='username', blank=False, unique=True, max_length=20) first_name = models.CharField( verbose_name='first name', blank=False, unique=False, max_length=20) last_name = models.CharField( verbose_name='last name', blank=False, unique=False, max_length=20) password = None Now how do login in the admin page because it requires a password -
I want to implement file management in django
In django, I want to create a folder for each user, and allow users to create folders with arbitrary names, and upload and download csv and pdf to the created folders. I know how to do the upload and download, but I don't know how to create a folder for each user, and how to create a folder with a user's arbitrary name. -
AttributeError: 'str' object has no attribute 'values' on webpage and Broken pipe from ('192.168.11.11', 50642)
1.python version 3.9.0 django version 3.2.4. 2.getting error AttributeError: 'str' object has no attribute 'values' to client. while on terminal i get error Broken pipe from ('192.168.11.11', 50642). i am not able to use even simple serializers. -
Django DEBUG=False won't upload files to STATIC_ROOT
I'm trying to give the user the ability to upload images on a website I created with Django and the images are uploaded fine when running with DEBIG=True but the issue is that when DEBUG=False the image files doesn't upload to the STATIC_ROOT instead it gets uploaded to STATIC_DIRS. Also, even the files that are already in STATIC_ROOT after executing python manage.py collectstatic aren't loaded to the template and the image URL gives the 404 Page Not Found error. The CSS and JS files are still served so it means only the media url isn't working. Following are the codes I'm using. urls.py urlpatterns = [ path('admin/', admin.site.urls), path('', include('Home.urls')), path('account/', include('Account.urls')), ] urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) settings.py STATIC_URL = '/static/' STATICFILES_DIRS = ( os.path.join(BASE_DIR, 'static'), ) STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'static') STATICFILES_STORAGE = 'whitenoise.storage.CompressedStaticFilesStorage' Note that I'm using whitenoise as the storage backend. Here is the model code that is used to upload the file. @deconstructible class PathAndRename(object): def __init__(self, sub_path): self.path = sub_path def __call__(self, instance, filename): ext = filename.split('.')[-1] filename = '{}.{}'.format(uuid4().hex, ext) return os.path.join(self.path, filename) rename_pp = PathAndRename('img/profile-pictures') class Profile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE, null=True, blank=True) … -
Cannot get blog listing using get_context to work properly
I am trying to make a blog listing page using wagtail 2.13 but only managed to get {{ post.date }} and {{ post.url }} parts working. {{ post.heading }} and {{ post.standfirst }} do not appear. I tried some permutations like {{ post.heading }} {{ post.content.heading }} {{ post.block.heading }} but they did not work. What would be the correct {{ }} query to use here? Image of partially working listing #models.py from django.db import models from wagtail.core.models import Page from wagtail.core.fields import StreamField from wagtail.core import blocks from wagtail.admin.edit_handlers import FieldPanel, StreamFieldPanel from wagtail.images.blocks import ImageChooserBlock richtext_features = [ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', "ol", "ul", "hr", "link", "document-link", "image", "embed", "code", "blockquote", "superscript", "subscript", "strikethrough", ] class BlogListingPage(Page): """Listing page lists all the Blog pages.""" template = "home/home_page.html" custom_title = models.CharField( max_length=255, blank=False, null=False, help_text='Overwrites the default title', ) content_panels = Page.content_panels + [ FieldPanel("custom_title"), ] def get_context(self, request, *args, **kwargs): """Adding custom stuff to our context.""" context = super().get_context(request, *args, **kwargs) context["posts"] = BlogPage.objects.live().public().order_by('-date') return context class BlogPage(Page): """ For individual blog pages.""" author = models.CharField(max_length=255, default="Niq") date = models.DateField("Post date") content = StreamField([ ('heading', blocks.CharBlock(form_classname="full title")), ('standfirst', blocks.CharBlock()), ('paragraph', blocks.RichTextBlock(features=richtext_features)), ('image', ImageChooserBlock()), ], block_counts={ 'heading': … -
How to create two templates in django for the same applicaton?
Good afternoon community, I am new to developing and I am working on a personal project in order to practice and get experience. The URL path for my project is: http://127.0.0.1:8000/simple_investing/ simple_investing is a static html template and I would like to add another template name concepts (http://127.0.0.1:8000/simple_investing/concepts). The first part (simple_investing) works, but concepts does not. Hereunder is my code: simple_investing urls.py urlpatterns = [ path('', TemplateView.as_view(template_name='simple_investing/main.htm')), path('', TemplateView.as_view(template_name='simple_investing/concepts.htm') mysite urls.py path('simple_investing/', include('simple_investing.urls')), I get the following error 404: The current path, simple_investing/concepts, didn’t match any of these. Any hints as to how can I solve this. -
Failed SPOTIFY web api authorization with django after heroku deployment
I have been trying to create a FULL STACK web application, having REACT in the frontend and Django in the backend for the purpose of learning the usages of SPOTIFY WEB API. I am able to authenticate users through SPOTIFY WEB API in the localhost, but facing an error of "Illegal redirect_uri" on the browser after deploying to Heroku. I am unable to find any solution for this, kindly if anyone can provide me any assistance with this. I have cross-checked multiple times whether I have done any typo with the REDIRECT_URI but it's fine This is my settings.py configuration while deploying to heroku import os from pathlib import Path from decouple import config # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = os.environ['SECRET_KEY'] # SECURITY WARNING: don't run with debug turned on in production! DEBUG = os.environ['DEBUG'] ALLOWED_HOSTS = ['127.0.0.1', 'accounts.spotify.com/authorize', 'djangodemo-bandha.herokuapp.com'] # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'corsheaders', 'rest_framework', 'spotify' ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'whitenoise.middleware.WhiteNoiseMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'corsheaders.middleware.CorsMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', … -
django query get extra data with annotate
Assuming it is a system with user's balance and there is a model Record to record balance history class Record(models.Model): ... created_at = models.DatetimeField(auto_now_add=True) previous_value = models.IntegerField(default=0) value_change = models.IntegerField() ''' And then the list view is like Now it's required to have options to make it group by day, as: The question is: How to get the Final Balance of the Day? Current Code is only providing the change but not the balance. qs = Record.objects.order_by('-created_at').values('created_at__date').annotate(day_change=Sum('change')) -
Get related model instance within template
I've got two related models: class Event(models.Model): title = models.CharField(max_length=100) start_time = models.DateTimeField() class EmployeeJob(models.Model): event = models.ForeignKey(Event, on_delete=models.CASCADE, null=True, blank=True) employee = models.CharField(max_length=100) Then, within my template, I loop through all my events. Within each loop, I want to see if there is an EmployeeJob associated with the event and if so, print the employee's name. This isn't working, however {% for events in events %} {% elif employeejob.event_set.first %} {{employeejob.event_set.first.employee}} {% endif %} {% endif %} Thanks for your help!! -
Django: how to filter a query based on one of the objects?
I have a model: class PantryHours(models.Model): DAYS = { ('Sunday', 'Sunday'), ('Monday', 'Monday'), ('Tuesday', 'Tuesday'), ('Wednesday', 'Wednesday'), ('Thursday', 'Thursday'), ('Friday', 'Friday'), ('Saturday', 'Saturday') } day_of_week = models.CharField(max_length=20, choices=DAYS, null=True, blank=True) pantry_start_time = models.TimeField(blank=True,null=True) pantry_end_time = models.TimeField() clients_allowed = models.IntegerField() spots_remaining = models.IntegerField(default=0) I want to filter the results based on this: current time < (pantry_start_time - (pantry_end_time - pantry_start_time)) so it would be something like: current_time = datetime.datetime.now() PantryHours.objects.filter(pantry_start_time=(current_time__gte =(pantry_start_time - (pantry_end_time - pantry_start_time)) However, I need the pantry_start_time and pantry_end_time of each instance and do math with it. What's the best way to do this for each instance? -
DJANGO 3.1 'crispy_forms_tags' is not a registered tag library
I'm stuck on this and its driving me crazy. I installed django-crispy-forms and added it in the settings.INSTALLED_APPS. Also, I had installed the django-crispy-forms in my virtual environment then freeze on my requirements.txt. Any help would be great. settings.py INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.Contrib. staticfiles', 'crispy_forms', 'leads', 'tailwind', 'them', 'bootstrap4', client_form.py {% extends "crm/base.html" %} {% load crispy_forms_tags %} {% block content %} <h3> {% if client %} <b>Client: </b> {{ client.name }} {% else %} <b>New Client</b> {% endif %} </h3> <form method="POST" class="uniForm"> {% csrf_token %} <div class="row"> <div class="form-control"> {{form.name|as_crispy_field}} </div> </div> <div class="row"> <div class="col-md-5"> {{form.address|as_crispy_field}} </div> <div class="col-md-5"> {{form.remarks|as_crispy_field}} </div> </div> <button class="btn btn-lg btn-warning" type="submit">Update</button> </form> {% endblock content %} -
How have django async views changed in 3.2?
I've been learning how to use django for the past few weeks, and was looking into async view tutorials to try to see how they worked. I was watching one by Pyplane and noticed that the code no longer ran asynchronously. I looked into the documentation a bit more and it seemed like what he showed should have worked. I also tried hard coding it with asyncio and it gave me a SynchronousOnlyOperation error. Does anyone know a fix? Thanks in advance! views.py from django.http import HttpResponse from asgiref.sync import sync_to_async, async_to_sync import asyncio import time from movies.models import Movie from stories.models import Story # Utils def get_movies(): print("Prepare to get the movies") time.sleep(2) qs = Movie.objects.all() print(qs) print("All movies retrieved") def get_stories(): print("Prepare to get the stories") time.sleep(5) qs = Story.objects.all() print(qs) print("All stories retrieved") @sync_to_async def get_movies_async(): print("Prepare to get the movies") time.sleep(2) qs = Movie.objects.all() print(qs) print("All movies retrieved") @sync_to_async def get_stories_async(): print("Prepare to get the stories") time.sleep(5) qs = Story.objects.all() print(qs) print("All stories retrieved") # Views def home_view(request): return HttpResponse('<h1>Hello, World!</h1>') def main_view(request): start_time = time.time() get_movies() get_stories() total_time = time.time() - start_time print(f"Sync Execution time: {total_time} second(s)") return HttpResponse('<h1>Sync</h1>') async def main_view_async(request): start_time = time.time() … -
How to display error messages for multiple forms, including formsets?
Say I'm rendering a template that has multiple forms on it. The one im having issue with at the moment, I am rendering a modelform, and a formset. return render(request, "dansapp/backtest.html", { "form": form, "formset": formset }) Both forms have custom clean() methods too, just for the record. In my layout.html, I have the run of the mill code for displaying any and all form errors. It works like a charm, so long as I am rendering a template with a SINGLE form called "form". In my case, with multiple forms, how would I do with without repeating a ludicrous amount of code in my layout? It makes it even worse, because in formsets, you get a list of forms to check (I think). I also need to check the non-error fields for my custom clean() methods. {% for field in form %} {% for error in field.errors %} <div class="alert alert-danger alert-dismissible sticky-top fade show" role="alert"> <strong>{{ field.label }}:</strong> {{ error }} <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button> </div> {% endfor %} {% endfor %} {% for error in form.non_field_errors %} <div class="alert alert-danger alert-dismissible sticky-top fade show" role="alert"> <strong>Validation error:</strong> {{ error }} <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button> </div> … -
python, django: it does not show the price on price_details.html but there is no error message
On website home page User select the airport, suburb and passenger. after that, views.py do function to calcaulate the price with that information. but the price does not appear on price_detail.html here are the codes at views.py def price_detail(request): if request.method == "POST": airport = request.POST.get('airport') suburb = request.POST.get('suburb') passenger = request.POST.get('passenger') data = { 'airport': airport, 'suburb': suburb, 'passenger': passenger, } def price_cal(): if airport == 'To airport': return int(suburbs.get(suburb)) + (int(passenger) * 10) - 10 elif airport == 'From airport': return int(suburb.get(suburb)) + (int(passenger) * 10) return render(request, 'basecamp/price_detail.html', {'price_cal()': price_cal() }, ) else: return render(request, 'basecamp/price_detail.html', {}) I do not know what was wrong... please don't telll me to do django tutorial again... I am new and beginner... that's why I ask quesitons here. Thank you in advance -
How is DRF auth token received in a real world web application
This question might look stupid but I want to get some clarification. I'm building a Django rest framework application for the very first time. I'm able to set up api endpoints for the application. And when I register a user he gets a token. And when I login a user through postman it returns a token. But in real world app, how does the client receive that drf token that is return as json data that is needed to login. Does he receive it in his email that he used to register? Also, if the user recieves the token, am I supposed to create another API to contain the field that the user eventually sends the token through before gaining access to the website? Please I would appreciate it if I also get a good material that explains the process in details and uncomplicated. -
I want to use `django` to do something like the `Github` repository
I want to use django to do something like the Github repository, but I don't know how to do it. -
Problem loading bootstrap-v5 Javascript with Django
I am currently learning Django and bootstrap, and I wanted to test some dropdown features. I looked for a while in my html code seeking for errors but apparently, the problem comes from the javascript and popper libraries of bootstrap that won't load properly. When i'm making a dropdown menu, the dropdown button is displayed, but nothing happens when I click on it. Same for all the features of bootstrap requiring JS such as alerts, toasts.. But strangely, carrousels, for which the docs indicates also they require Javascript, work properly. It doesn't matter how I try to load the JS files, it never works. I tried to load the JS and Popper separately, by including these two lines just before the closing tag : <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.min.js" integrity="sha384-Atwg2Pkwv9vp0ygtn1JAojH0nYbwNJLPhwyoVbhoPwBhjQPR5VtM2+xf0Uwh9KtT" crossorigin="anonymous"></script> </body> I also tried the bundle : <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-gtEjrD/SeCtmISkJkNUaaKMoLD0//ElJ19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4" crossorigin="anonymous"></script> </body> It never worked so I downloaded the bundle and tried to load it this way : <script src="{% static 'js/bootstrap.bundle.js' %}"></script> This doesn't work either. When I place a test.js in the same folder with some junk inside like document.write("test"), I can see than the file is loaded properly. Also, the chrome console doesn't show any …