Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Unable to deliver static files in django
I ran the collect static script and I am still not able to deliver the static files. My static files folder - F:\Python\REALESTATE\static and inside that are all js, CSS, and IMG folders. I suspect this is not working properly - os.path.join(BASE_DIR, 'static') I have faced problems with this before also. My Setting.py files STATIC_ROOT = os.path.join(BASE_DIR, 'static') STATIC_URL = '/static/' STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'REALESTATE/static') ] My html file: {% load static %} <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <!-- Font Awesome --> <link rel="stylesheet" href="{% static 'css/all.css' %} " /> <!-- Bootstrap --> <link rel="stylesheet" href="{% static 'css/bootstrap.css' %} " /> <!-- Custom --> <link rel="stylesheet" href="{% static 'css/style.css' %} " /> <link rel="stylesheet" href="{% static 'css/lightbox.min.css' %} " /> -
Firebase Storage file uploading 'Connection aborted.' error
I am getting an intermittent issue while uploading a file in Firebase Storage from my Django web app- 'Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None) The error page from web is below- Below is my code for uploading the file: def upload_file(name, file_obj, file_path=None, overwrite=False, retry=True): if not file_path: file_path = os.path.join(settings.MEDIA_ROOT, name) if default_storage.exists(file_path) and not overwrite: filename = default_storage.get_available_name(name) file_path = os.path.join(settings.MEDIA_ROOT, filename) default_storage.save(file_path, file_obj) return filename else: default_storage.save(file_path, file_obj) return name Here my storage setting is DEFAULT_FILE_STORAGE = 'storages.backends.gcloud.GoogleCloudStorage' Is there any better solution to solve the issue other than retrying the connection? Please suggest also if I am doing anything wrong here? -
How to get the difference of each qty of 2 django table?
I have here 2 different Django Models. class Stocks(models.Model): name = models.CharField(max_length=100) qty = models.FloatField() class Sold(models.Model): name = models.CharField(max_length=100) qty = models.FloatField() How to get the difference of each qty ? For example : Stocks.qty - Sold.qty How to do this? -
Downloading image files from s3 bucket from client side
I am building a website where I am uploading wallpapers on s3 bucket and I want users to be able to download those wallpapers from my website on the click of a button. Earlier I was using simple anchor tag and download attribute to download the image file but now if I click on he download button my image just opens in full size in new tab. I am not sure why this is happening and how can I Fix this. I want to be able to download the image on click not open it new tab. -
How to get increase a variable valu by jquery in django template?
At first i want to select variable form_show then i want to increase form_show variable value by jquery and return the variable value in template. How is it possible by jquery? {% extends 'base/base.html' %} {% load static %} {% block content %} <div class="card"> <form class="form-horizontal" action="" method="post"> {% csrf_token %} <div class="card-body"> <div class="card-body"> <div id="form_show" class="form-horizontal"> {{ employAcademicFormSet.management_form }} {% with form_show=1 %} {% for form in employAcademicFormSet|slice:form_show %} {% for field in form.visible_fields %} <div class="form-group row"> <label class="col-md-3 col-form-label" for="text-input"><h6>{{ field.label_tag }}</h6></label> <div class="col-md-9">{{ field }}</div> </div> {% endfor %} {% endfor %} {% endwith %} <input type="button" value="Add More" id="add_more" /> </div> </div> </div> <div class="card-footer"> <button class="btn btn-lg btn-primary" type="submit">Submit</button> </div> </form> </div> <script> $("#form_show").select(function () { var form = $("#form_show").val(); var form = 0+1; console.log(form); }); </script> {% endblock %} Please anybody help for problem... -
How to serialize annotated field in Django WITHOUT using viewsets?
I have an annotated field I am trying to include in the response to an AJAX get request. Code: backend: def ajax_get_tags(request): if request.is_ajax(): data = json.dumps( serializers.serialize("json", Tag.objects.annotate(word_count=Count('words')).order_by('-word_count'), fields=('text', 'is_game'))) else: data = 'fail' mimetype = 'application/json' return HttpResponse(data, mimetype) frontend: $.getJSON("{% url 'get_all_tags' %}", function (result) { result = JSON.parse(result); }); How can I send the word count to the frontend? I found Aggregate (and other annotated) fields in Django Rest Framework serializers but I don't want to convert my endpoint to a viewset -
group by date with sum along with other data in django
I have a model named Attendance with following fields, models.py class Attendance(models.Model): project_name_id = models.ForeignKey('Project',on_delete=models.DO_NOTHING,null=True,blank=True,related_name='projects') name = models.CharField(max_length=100,null=True,blank=True) company_name = models.CharField(max_length=100,null=True,blank=True) work_type_id = models.ForeignKey('Works',on_delete=models.DO_NOTHING,null=True,blank=True) is_fullday = models.BooleanField(default=False) is_halfday = models.BooleanField(default=False) total_number = models.IntegerField(default=0) date = models.DateField(null=True,blank=True) I am trying to display the data in the following format, 05/10/2020 project_a 25 1 Carpentry 15 2 Plumbing 10 05/10/2020 project_b 8 1 Electrical 8 06/10/2020 project_a 10 1 Plumbing 10 grouping by date for each project,showing the total number of workers and showing number of workers for each work below. I can't get it to display the details for each date. This is my view, def attendanceList(request): att_objs= Attendance.objects.filter(company_name =request.session['company_name']).values('date','project_name_id__project_name').order_by('date').annotate(sum=Sum('total_number')) return render(request,'projects/attendance_list.html',{'object_list':att_objs}) How do i get all the data grouped by date and project_name with a total for each date, so that it can be displayed in the format? -
TypeError: unsupported operand type(s) for |: 'str' and 'Q'
I am having a model class ProjectPlan(Model): plan_name = models.CharField(max_length=255, blank=True) plan_manager = models.ForeignKey( settings.AUTH_USER_MODEL, on_delete=models.CASCADE, blank=True, null=True, ) I need to filter a search query THis is my ORM query plan = ProjectPlan.objects.filter(models.Q(plan_name__icontains= self.context['query'])| models.Q(plan_manager__first_name__icontains= self.context['query'])) It showing an error TypeError: unsupported operand type(s) for |: 'str' and 'Q' -
Django rest framework doesn't allow a POST with multiple nested objects
I'm having an issue passing several children OrderItem, a collection, when creating an Order parent instance. Although there a one to many relationship between Order and OrderItem models, I can't pass a list of children to the parent. For some reason the parent object does not accept a list for its children, only 1 object and I don't understand why that is. Have tried many different ways to solve this, have commented on related SO questions but haven't found any solution so far. Does anyone know what I'm doing wrong or missing? Thanks for your responses! Here is an example of the request I try to make on this endpoint /api/orders/: { "bar_id": 2, "order_items":[ { "ref_id": 3 }, { "ref_id": 2 }, { "ref_id": 1 } ] } The error is as: { "order_items": { "non_field_errors": [ "Invalid data. Expected a dictionary, but got list." ] } } Here is my parent OrderModel: from django.db import models from .model_bar import * class Order(models.Model): bar_id = models.ForeignKey(Bar, null=True, on_delete=models.CASCADE, related_name='orders') Here is my child OrderItemModel: from django.db import models from .model_order import * from .model_reference import * class OrderItem(models.Model): order_id = models.ForeignKey(Order, null=True, on_delete=models.CASCADE, related_name='order_items') ref_id = models.ForeignKey(Reference, null=True, on_delete=models.CASCADE, … -
why I can't show my converted video in web site?
I made my web app using django and it works good in local server. I uploaded slowmotion video and I could download my converted video on web However, when I use AWS or pythonanywhere to release my website, I dosen's covert uploaded video. I can only show my uploaded origin video and there is nothing result. can you help me? from django.shortcuts import render, redirect from django.core.files.storage import FileSystemStorage import cv2 def upload(request): context = {} if request.method == 'POST': uploaded_file = request.FILES['videoname'] fs = FileSystemStorage() name = fs.save(uploaded_file.name, uploaded_file) context['url'] = fs.url(name) tujuan = context['url'][1:] modfile = tujuan + '.mp4' context['modurl'] = context['url']+'.mp4' cap = cv2.VideoCapture(tujuan) # 재생할 파일의 넓이와 높이 width = cap.get(cv2.CAP_PROP_FRAME_WIDTH) height = cap.get(cv2.CAP_PROP_FRAME_HEIGHT) print("재생할 파일 넓이, 높이 : %d, %d" % (width, height)) # fourcc = cv2.VideoWriter_fourcc(*'mp4v') fourcc = 0x31637661 out = cv2.VideoWriter(modfile, fourcc, 30.0, (int(height), int(width))) ret, pos_frame = cap.read() while (cap.isOpened()): ret, frame = cap.read() if ret == False: break; result = cv2.addWeighted(pos_frame, 0.5, frame, 0.5, 0) result = cv2.transpose(result) result = cv2.flip(result, 1) out.write(result) pos_frame = frame cap.release() out.release() return render(request,'index.html', context) -
Creating a Reference Code for each new order
For my E-commerce project, I am trying to generate a reference code that can be understandable yet unique at the same time: I am trying to generate a reference code that after each purchase is made that includes that day, month, year, hour, minute and a digit that increases with a new transaction DDMMYYHHMMXXX Day, Month, Year, Hour, Minute,3 digits starting with 001 and increasing with each new order. How do I do it? My current code generated is: def create_ref_code(): return ''.join(random.choices(string.ascii_lowercase + string.digits, k=6)) model.py class Order(models.Model): ref_code = models.CharField(max_length=20, blank=True, null=True) ordered_date = models.DateTimeField() def __str__(self): return self.user.username -
i am using django classed view i want to give permission to admin dynamically
if form.is_valid(): #import pdb;pdb.set_trace() user = form.save(commit=False) user.is_partner = True user.is_staff = True password = request.POST.get('password') user.set_password(password) permission = Permission.objects.get(name="Can view employee") user = user.user_permissions.add(permission) user.save() permission = Permission.objects.get(name="Can view employee") user = user.user_permissions.add(permission) this two lines give an error "<partnerData: shubham@storemanagement>" needs to have a value for field "id" before this many-to-many relationship can be used. how can i solved this. -
google.maps is undefined in Django
I have the next code: {% extends "block.html" %} {% load media_tags staticfiles %} {% block blocktitle %}{% endblock %} {% block blockbody %} {% addmedia "css" %} <link href="{% static "merengue/css/map/map.css" %}" rel="stylesheet" type="text/css" /> {% endaddmedia %} <script src="//maps.googleapis.com/maps/api/js" type="text/javascript"></script> <style type="text/css"> html, body, #map { height: 100%; margin: 0; }</style> <script type="text/javascript"> var blocked_maps; var setup_blocked_maps; var map; var script = document.createElement('script'); script.src = 'https://maps.googleapis.com/maps/api/js?v=3&amp;key=AIzaSyBwdVf-Ezph3llEXy-cK0HnTLLfGEx3p-Q&libraries=places'; //script.defer = true; if (! blocked_maps) { blocked_maps={} } blocked_maps["#mapblock_{{ reg_block.id }}"]={ use_cluster: false, show_directions: false, {% if render_ui %} use_small_controls: true {% else %} no_ui: true {% endif %} }; function initialize() { var map = new google.maps.Map( document.getElementById('map'), { center: new google.maps.LatLng(37.4419, -122.1419), zoom: 13, mapTypeId: google.maps.MapTypeId.ROADMAP }); var marker = new google.maps.Marker({ position: new google.maps.LatLng(37.4419, -122.1419), map: map }); } google.maps.event.addDomListener(window, 'load', initialize); </script> <div id="mapblock_{{ reg_block.id }}" style="width: {{ width }}px; height: {{ height }}px;"> <div class="mapParameters hide"> <span class="zoom">{{ zoom }}</span> <span class="longitude">{{ longitude|safe }}</span> <span class="latitude">{{ latitude|safe }}</span> <span class="markersShownInitially">1</span> </div> <div class="mapPoint hide"> <span class="longitude">{{ longitude|safe }}</span> <span class="latitude">{{ latitude|safe }}</span> <span class="iconImage">{% static "merengue/img/map/default_map_icon.png" %}</span> </div> </div> {% endblock %} If I run this code, give the error: You have included the Google Maps … -
Display Instagram Public Profiles in Django Template
I would like to display Instagram public profiles in my Django template. Instagram usernames are stored in the database through the model. I'm pulling the usernames from the database. By using "django_instagram" I was able to show media contents in my template. How do I show the profile like this in my template? My model: class Listing(models.Model): account_name = models.ForeignKey(Account, on_delete=models.CASCADE, verbose_name='Account Name', null=True, blank=True) profile_username = models.CharField('Username', unique=True, max_length=200) class Meta: verbose_name = 'Listing' verbose_name_plural = 'Listings' def __str__(self): return self.profile_username My view: def index(request): instagram_profile_name = 'cabinwellnessclinic' context = {'instagram_profile_name': instagram_profile_name} return render(request, 'instagram/index.html', context) My template: <!DOCTYPE html> {% load instagram_client %} <html lang="en"> <head> <meta charset="UTF-8"> <title>{{ instagram_profile_name|capfirst }} Instagram Profile</title> </head> <body> <h1>{{ instagram_profile_name }} Instagram Profile</h1> <div id="django_recent_media_wall"> {% instagram_user_recent_media instagram_profile_name %} {% for media in recent_media %} <div class="django_instagram_media_wall_item"> <a href="//instagram.com/p/{{ media.shortcode }}" target="_blank"> <img src="{{ media.thumbnail_src }}"/> <span>{{ media.edge_media_to_caption.edges.0.node.text }}</span> </a> </div> {% endfor %} </div> </body> </html> Any help would be much appreciated. -
How Do I Install sdl-config -Heroku Django deploy error
So i am getting this error that i need to install sdl config i tried pip install sdl-config but its not working and i am stuck on this last part to deploy my website heres an image of the error If you know how to install sdl-config please explain it step by step because this is my first time launching my website using heroku with github -
Unable to create warehouse using graphql in Saleor ("NoneType' object has no attribute 'save'")
I have followed the documentation for createWarehouse mutation in graphql for saleor. the error is related with address because error pops up if the address is in the code. The address is a required field mutation { createWarehouse( input: { slug: "test" address: { streetAddress1: "1" streetAddress2: "2" city: "New York" cityArea: "New your" postalCode: "123" country: US countryArea: "bla" phone: "2" } name: "as" companyName: "a" email: "en" } ) { warehouse { id name } warehouseErrors { message } } } error message returns NoneType' object has no attribute 'save' -
Add parameters to ForeignKey field?
I'm trying to build an auctions site and I have a ForeignKey field that I may want to add some extra parameters to if possible. Right now, when I go to /admin and I go to Listings and click on a listing, there is a drop-down selector for Winners. But the drop-down selector is showing me all the bids that have been placed, including bids placed on other listings. How do I get the drop-down selector to only allow me to select from users that have placed bids on that specific listing. I'm assuming I need to add some kind of condition to the winners field? models.py class Listing(models.Model): class NewManager(models.Manager): def get_queryset(self): return super().get_queryset().filter(status='active') options = ( ('active', 'Active'), ('closed', 'Closed'), ) title = models.CharField(max_length=64) description = models.TextField(max_length=64) start_price = models.DecimalField(max_digits=9, decimal_places=2, validators=[MinValueValidator(0.99)]) image = models.URLField(max_length=200, blank=True) category = models.ForeignKey(Category, on_delete=models.CASCADE, related_name="listings") lister = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, default=None, null=True, blank=True, related_name="lister_user") date_added = models.DateTimeField(default=timezone.now) status = models.CharField(max_length=10, choices=options, default="active") winner = models.ForeignKey('Bid', on_delete=models.CASCADE, null=True, related_name="bid_winner") favourites = models.ManyToManyField(User, related_name="favourite", default=None, blank=True) objects = models.Manager() listingmanager = NewManager() def __str__(self): return f"{self.title} ({self.pk}, £{self.start_price}, {self.lister})" class Bid(models.Model): bidder = models.ForeignKey(User, on_delete=models.CASCADE, related_name="bidders") bid_item = models.ForeignKey(Listing, on_delete=models.CASCADE, related_name="bid_items", default=None) bid_input = models.DecimalField(max_digits=9, … -
Passing image URL as a prop in Vue not working
I am new to Django Rest Framework and am trying to learn how to create a Full-Stack application with Django Rest Framework and VueJS. I am using Django Rest Framework to deliver image URLs from the Django server to my Vue application. When I pass the imageURL as a prop, and bind the src attribute, the image is not displayed. When I go directly to the imageURL (in this example 127.0.0.1:8000/static/images/meal_1.jpg), it is the correct URL and the image displays correctly. If I manually set the src attribute, it displays correctly. <img :src="imageURL" alt="Product Image"/> {{ imageURL }} <img src="http://127.0.0.1:8000/static/images/meal_1.jpg" alt="Product Image" /> {{ imageURL }} I have researched similar problems and they all mention using require(), but this image is not located in the Vue application's assets folder, is is getting served from the Django application. Any help would be appreciated. -
How to use Ajax to send redirect page when a user clicks the 'submit' button after PayPal executed in Django Project
I have set PayPal payment for my project which is currently working until the user submits the payment and the PayPal windows closes the website page is still there with items in the cart. My goal is thast when the user submits the payment and the PayPal windows closes, the website goes to "order_completed.html" page I have set in the views. I have tried to add the code in the onApprove in scripts but it is not working. My question: How to set the JavaScript Ajax so that when the payment is executed and user clicks submit the website directs to another page Here is the views.html: def payment_complete(request): body = json.loads(request.body) order = Order.objects.get( user=request.user, ordered=False, id=body['orderID']) payment = Payment( user=request.user, stripe_charge_id=body['payID'], amount=order.grand_total() ) payment.save() # assign the payment to order order.payment = payment order.ordered = True order.ref_code = create_ref_code() order.save() messages.success(request, "Your Order was Successful ! ") # Email when order is made template = render_to_string("payment_confirmation_email.html", {'first_name': request.user.first_name, 'last_name': request.user.last_name, 'order': order}) msg = EmailMessage('Thanks for Purchasing', template, settings.EMAIL_HOST_USER, [request.user.email]) msg.content_subtype = "html" # Main content is now text/html msg.fail_silently = False msg.send() # End of the email send return render(request, "order_completed.html", {'order': order}) class PaymentView(View): def get(self, … -
TemplateDoesNotExist Error in django on a simple hello world project
I have a problem using templates in django. I believe I have the template in the right spot and after looking at the path from the error log, the file is there. I also have it working without using render(). But I have tried multiple things and in the error log it shows a path that I can follow to the html file that I am trying to render. Here is the file structure of my project Relevant code: Below is my view from the hello app I created. How it is currently there is an error but if I comment out the render() call and use the uncommented code It displays the contents of index.html C:\my_website\my_website\hello\views from django.shortcuts import render from django.http import HttpResponse # Create your views here. import os import logging #MS ADDED logger = logging.getLogger(__name__)#MS ADDED def index(request): #!!! It works with this stuff uncommented #index_path = os.path.join(os.path.dirname(os.path.dirname(__file__)),'hello\\templates\\hello\\index.html') #logger.error('Views - index_path is ' + index_path) # MS ADDED #with open(index_path) as f: # html_string = f.read() #return HttpResponse(html_string) return render(request, 'hello/index.hmtl') Below is everything that I have changed in the settings. I read in the Django docs that if you didnt specify a path it would … -
upload application which backend is django and frontend is Vue using Docker
I'm working on an application which uses these technologies: Django Backend Vue JS front end PostgreSQL database Docker as a container Traefik as a reverse proxy. redis. awscli Here is my production.yml file which i use to the docker-compose to run all applications: version: '3' volumes: production_postgres_data: {} production_postgres_data_backups: {} production_traefik: {} services: django: build: context: . dockerfile: ./compose/production/django/Dockerfile image: goplus_backend_production_django depends_on: - postgres - redis env_file: - ./.envs/.production/.django - ./.envs/.production/.postgres command: /start volumes: - ./static:/static # adding static & media file for django - ./media:/media vue: build: context: /root/goplus_front/new_dashboard_v2 container_name: new_dashboard_v2 environment: - HOST=localhost - PORT=8080 ports: - "8080:8080" depends_on: - django postgres: build: context: . dockerfile: ./compose/production/postgres/Dockerfile image: goplus_backend_production_postgres volumes: - production_postgres_data:/var/lib/postgresql/data - production_postgres_data_backups:/backups env_file: - ./.envs/.production/.postgres ports: - "5432:5432" traefik: build: context: . dockerfile: ./compose/production/traefik/Dockerfile image: goplus_backend_production_traefik depends_on: - django # volumes: # - production_traefik:/etc/traefik/acme ports: - "0.0.0.0:80:80" - "0.0.0.0:443:443" redis: image: redis:5.0 awscli: build: context: . dockerfile: ./compose/production/aws/Dockerfile env_file: - ./.envs/.production/.django volumes: - production_postgres_data_backups:/backups Till now everything is fine and if I use IP:80 I got redirected to Django app (admin panel), and if I use IP:8080 I got redirection to Vue app. The problem is now I want to use Domain Name not IP address, … -
Django join 4 tables with select_related and almost successful
I have models in Django like this : class cart(models.Model): user_id = models.BigIntegerField() class cart_details(models.Model): total = models.BigIntegerField() cart_id = models.ForeignKey(cart, on_delete= models.CASCADE) product_id = models.ForeignKey(product, on_delete= models.CASCADE) class product(models.Model): name = models.CharField(max_length=50) class product_images(models.Model): url = models.SlugField(max_length=100) product_id = models.ForeignKey(product, on_delete= models.CASCADE) I have succesfull join 3 tables (cart, cart_details and product) with this code below: cart_details.objects.filter(id=1).select_related('cart_id').select_related('product_id').all() for item in cart_details: print item.cart_id.user_id print item.product_id.name But now, how to join 4 tables (cart, cart_details, product and product_images) and get url from product_images with select_related? This is SQL query, and it works: select product_images.url, cart.user_id from cart_details join cart on cart.id = cart_details.cart_id join product on product.id = cart_details.product_id where cart.user_id = 1 Help me please.. Thank you! -
Django check if Object in model is parent or child
below I have a model structure with Post and Comment objects: class Post(models.Model): author = models.ForeignKey(Profile, on_delete=models.CASCADE) class Comment(models.Model): post = models.ForeignKey(Post,on_delete=models.CASCADE,related_name='comments') author = models.ForeignKey(Profile, on_delete=models.CASCADE) dels.CASCADE, null=True, related_name="replies") reply = models.ForeignKey('self', on_delete=models.CASCADE, null=True, related_name="replies") How can I check if my comment is a reply or it's not a reply? You can reply only to the parent comment meaning there are not nested replies. However, a comment may initially never have replies. -
Real Time Webcam Data Processing in Django
I created a website based on Django. My goal is to take data from webcam, send each frame to the background (view part),and process each frame. For this, I used Canvas and Ajax Post method. However, Ajax Post method is really slow for me. It takes more than one second for one frame (Only posting, processing frame in the background is not included) and this is not convenient to perform real time or close to real time processing. Is this slow posting with Ajax normal? Do you have any suggestion to perform my goal? Thank you for your insterest. Best. -
Docker compose nginx config setup to broadcast on port 8000
I am at the end of a project where I have an Nginx as a router in a docker container that works with a test node app on port 8000, but I need it to point to another Nginx Docker compose container which is setup to run a Django app. I don't think the second Nginx is configured right to run the app on port 8000, and am looking for any advise as this. Basically I've been following two separate tutorials and this is where they meet. Here are the files that I think you'll need but feel free to ask for anything additional. docker-compose.prod.yml version: '3.7' services: web: build: context: ./dcahill dockerfile: Dockerfile.prod command: gunicorn dcahill.wsgi:application --bind 0.0.0.0:8000 volumes: - static_volume:/home/dchll/web/staticfiles - media_volume:/home/dchll/web/mediafiles expose: - 8000 env_file: - ./.env.prod depends_on: - db db: image: postgres:12.0-alpine volumes: - postgres_data:/var/lib/postgresql/data/ env_file: - ./.env.prod.db nginx: build: ./nginx volumes: - static_volume:/home/dchll/web/staticfiles - media_volume:/home/dchll/web/mediafiles ports: - 8000:80 depends_on: - web volumes: postgres_data: static_volume: media_volume: nginx.conf (not he main router directing public traffic to 8000) upstream dcahill.com { server web:8000; } server { listen 80; location / { proxy_pass dcahill.com; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_redirect off; client_max_body_size 100M; } location /staticfiles/ { alias …