Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Invisible field of AbstractUser - Django, models.py
I use the first time class AbstractUser in Django 3+. Therefore, I create my custom user model with an obligatory field test from django.db import models from django.contrib.auth.models import AbstractUser class CustomUser(AbstractUser): test = models.CharField(max_length=100) def __str__(self): return self.email then it modifies my settings.py file ... AUTH_USER_MODEL = 'app.CustomUser' ... I create migrations, next I login in to django admin and my field is still not visible. How to add a test field to my user so that it is always required and visible in Django / admin. Any help will be appreciated. My admin.py class CustomUserAdmin(UserAdmin): add_form = CustomUserCreationForm form = CustomUserChangeForm model = CustomUser list_display = ['email', 'username', 'test'] My forms.py class CustomUserCreationForm(UserCreationForm): class Meta(UserCreationForm): model = CustomUser fields = ('username', 'email', 'test') class CustomUserChangeForm(UserChangeForm): class Meta: model = CustomUser fields = ('username', 'email', 'test') admin.site.register(CustomUser, CustomUserAdmin) -
ListAPIView is returning Page Not Found 404 as error instead of results
I have a django rest framework application and I am want to add a list view for a specific url. When I go to the url and expect a list of results, I get alist of the urls for my project and a 404 message with page not found. this is the list view i have in views: class UserHasPreferenceView(ListAPIView): serializer_class = PreferenceSerializer permission_classes = [IsAuthenticated] def get_queryset(self): namespace = self.kwargs.get('namespace', None) path = self.kwargs.get('path', None) filter_id = self.request.query_params.get('filter_id') if namespace and path and filter_id: queryset = Preference.objects.all().filter( person=filter_id, namespace=namespace, path=path) elif namespace and path and filter_id is None: queryset = Preference.objects.all().filter( person=self.request.user.id, namespace=namespace, path=path ) elif namespace and path is None and filter_id: queryset = Preference.objects.all().filter( person=filter_id, namespace=namespace ) elif namespace and path is None and filter_id is None: queryset = Preference.objects.all().filter( person=self.request.user.id, namespace=namespace ) elif namespace is None and path is None and filter_id: queryset = Preference.objects.all().filter( person=filter_id ) elif namespace is None and path is None and filter_id is None: queryset = Preference.objects.all().filter( person=self.request.user.id ) else: return None return queryset this is the urls user_has_preference = UserHasPreferenceView.as_view() path('person/has-preference/<str:namespace>/<str:path>/', user_has_preference, name='preferences-path'), this is the error i am getting: Page not found (404) Request Method: GET Request URL: http://127.0.0.1:8000/api/v2/person/has-preference/ -
How to import a function or a class outside django project to it?
I have a project with core module which contains my classes and function s and a rest API using django, I want to import core files inside django but I couldn't. the project structure is the following: app - core -manager - rest-api -api(django) Thanks -
Django Search Results Pop Up
The below code should return a user if the user exists. Can I use is_authenticated or is there a better way? <li class="dropdown-hover"> <form class="form-inline"> {% include "tweets/search_form.html" %} </form> {% if user in request.GET.q.is_authenticated %} <div class="dropdown-content x-card-4 x-bar-block" style="width:300px"> <a href='{{ request.GET.q }}'>{{ request.GET.q }}</a><br/> {% else %} <div class="dropdown-content x-card-4 x-bar-block" style="width:300px"> <a href='#'>No users found</a><br/> {% endif %} </li> Thank you for any help -
Why won't RadioSelect buttons appear in my browser when using the relevant widget in Django ModelForms?
I have been using Django ModelForms in an attempt to display a number of fields as radio buttons. However, after following the guidance in Django Docs regarding the RadioSelect widget, no radio buttons are displaying in the browser. Can anybody explain why? I have followed the instructions as set out in the Django Docs (https://docs.djangoproject.com/en/2.2/ref/forms/widgets/#radioselect). The relevant code is detailed below: class ReviewForm(forms.ModelForm): class Meta: model = Review fields = ['subject', 'feedback', 'mentorship', 'hiring', 'community'] class RawReviewForm(forms.Form): RATINGS = ( ('1', '1'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), ) subject = forms.CharField(label='') feedback = forms.CharField(widget=forms.Textarea) mentorship = forms.ChoiceField(widget=forms.RadioSelect(choices=RATINGS)) hiring = forms.ChoiceField(widget=forms.RadioSelect(choices=RATINGS)) community = forms.ChoiceField(widget=forms.RadioSelect(choices=RATINGS)) ``` My view def review_create(request): review_form = RawReviewForm() if request.method == 'POST': review_form = RawReviewForm(request.POST) if review_form.is_valid(): review_form.save() Review.objects.create(**review_form.cleaned_data) return redirect(reviews) context = { 'form': review_form } return render(request, 'reviews/review_form.html', context) ``` My form template <form method="POST"> {% csrf_token %} <fieldset class="form-group"> <legend>Leave A Review</legend> {{ form.as_p }} {% for radio in form.mentorship %} <div class="myradio"> {{ radio }} </div> {% endfor %} {% for radio in form.hiring %} <div class="myradio"> {{ radio }} </div> {% endfor %} {% for radio in form.community %} <div class="myradio"> {{ radio }} </div> {% endfor %} </fieldset> … -
Django - Filter related objects by through field
I have the following models class User(models.Model): ... following = models.ManyToManyField('self', blank=True, through='relationships.Relationship', symmetrical=False, related_name='followers') class Relationship(models.Model): from_user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name='from_user') to_user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name='to_user') status = models.CharField(max_length=255, default=RelationshipStatus.ACCEPTED.value, choices=[(state.value, state.name) for state in RelationshipStatus]) class RelationshipStatus(Enum): ACCEPTED = 'accepted' PENDING = 'pending' REJECTED = 'rejected' I would like to get the followers of a given user, but only the ones that have an approved relationship. This is easy with the following query. Relationship.objects.filter(to_user=a_user, status=RelationshipStatus.ACCEPTED.value) But my question is, how can I do it by using the followers attribute of my user? If I do a_user.followers.all() I get them all, but I only want the ones with an accepted relationship. Those won't work a_user.followers.filter(status=RelationshipStatus.ACCEPTED.value) or a_user.followers.filter(relationship__status=RelationshipStatus.ACCEPTED.value) since the following exception are raised django.core.exceptions.FieldError: Cannot resolve keyword 'relationship' into field. django.core.exceptions.FieldError: Cannot resolve keyword 'status' into field. -
Django making a many post requests to a another webapp always cancelled
I creating a website (for practice only) that allows user to check the Name of their favorite artists and my website will show details about that artists I created a form with textarea and once the user Submit all their favorite artist ( POST Requests to other path of my webapp ), It cancelled and return a error on terminal This is the error Traceback (most recent call last): File "F:\Python\lib\wsgiref\handlers.py", line 138, in run self.finish_response() File "F:\Python\lib\wsgiref\handlers.py", line 180, in finish_response self.write(data) File "F:\Python\lib\wsgiref\handlers.py", line 274, in write self.send_headers() File "F:\Python\lib\wsgiref\handlers.py", line 332, in send_headers self.send_preamble() File "F:\Python\lib\wsgiref\handlers.py", line 255, in send_preamble ('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1') File "F:\Python\lib\wsgiref\handlers.py", line 453, in _write result = self.stdout.write(data) File "F:\Python\lib\socketserver.py", line 799, in write self._sock.sendall(b) ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine [24/Jul/2019 00:18:58] "POST /knowers/parser HTTP/1.1" 200 322 Traceback (most recent call last): File "F:\Python\lib\wsgiref\handlers.py", line 138, in run self.finish_response() File "F:\Python\lib\wsgiref\handlers.py", line 180, in finish_response self.write(data) File "F:\Python\lib\wsgiref\handlers.py", line 274, in write self.send_headers() File "F:\Python\lib\wsgiref\handlers.py", line 332, in send_headers self.send_preamble() File "F:\Python\lib\wsgiref\handlers.py", line 255, in send_preamble ('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1') File "F:\Python\lib\wsgiref\handlers.py", line 453, in _write result = self.stdout.write(data) File "F:\Python\lib\socketserver.py", line … -
Django - obtaining a child model from a parent by the childs one to one field?
Good Afternoon, I have a pair of models like the below: class DeviceCircuitSubnets(models.Model): device = models.ForeignKey(Device, on_delete=models.CASCADE) circuit = models.ForeignKey(Circuit, on_delete=models.CASCADE, blank=True, null=True) subnet = models.ForeignKey(Subnet, on_delete=models.CASCADE) ... class BGPData(models.Model): device_circuit_subnet = models.OneToOneField(DeviceCircuitSubnets, verbose_name="Device", on_delete=models.CASCADE) bgp_peer_as = models.CharField(max_length=20, verbose_name='BGP Peer AS', blank=True, null=True) bgp_session = models.CharField(max_length=10, verbose_name='BGP Session', blank=True, null=True) bgp_routes = models.CharField(max_length=10, verbose_name='BGP Routes Received', blank=True, null=True) service_status = models.CharField(max_length=10, verbose_name='Service Status', blank=True, null=True) timestamp = models.DateTimeField(auto_now=True, blank=True, null=True) I am filtering the DeviceCircuitSubnets and then I also want to access the BGPData related model via each filtered item. service_data = DeviceCircuitSubnets.objects.filter(monitored=True, device__site_id=site_id) \ .select_related('device','circuit','subnet') I have tried adding bgpdata to the select related and to prefetch but neither are currently working, I am returned with an error stating the model doesn't exist. how would my query need to look to obtain each one to one field in a query set? Thank you -
Need help identifying language, I believe its Python, but I'm not sure
I just took a part time job as a web developer and need help identifying some code. They told me it was built in html/css/javascript, but they are using what I believe are python template tags. They are comfortable with me learning a new language, I just want to make sure that I'm learning the correct language. I've copy and pasted the code into google and stack overflow search bars, again it looks like python/django or possibly jinja 2, but I don't know those languages and want to make sure I'm on the right track. This is just the opening line of the master.master file, which I am also not used to seeing as a master file. ` <!DOCTYPE html> <html lang="{{ data.Language }}" dir="{% if data.LanguageDetails.IsRtl %}rtl{% else %}ltr{% endif %}"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> {% block meta %}{% endblock %} {% for language in data.Languages %}{% if language.Culture != data.Language %} {% assign currentLanguagePrefix = '/' | Append:data.Language | Append: '/' %} {% assign thisLanguagePrefix = language.Culture | Append: '/' %} <link href="/{{ data.URL | Replace: currentLanguagePrefix, thisLanguagePrefix }}" hreflang="{{ language.Culture }}" rel="alternate"> {% endif %} {% endfor %}` -
Setting supervisor to an existing django-gunicorn-nginx app
I've a live django app, deployed at digitalocean by following this link There's no mention about supervisor service. Now, I realise, I need to use supervisor. Can I accomplish it with the existing setup? Or do I need to start everything from the beginning? Please help. Thanks. -
return message after file download in Django view response
I am downloading a pandas data-frame as a csv file using this approach: view.py .... response = HttpResponse(content_type='text/csv') response['Content-Disposition'] = 'attachment; filename="' + filename + '"' my_df.to_csv(response, encoding='utf-8', index=False, ) return response in my html, I have ... <form class="default_form" method="POST" action="do_export"> {% csrf_token %} <br/> <input type="submit" class="btn btn-primary exportOut" value="Do Export" id="myExport"/> <br/> </form> The file export works fine. However, after the export is done, I need to be able to show a message on the html page .... something like {{ my_message}} without reloading the page. if this is feasible, I would appreciate any suggestion on how to do this, without resorting to AJAX, which I abandoned because some of the downloads can be large. -
pylint(undefined-variable) error on return render
I'm working on a simple project with foreign keys on each model. The program worked well until I tried rendering the fetched data to a template. When I tried getting a simple HttpResponse, it worked well, but rendering to a template gives me an error. I get an error that states Undefined variable 'required' pylint(undefined-variable) My code looks like this: from django.shortcuts import render, redirect from .models import master_courses, course_category, course_series def single_slug(requests, single_slug): categories = [c.course_slug for c in course_category.objects.all()] if single_slug in categories: matching_series = course_series.objects.filter(course_category__course_slug=single_slug) series_urls = {} for ms in matching_series.all(): part_one = master_courses.objects.filter(course_series__course_series=ms.course_series).earliest("date_added") series_urls[ms] = part_one return render(request, "main/category.html", {"the_series": series_urls}) The error points to the last line of the code, which is: return render(request, "main/category.html", {"the_series": series_urls}) And it says undefined variable 'request' pylint(undefined-variable) Other return statements work well except for that statement within the for loop as I've mentioned above. Any suggestions on how I can solve this please? -
Django with legacy database and foreign keys where id=0
I am working with data that has been migrated from a PHP-based MySQL database to Django. In this PHP database they used foreign keys where the id = 0. So naturally when I try to insert a record that references a foreign key of 0 I get the following: "The database backend does not accept 0 as a value for AutoField." Fair enough. It seems this was done to protect folks from MySQL's use of using 0 to auto generate a primary key: https://code.djangoproject.com/ticket/17713 However there appears to be a way to write a "custom backend" to work around this: https://www.mail-archive.com/django-users@googlegroups.com/msg187956.html This seems less than optimal for something that appears to have a session-based solution of setting the following in the MySQL session: SET SESSION SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; Barring switching the database or other hacks to make this work are there better options to get Django and MySQL to play together with id=0? -
OperationalError at /result unable to open database file
I have this error for 2 days now I triyed everything in the other topics nothings works for me. The code of the app was written in linux, but i got the folder and connected it to my project as an app, in this project there is 3 apps that are connecting good to the database, only this one gives an error unable to open data base. I'm using Windows on Localhost, a friend triyed on windows and it's working for him, only for me not working. Note : When I go to localhost:8000/admin I can see the model created on the database. PLEASE HELP! Django Version: 2.2.3 I have tryied to give permissions of the folder on it's proprieties to read and write, tryied to change path of DIR, I switched from sqlite3 to postgres, made full path in database and not full one, triyed all the recommandations on topics but still shows the error Settings. py DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'devee', 'USER': 'postgres', 'PASSWORD': 'thepasswordichoosed', 'HOST': 'localhost', 'PORT': '5432', } } Environment: Request Method: POST Request URL: http://localhost:8000/result Django Version: 2.2.3 Python Version: 3.7.3 Installed Applications: ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'dashboard', 'account', … -
input fields not displaying on templates
i am new to django when i try to run this project i wasn't getting any input fields in my template current page was only showing the given labels i don't know where i've gone wrong can any of you guys help?? these are my models.py file from django.db import models # Create your models here. class Student(models.Model): sid = models.CharField(max_length=100) sname = models.CharField(max_length=100) sclass = models.CharField(max_length=100) semail = models.EmailField(max_length=100) srollnumber = models.CharField(max_length=100) scontact = models.CharField(max_length=100) saddress = models.CharField(max_length=100) class Meta: db_table = "student" the are my forms.py file from django import forms from student.models import Student class StudentForm(forms.ModelForm): class Meta: model = Student fields = "__all__" these are my views.py file from django.shortcuts import render from student.models import Student from student.forms import StudentForm def student_home(request): return render(request, 'employee/dash.html') def add_student(request): if request.method == "POST": form = StudentForm(request.POST) if form.is_valid(): try: form.save() return render(request, 'employee/dash.html') except: pass else: form = StudentForm() return render(request, 'student/addstudent.html') template <!DOCTYPE html> <html lang="en"> <head> <title>addstudent</title> </head> <body> <a href="/home" >home</a> <form method="POST" action="/add_student"> {% csrf_token %} <label>Student ID:</label> {{ form.sid }} <label>Name :</label> {{ form.sname }} <label>Class :</label> {{ form.sclass }} <label>Email ID:</label> {{ form.semail }} <label>Roll Number :</label> {{ form.srollnumber }} <label>Contact :</label> … -
Cache manager does not delete my cache after specifying inactive time
I have a django app connected to an S3 bucket and a postgres database. To reduce egress costs by downloading s3 contents every pull, I am trying to setup a cache folder using an Nginx server. I want to download s3 objects and keep them in cache for some time till it becomes stale. I have setup nginx.conf file with: 1. send_file = off 2. tcp_push = off 3. tcp_node_delay = off (read this somewhere on stackoverflow) I have also pointed to the sites-enabled folder. Within this conf file I have set: 1. proxy_cache_path /home/clyde/Downloads/new/automatic_annotator_tool/queried_data/ levels=1:2 keys_zone=my_cache:100m max_size=1g inactive=1m use_temp_path=off; Is this enough?? I am new to Nginx and these problems are turning out to be cumbersome. I expect the cached folder to retain downloaded contents from the django application for some time and then either get deleted or resynced from the db. TIA -
Django lists url but gives 404 not found
Page not found, but correct url is listed I'm really confused here: I get this error saying page not found, then it lists the url it can't find????? What is wrong here? Page not found (404) Request Method: GET Request URL: http://127.0.0.1:8000/si/project/2/ Using the URLconf defined in django_version.urls , Django tried these URL patterns, in this order: login/[name='login'] logout/[name='logout'] password_change/[name='password_change'] password_change/done/[name='password_change_done'] password_reset/[name='password_reset'] password_reset/done/[name='password_reset_done'] reset/<uidb64>/<token>/[name='password_reset_confirm'] reset/done/[name='password_reset_complete'] [name='blog-list'] create/[name='blog-create'] <int:id>/[name='blog-detail'] <int:id>/update/[name='blog-update'] <int:id>/delete/[name='blog-delete'] si/[name='project-list'] si/create_project[name='create_project'] si/project/<int:pk> [name='project_detail'] <-- is this not my url? admin/ about/ [name='about_view'] register [name='register'] ^media/(?P<path>.*)$ The current path, si/project/2/ , didn't match any of these. -
Can I print just the content of a html template in django?
I am using Django with python to create a web application, I am a beginner in this. I hope that you can help me. I want to print this page by clicking a button. Now, I am just trying to generate the pdf first. I want just to print the content. I tried these functions. #views.py from django.views.generic.detail import DetailView from MagasinProject.views import PdfMixin from MagasinProject.utils import generate_pdf, render_to_pdf_response, pdf_decorator from django.contrib.auth.models import User from django.shortcuts import render def test_view(request): resp = HttpResponse(content_type='application/pdf') result = generate_pdf('demande/demande.html', file_object=resp) return result #urls.py from django.urls import path from . import views from django.conf.urls import url urlpatterns=[ path('demande',views.index, name='demande'), url(r'^test_view$', views.test_view), ] -
In Django, how to create self-referencing, truly symmetrical ManyToMany relationship with some additional fields under that relationship(in 2019)?
I know this type of question has been asked many times before. I’ve referred those questions and they’ve helped me to reach what I’ve implemented till now. Problem is that they don’t solve the specific problem I am facing and their solutions are at least an year old. I’m hoping that some better solution might have been discovered till now for the problem that Django has faced for years with self-referencing symmetrical ManyToMany relationship. May be there is third party library I don’t know about. I’ve a model that gives details about a stadium. Once user is on the page of stadium, there’ll be list of other stadiums which are in neighbouring vicinity to current stadium, along with their distances from current stadium. I want to implement this in django. So, suppose there are two stadiums , Stadium A and stadium B which are closer to each other. Then adding stadium B as neighbour of stadium A should automatically create stadium A as neighbour of stadium B. This is different than facebook friends or twitter followers. In facebook, symmetrical relationship is not established as long as friend request isn’t accepted by the person whom request has been sent. So, person … -
Slow Page Load Times
I have a table which is populated via a RESTful API call to a database. For one particular table column, its data is pulled by referencing an ID from the main API call and then using said ID as a parameter for a second API call. However, there may be 1,000 or more rows of data in the table, so iterating through all these rows and performing the second API call is causing very slow page load times (up to 40 seconds). Is there any way I might handle this issue? I can limit the number of records returned per query, but ideally I would include all records available. Please let me know if any other information is needed. views.py cw_presales_engineers = [] for opportunity in opportunities: try: opportunity_id = str(opportunity['id']) presales_ticket = cwObj.get_tickets_by_opportunity(opportunity_id) if presales_ticket: try: cw_engineer = presales_ticket[0]['owner']['name'] cw_presales_engineers.append(cw_engineer) except: pass else: cw_engineer = '' cw_presales_engineers.append(cw_engineer) except AttributeError: cw_engineer = '' connectwise_zip = zip(opportunities, cw_presales_engineers) -
Django: multiple update
I want to update multiple instances of my models. I can currently update them one by one just fine. I want to be able to update them with a PUT request to my URL: www.my-api.com/v1/mymodels/ with the request data like so: [ { "mymodel_id": "id1", "name": "foo"}, { "mymodel_id": "id2", "alert_name": "bar"} ] If I try it this way now, I receive the following Django error: Serializers with many=True do not support multiple update by default, only multiple create. For updates it is unclear how to deal with insertions and deletions. If you need to support multiple update, use a `ListSerializer` class and override `.update()` so you can specify the behavior exactly. My model has a Serializer class ModelSerializer class MyModelSerializer(ModelSerializerWithFields): class Meta: model = MyModel fields = "__all__" def to_representation(self, instance): data = super().to_representation(instance) if instance.name is None: del data['name'] return data ModelSerializerWithFields extends serializers.ModelSerializer. At which level do I need to use the ListSerializer class? ie: in ModelSerializerWithFields or in MyModelSerializer? Or somewhere else completely? If anyone has any examples of this implementation, I'd be very grateful -
Update BD with django backend and post form via ajax
Given that I have my userPersonalized model. And this has 2 fields that I want to update through a form, where they enter a numerical value and in doing so, a mathematical operation is done. Well, I want the result of that mathematical operation to update the logged-in user fields, according to the numerical value entered. I'm importing Jquery's library. Through 2 input hidden I access the 2 fields that I want to update through the mathematical operation, which I have in my javascript file where I call it through the id html file <div><form method="POST" class="form-data" action="{% url 'solit' %}"> {% csrf_token %} <h6>Tipo de peticion:{{form.petit}}</h6> <h6>Razon:{{form.razon}}</h6> <h6>{{form.solicitudes_id}}</h6> <h6>Fecha inicio:{{form.periodo_init}}</h6> <h6>Fecha fin:{{form.periodo_fin}}</h6> <h6>Introduzca dias a tomar<input id="dias" type="number" name="dias_adicion"></h6> <h6>Introduzca horas a tomar<input id="horas" type="number" name="horas_adicion"></h6> <input type="hidden" id="const_dias" name="d_pendientes" value="{{ user.d_pendientes }}"> <input type="hidden" id="const_horas" name="h_pendientes" value="{{ user.h_pendientes }}"> Recuerde, que usted dispone de {{ user.d_pendientes }} dias y {{ user.h_pendientes }} horas a compensar <br> <button type="submit" onclick="calculo()" class="boton">Guardar</button> js file ------------------------------------------------------------ function calculo() { var dias = parseInt(document.getElementById('dias').value); var horas = parseFloat(document.getElementById('horas').value); var dias_base = parseInt(document.getElementById('const_dias').value); var horas_base = parseFloat(document.getElementById('const_horas').value); dias_base -= dias; horas_base -= horas; alert(dias_base); alert(horas_base); } console.log(calculo); ajax script---------------------------------------------------- $(document).ready(function(){ var productForm = … -
How to delete first N items from queryset in django
I'm looking to delete only the first N results returned from a query in django. Following the django examples here which I found while reading this SO answer, I was able to limit the resulting set using the following code m = Model.objects.all()[:N] but attempting to delete it generates the following error m.delete() AssertionError: Cannot use 'limit' or 'offset' with delete. Is there a way to accomplish this in django? -
Django: Online Users
I am following this solution to show whether a user is online or not. But when I try to add: 'userprofile.middleware.ActiveUserMiddleware', to MIDDLEWARE_CLASSES, I get a 502. {{ profile.online }} returns false Thank you for any help. -
locale folder in the root folder is ignored
Default language is french on my website. I run django-admin makemessages -l en and then django-admin compilemessages. When I make translations in apps, it works fine. However, in the root folder, locale folder seems to be ignored. I thought it would always try to find a translation there if it doesn't find it in other places. I also tried to add LOCALE_PATHS = ['../locale'] but it doesn't fix it.