Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
DJango mysite/urls.py not including correctly
I am currently trying to write my first DJango following this tutorial: https://docs.djangoproject.com/en/3.2/intro/tutorial01/ I ran into an issue where I get a page not found at /. My mysite/urls.py is the following: urlpatterns = [ path('polls/', include('polls.urls')), path('admin/', admin.site.urls), ] And polls.urls.py: urlpatterns = [ path('', views.index, name='index'), ] However, if I change this in settings.py ROOT_URLCONF = 'mysite.urls' to ROOT_URLCONF = 'polls.urls' It works. What am I doing wrong, I am literally following the tutorial. -
Saving and Updating data in Django
I have a form. The form has many text fields and those text fields hold some data that is stored in the database. This means that every time that form is opened, all the fields have the previous data. In the form, a user can edit the old text fields, create new text fields and delete the existing text fields. When the form submits, all the data in the form is saved to the database. As of now, to save the data to the database, I'm first deleting the old data and then saving the new data to the database. I know that this approach is not optimal because deleting all the data for a minor change and then saving the whole data again doesn't make any sense. Possible events User might edit some existing fields User might create some new fields User might delete some existing fields User might not make any changes and still submit the form So, how can I handle the saving efficiently? Model from django.db import models from django.contrib.auth.models import User class Sentence(models.Model): user = models.ForeignKey(User, on_delete = models.CASCADE) sentence = models.CharField(max_length = 250) Current Solution - from .models import Sentence def index(request): if request.method … -
div dropdown not showing
I am attempting to create a dropdown for a user. The problem is that it doesn't show up at all. <div class="account-wrap"> <div class="inside-account trade-sell-div"> <a class = "trade-sell-button" href="{% url 'product' %}">Trade/Sell</a> </div> {% if user.is_authenticated %} <div class = "inside-account chat-box-dropdown"> <a class="imgs-signed-in"><img style="height:45px !important;" src = "{% static "imgs/chat-box.png" %}" alt="Chat Box"></a> </div> <div class="inside-account user-dropdown"> <a class="imgs-signed-in user-icon-dropdown"><img src="{% static "imgs/user-icon.png" %}" alt="User"></a> <div class="dropdown-frame"> <div id="triangle"></div> <div class="dropdown-wrapper"> <hr> </div> </div> </div> {% else %} <div class="inside-account"> <a href="{% url 'login' %}">Login</a> </div> {% endif %} </div> css dropdown-frame{ position: absolute; height: 40rem; width: 10rem; outline: 1px solid black; } #triangle { width: 0; height: 0; content: ''; border-left: 20px solid transparent; border-right: 20px solid transparent; border-bottom: 20px solid white; } .dropdown-wrapper { right: 0; height: 40rem; width: 10rem; top: 56px; border: 1px solid red; z-index: 122; } Basically the triangle shows up on the nav bar but the part under the triangle does not show up at all. When I move the div elements outside the nav, it actually shows up. Does anyone have any explanation as to why my div dropdown-wrapper does not show up? -
Get user's last message django-postman & Rest API
I've been install Django-Postman user to user messaging package. I'm trying to get user's last message with Rest API. You can check django-postman package on here: https://pypi.org/project/django-postman/ A part of models.py class Message(models.Model): """ A message between a User and another User or an AnonymousUser. """ SUBJECT_MAX_LENGTH = 120 subject = models.CharField(_("subject"), max_length=SUBJECT_MAX_LENGTH) body = models.TextField(_("body"), blank=True) sender = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name='sent_messages', null=True, blank=True, verbose_name=_("sender")) recipient = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name='received_messages', null=True, blank=True, verbose_name=_("recipient")) sent_at = models.DateTimeField(_("sent at"), default=now) objects = MessageManager() Views.py class InboxLastMessagesViewSet(viewsets.ModelViewSet): serializer_class = InboxLastMessagesSerializer authentication_classes = (JSONWebTokenAuthentication,) permission_classes = (IsAuthenticated,) def get_queryset(self): user = self.request.user return Message.objects.filter(Q(sender=user) | Q(recipient=user)).order_by('sender') Serializers.py class InboxLastMessagesSerializer(serializers.ModelSerializer): senderusername = serializers.CharField(source='sender.username', read_only=True) reciusername = serializers.CharField(source='recipient.username', read_only=True) sonmesaj = serializers.SerializerMethodField() def get_lastmessage(self, obj): /// I'M TRYING TO CREATE A FUNCTION ON HERE FOR GET SENDER'S LAST MESSAGE //// lastmsg = obj.latest('sent_at') return dict(body=lastmsg) class Meta: model = Message fields = ('senderusername', 'reciusername', 'body', 'sent_at', 'lastmessage') I want to an output like this: { "senderusername": "user", "reciusername": "user2", "body": "Actually that is not last message", "sent_at": "2019-01-19T23:08:54Z", "lastmessage": { "body": "That's conversation's last message!" } }, { "senderusername": "user", "reciusername": "user2", "body": "I said that is not last message", "sent_at": "2021-05-10T23:09:42Z", "lastmessage": { "body": "That's … -
How to add id (instead of object) in ManyToManyField of Django model?
models.py : class Employee(models.Model): name = models.CharField(max_length=100) class Department(models.Model): name = models.CharField(max_length=100) employee = models.ManyToManyField(Employee, null=True, blank=True) I need to save employee id (instead of employee object) in 'employee' ManyToManyField of 'Department' model. How to do that? views.py: dept = Department(name=name) dept.save() employee_id = 1 -
Problem with installing Pillow required version=7.1.2 with python 3.9 version
Collecting Pillow==7.1.2 Using cached Pillow-7.1.2.tar.gz (38.9 MB) Using legacy 'setup.py install' for Pillow, since package 'wheel' is not installed. Installing collected packages: Pillow Running setup.py install for Pillow: started Running setup.py install for Pillow: finished with status 'error' ERROR: Command errored out with exit status 1: command: 'C:\Users\HARSHA\PycharmProjects\car-rental-with-Django-master\venv\Scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\HARSHA\\AppData\\Local\\Temp\\pip-install-ws324_km\\pillow_826cf519630e4aa283b7d2ea50fb4d3c\\setup.py'"'"'; __file__='"'"'C:\\Users\\HARSHA\\AppData\\Local\\Temp\\pip-install-ws324_km\\pillow_826cf519630e4aa283b7d2ea50fb4d3c\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\HARSHA\AppData\Local\Temp\pip-record-1yvbsy4q\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\HARSHA\PycharmProjects\car-rental-with-Django-master\venv\include\site\python3.9\Pillow' cwd: C:\Users\HARSHA\AppData\Local\Temp\pip-install-ws324_km\pillow_826cf519630e4aa283b7d2ea50fb4d3c\ Complete output (179 lines): C:\Users\HARSHA\AppData\Local\Temp\pip-install-ws324_km\pillow_826cf519630e4aa283b7d2ea50fb4d3c\setup.py:42: RuntimeWarning: Pillow 7.1.2 does not support Python 3.9 and does not provide prebuilt Windows binaries. We do not recommend building from source on Windows. warnings.warn( running install running build running build_py creating build creating build\lib.win-amd64-3.9 creating build\lib.win-amd64-3.9\PIL copying src\PIL\BdfFontFile.py -> build\lib.win-amd64-3.9\PIL copying src\PIL\BlpImagePlugin.py -> build\lib.win-amd64-3.9\PIL copying src\PIL\BmpImagePlugin.py -> build\lib.win-amd64-3.9\PIL copying src\PIL\BufrStubImagePlugin.py -> build\lib.win-amd64-3.9\PIL copying src\PIL\ContainerIO.py -> build\lib.win-amd64-3.9\PIL copying src\PIL\CurImagePlugin.py -> build\lib.win-amd64-3.9\PIL copying src\PIL\DcxImagePlugin.py -> build\lib.win-amd64-3.9\PIL copying src\PIL\DdsImagePlugin.py -> build\lib.win-amd64-3.9\PIL copying src\PIL\EpsImagePlugin.py -> build\lib.win-amd64-3.9\PIL copying src\PIL\ExifTags.py -> build\lib.win-amd64-3.9\PIL copying src\PIL\features.py -> build\lib.win-amd64-3.9\PIL copying src\PIL\FitsStubImagePlugin.py -> build\lib.win-amd64-3.9\PIL copying src\PIL\FliImagePlugin.py -> build\lib.win-amd64-3.9\PIL copying src\PIL\FontFile.py -> build\lib.win-amd64-3.9\PIL copying src\PIL\FpxImagePlugin.py -> build\lib.win-amd64-3.9\PIL copying src\PIL\FtexImagePlugin.py -> build\lib.win-amd64-3.9\PIL copying src\PIL\GbrImagePlugin.py -> build\lib.win-amd64-3.9\PIL copying src\PIL\GdImageFile.py -> build\lib.win-amd64-3.9\PIL … -
Sending authtoken to react app from django app
I have a multi-page Django application that uses React for one part of the application. The react app gathers data and then sends a post request back to Django to store the data in the db. I am trying to implement authentication with auth-tokens so only users with specific permissions can send API requests. But since the rest of the front-end is built with Django templates including the login, I need to securely send the auth token to the react app so that the user can make api requests if they are logged in. I'm not really sure how to go about doing this without doing something really insecure (like sending the token through the URL). Does anyone know of an approach that would work for this? -
How to make a separate withdrawal of the rating sum from the button in js?
The problem arose in ignorance of js. Please help me to display the counter separately so that it updates when pressed, as it is now, but was not inside the button tag. <button class="btn-like up" data-id="{{ post.id }}" type="button" data-type="f" data-action="rate_up"> <i class="bi bi-chevron-up"></i> <div id="spinner" class="d-none"> <i class="bi bi-arrow-repeat"></i> </div> </button> <span data-count="total_rating"> {{ post.total_rating }} </span> When it is alone, it does not update the rating digit when clicked. $('.btn-like.up').submit('click', function(e) { e.preventDefault() let ratingBox = $(this).data('id') let postType = ratingBox.data('type') let postId = ratingBox.data('id') let totalRating = ratingBox.find('[data-count="total_rating"]')#only works internally. If you do it through the getelementarybyid, it doesn't work, even on the whole page. $.ajax({ type: 'POST', url: '/system/' + postType + '/' + postId + '/rate_up/', data: { 'post_id': postId, 'csrfmiddlewaretoken': csrftoken }, success: function(response) { totalRating.text(response.total_rating); }, error: function(error) { console.log(error); }, }) }) -
Cannot SSH into EC2 Instance
I've been running a Django app on an EC2 instance and have been able to SSH into it for the past few weeks. Last week I had an incident where I wasn't able to connect to the instance. I took all the steps I knew of (i.e. verifying my inbound rules for a TCP at Port 22, checking VPC for a 0.0.0.0/0 destination in my route table). The remedy I found was to reboot my instance and I didn't have a problem until last night. Since last night, I have been locked out of my instance -- I tried rebooting the instance and stopping it for several hours. Even when I go to the session manager it says that it could not establish a connection. What should I do? I have not set up anything like firewalls because I'm still only in development so the problem shouldn't be something with UFW configuration. -
Django Admin Model List Render
I have this Django App that has been working pretty well, but lately, when I login into the admin area and click on any model, it takes me to the same model list page but the rendering seems pretty awkward. Example: This is the admin page where all models are listed The normal way is f I click any model it should take me to the list of records. But thhis is what really happens if I click any model. I can't see anything wrong on the code and logs. Hope you can help me. -
Save Duplicate Data when refresh the browser
Basically, I am writing a Django application where I am calling third-party free API. After fetch the data from API, I am trying to save the data into Django Model. I am created a model for storing API data. After saving data in Django SQLITE DB, when I refresh the browser, exact same data again save in the SQLITE database table. How can i prevent this issue? One logic in my mind: if data is exist then no need to insert otherwise insert but i can't apply this logic in Django view because don't know how? Models.py from django.db import models # Create your models here. class DogFacts(models.Model): fact = models.CharField(max_length=100) def __str__(self): return self.fact views.py def api(request): url = 'https://dog-facts-api.herokuapp.com/api/v1/resources/dogs/all' response = requests.get(url) json_response = response.json() # save all dog facts in the db for i in json_response: dog_facts = DogFacts(fact= i.get("fact")) dog_facts.save() return redirect('api') Thanks. -
How to implement a public chat app using Flutter with Django backend?
I'm trying to implement a chat app in Flutter with Django database. I'm quite new to this and this would be my first project of the kind. I found out that using a RESTapi would not be a good option for this specific use case but I'm still confused on how to implement this. I read it could be done through websockets or XMPP but I'm not really sure on how to go about the entire process and especially unsure about how could I connect that to my Flutter frontend. Any help/resources/advice is appreciated. Thanks! -
Why Django rest framework is restful?
I'm now writing my engineering thesis about REST and REST APIs, mostly focusing on Django REST framework as it was the framework we used in our engineering project. I just finished writing about the guidelines for API to be RESTful stated by Roy Fielding and I wanted to start section with implementations of REST architecture in Django REST Framework, but then I realized I don't really know why this framework is RESTful. I know what main paradigms are for API to be RESTful, but I don't know what specific parts of framwork inplements for example that our service is stateless or layered. Maybe someone can pinpoint what parts of django rest framework corresponds to specified guidelines for service to be RESTful ? If It's wrong site to ask this type of question then I'm sorry, but any help would be greatly appreciated. -
Django CSRF "Referer Malformed"... but it isn't
I'm trying to test a deployment config for a Django setup that works fine in development mode. I have name-based routing via Nginx's ssl_preread module on a load balancer, and SSL terminates at another Nginx instance on the server itself where the requests are proxied to uwsgi by socket. server { server_name dev.domain.net; listen 80 proxy_protocol; listen [::]:80 proxy_protocol; location / { return 301 https://$host$request_uri; } } server { server_name dev.domain.net; listen 443 ssl http2 proxy_protocol; listen [::]:443 ssl http2 proxy_protocol; location / { include uwsgi_params; uwsgi_pass unix:/run/uwsgi/website.sock; } location /favicon.ico { access_log off; log_not_found off; } } I have uwsgi set to log %(host) and %(referer), they match in the logs. In my uwsgi_params I'm passing $host and $referer like so, since I'm using name-based routing I pick up the $server_name variable that triggered the Nginx response... uwsgi_param HTTP_REFERER $server_name; uwsgi_param HTTP_HOST $host; Adding (or taking away) protocols and ports to these makes no difference. Taking them away predictably generates a Django ALLOWED_HOSTS debug error. I've confirmed that my ALLOWED_HOSTS includes the $host. I've tried adding CSRF_TRUSTED_ORIGINS for the same $host variable. I've tried setting CSRF_COOKIE_DOMAIN for the same $host variable. I have CSRF_COOKIE_SECURE set to True per the … -
how to pass chunk of audio files to Mozilla DeepSpeech web socket?
when a live speech is going on, I want to separate it into a chunk of short mp3 files and send it to a Mozilla DeepSpeech WebSocket for transcribing (speech is conducted using the device microphone) -
how can i add group in model django
i had created a group name "company" with some permissions. i want to add group while creating model. models.py class ComapnyUser(auth.models.User,auth.models.PermissionsMixin): myshowroom=models.CharField(max_length=20,default='') slug=models.SlugField(allow_unicode=True,unique=True,null=True) contact=models.IntegerField() address=models.TextField(blank=False,default='') def save(self,*args,**kwargs): self.slug=slugify(self.username) super().save(*args,**kwargs) def __str__(self): return self.username -
Django Reverse for 'index' not found. 'index' is not a valid view function or pattern name
I've been having this error for hours and I can't seem to fix it! URL.PY: from django.urls import path from . import views app_name = "learning_logg" urlpatterns = [ #Home Page path('', views.index, name="index"), ] VIEWS.PY: from django.shortcuts import render # Create your views here. def index(request): return render(request, "index.html") INDEX.HTML: {% extends "learning_logs/base.html" %} {% block content %} <p> Learning Log </p> <p> Learning Log helps you keep track of your learning, for any topic you're learning about gay </p> {% endblock content %} BASE.HTML: <p> <a> href = "{% url "index" %}"> Learning Log</a> </p> {% block content%} {% endblock content %} I'm trying to make base.html the main framework and then putting index.html inside it, does anyone know how to fix the error? It says the error is in line 2: 1 2 href = "{% url "index" %}"> Learning Log 3 4 5 6 {% block content%} {% endblock content %} 7 -
Get the src attribute of an <img> element from html template to work with it in django view
I need to get the src attribute of an element from the html template to my django view Any idea how to do it guys ? -
(Django REST Framework) Basic authentication doesn't work when app is served through NGINX
I'm building an API and I finally got it working to serve it through Gunicorn and NGINX. Nginx proxies incoming requests to a socket binded to Gunicorn. The problem is this: When I try to access the API directly by running the 'gunicorn command or by using the builtin 'runserver' command from Django, and having configured Django REST Framework's BasicAuthentication as the default authentication class in the settings.py-file, everything works fine. Each time I try to access an endpoint, it asks me for a valid username/password-combo, just like you would expect. However, when I try to access the API through NGINX, which has a proxy_pass configured to the unix socket which Gunicorn is bound to, BasicAuthentication doesn't work anymore. All requests are granted, without providing a username and password. I know basic authentication should be avoided, but it's a requirement for a project I'm working on. Does anyone know why this happens and how to solve this? settings.py: REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': ( 'rest_framework.authentication.BasicAuthentication', ), } nginx.conf: http { log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream; … -
Django How to use filter when the column database has strings and foreign key?
I have class named Person, and Person have a attribute named car. In the past car was an string attribute. Now, my desire is to change car to a FK, since I've create a class named Car. I addition, I have the following filter: class PersonFilterHeatmapSet(filters.FilterSet): class Meta: model = Person fields = { 'car': ['exact'], } how can I make these changes without broken my filter? Since currently my column database is populated with string values instead FK's. -
Python Regex in URL Django
I want a function which should run with or without a parameter. This is my views.py @api_view(['GET', 'POST']) def enable_boards(request, board_ids=None): ``` This is my urls.py path('enable_boards', views.enable_boards) path('enable_boards/<str:boards_ids>', views.enable_boards) Now I know I have to write re_path but I don't know how to write regex for this particular case. What should be the proper url in this case ? -
Read csv file and save content to database using Graphql and Django framework
I am trying to use bulk import, to import data from a csv file and populate an inherited model from a separate module, I was able to get the data and loop through all the data in the csv file by checking for the csv file path reading the datas from the file and looping through each rows, now I am trying to insert the gotten data to the database using graphql and Django framework, I need the data to populate an inherited module model table called insuree, using the below code, i am unable to send the data to database which is stopping the table from populating. Here is my mutation code ''' import graphene from core import prefix_filterset, ExtendedConnection, filter_validity, Q, assert_string_length from core.schema import TinyInt, SmallInt, OpenIMISMutation, OrderedDjangoFilterConnectionField from insuree import models as insuree_models from django.contrib.auth.models import AnonymousUser from django.core.exceptions import ValidationError, PermissionDenied from django.utils.translation import gettext as _ from graphene import InputObjectType import csv class BulkImportInputType(OpenIMISMutation.Input): file_path =graphene.String(required=True) def set_import_insuree_data(data, user): data_list = [] col_list = [] all_data = [] file_path = data['file_path'] with open(file_path, newline='') as csvfile: data = csv.reader(csvfile, delimiter=' ', quotechar='|') for row in data: data_list.append(row) for col in data_list[0]: for column in … -
nginx ingress host app to master ip not working
Attaching the desctiption below. I need to host the app in 192.168.5.91 which is the master ip of the kubetnet cluster. All these are running in private space. It can be accesed throgh localhost:30239. But i need to acces it via 192.168.5.51 (master.example.com) -added in /etc/hosts $kubectl describe service -n ingress-nginx ingress-nginx Name: ingress-nginx-controller Namespace: ingress-nginx Labels: app.kubernetes.io/component=controller app.kubernetes.io/instance=ingress-nginx app.kubernetes.io/managed-by=Helm app.kubernetes.io/name=ingress-nginx app.kubernetes.io/version=0.46.0 helm.sh/chart=ingress-nginx-3.30.0 Annotations: service.beta.kubernetes.io/do-loadbalancer-enable-proxy-protocol: true service.beta.kubernetes.io/do-loadbalancer-hostname: master-kmrl.example.com Selector: app.kubernetes.io/component=controller,app.kubernetes.io/instance=ingress-nginx,app.kubernetes.io/name=metrodash-ingress Type: ClusterIP IP Family Policy: SingleStack IP Families: IPv4 IP: 10.98.115.20 IPs: 10.98.115.20 External IPs: 192.168.9.51 Port: http 80/TCP TargetPort: http/TCP Endpoints: <none> Port: https 443/TCP TargetPort: https/TCP Endpoints: <none> Session Affinity: None Events: <none> Name: ingress-nginx-controller-admission Namespace: ingress-nginx Labels: app.kubernetes.io/component=controller app.kubernetes.io/instance=ingress-nginx app.kubernetes.io/managed-by=Helm app.kubernetes.io/name=ingress-nginx app.kubernetes.io/version=0.46.0 helm.sh/chart=ingress-nginx-3.30.0 Annotations: <none> Selector: app.kubernetes.io/component=controller,app.kubernetes.io/instance=ingress-nginx,app.kubernetes.io/name=ingress-nginx Type: ClusterIP IP Family Policy: SingleStack IP Families: IPv4 IP: 10.101.116.78 IPs: 10.101.116.78 Port: https-webhook 443/TCP TargetPort: webhook/TCP Endpoints: 192.168.79.191:8443 Session Affinity: None Events: <none> The service files attached here $kubectl get service --all-namespaces NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE cert-manager cert-manager ClusterIP 10.97.7.155 <none> 9402/TCP 2d1h cert-manager cert-manager-webhook ClusterIP 10.102.27.254 <none> 443/TCP 2d1h default kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 10d ingress-nginx ingress-nginx-controller LoadBalancer 10.104.163.193 192.168.9.51 80:31152/TCP,443:31291/TCP 7m24s ingress-nginx ingress-nginx-controller-admission ClusterIP 10.101.116.78 <none> 443/TCP 8d ingress-nginx metrodash-service NodePort 10.107.176.33 … -
Celery PID file command errors
I use Django Celery Beats in my system and I just updated the celery to version 5. I had initially used this command to start the service: celery --pidfile= -A ExactEstate beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler But now I am getting errors that --pidfile is not a valid arg. What can I change it to now? -
Nginx add subdirectory to proxy_pass respnse?
I am having an issue with my Nginx configuration and I could use a little help since I feel I am so close. I am trying to configure Nginx to host multiple applications and routing the traffic based on an applications subdirectory as shown here. server { listen 80; location /something / { proxy_set_header Host $host; rewrite /something/(.*)$ /$1 break; proxy_pass http://django_application_upstream1; } location /another_something/ / { proxy_set_header Host $host; rewrite /another_something /(.*)$ /$1 break; proxy_pass http://django_application_upstream2; } } This set up works great for directing traffic to the respective applications but when a user clicks on a href with an absolute URL everything goes wrong. For example: http://django_application_upstream1/something/ -> Landing page (perfect) user clicks landing page href=’/’ -> 404 not found (should return user to http://django_application_upstream1/something/) Even when I add the subdirectory to the href (‘/something/’) within the application html the subdirectory is removed somewhere along the way and I still end back up at the root url. Is it possible to rewrite a proxy_pass response so I can add back the subdirectory that I removed with the previous rewrite? This would mean all responses from the proxy have the subdirectory added back even if an absolute href was …