Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
{{% if user.is_authenticated %}} is not working properly it always shows the authenticated block and not else block
.................urls.py.......... from django.contrib import admin from django.urls import path, include from user import views as user_view from django.contrib.auth import views as auth_views from django.views.generic import TemplateView from django.conf import settings from django.conf.urls.static import static urlpatterns = [ path('admin/', admin.site.urls), path('', include('dashboard.urls')), path('register/', user_view.register, name = 'user-register'), path('profile/', user_view.profile, name = 'user-profile'), path('', auth_views.LoginView.as_view(template_name = 'user/login.html'),name='user-login'), path('logout/', TemplateView.as_view(template_name = 'user/logout.html'),name='user-logout' ), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) ...........views.py........ from django.shortcuts import render, redirect from django.contrib.auth.forms import UserCreationForm from .forms import CreateUserForm from django.contrib.auth.models import User from django.contrib.auth.decorators import login_required def register(request): if request.method == 'POST': form = CreateUserForm(request.POST) if form.is_valid(): form.save() return redirect('user-login') else: form = CreateUserForm() context = { 'form': form, } return render(request, 'user/register.html',context) def profile(request): return render(request, 'user/profile.html') .........nav.html........ <nav class="navbar navbar-expand-lg navbar-info bg-info"> {% if user.is_authenticated %} <div class="container"> <a class="navbar-brand text-white" href="{% url 'dashboard-index' %}">NTPC Inventory</a> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse" id="navbarSupportedContent"> <ul class="navbar-nav mr-auto"> <li class="nav-item active"> <a class="nav-link text-white" href="{% url 'dashboard-index' %}">Dashboard <span class="sr-only">(current)</span></a> </li> </ul> <ul class="navbar-nav ml-auto"> <li class="nav-item active"> <a class="nav-link text-white" href="profile.html">Admin Profile <span class="sr-only">(current)</span></a> </li> <li class="nav-item"> <a class="nav-link text-white" href="{% url 'user-logout' %}">Logout</a> </li> </ul> <!-- problem is not … -
Is there any way to add a file using an external button to my Kartik Krajee Bootstrap File Input?
I am working on a Django project where I use bootstrap. I added this plugin https://plugins.krajee.com/file-input/plugin-options. I have a modal where I use the file input, now is there any way to add file/files to the file input using an external button? (for example: I have a button to generate my Offer PDF, and when is generated I want to be auto added to my file input and be able to see it. This is part of my HTML code: <div class="form-group row hidden" id="email_files_container_{{ action }}"> <div class="col"> <input type="file" component="2" file_type="email" id="id_email_files_{{ action }}" name="email_files[]" class="flow-files" multiple="multiple"> </div> </div> <div class="form-group row"> <button id="id_file_pdf" type="button" class="btn btn-primary">{% trans 'Ataseaza Fisierul PDF' %}</button> </div> and this is part of my JavaScript Code: function AddFilePDF(myFileInput, object_type, object_id) { $.ajax({ url: '/popup/get_email_pdf/' + object_type + '/' + object_id + '/', type: 'GET', success: function(response) { if (response.pdf) { var pdf = response.pdf const blob = new Blob([pdf.file], { type: pdf.file_mime }); const newFile = new File([blob], pdf.file_name, { type: pdf.file_mime }); myFileInput.fileinput('addToStack', newFile); } }, error: function(xhr, status, error) { console.error('Error:', error); } }); } I tried this way and it is adding the file to the stack, but i cannot … -
Python Django access fields from inherited model
Hi I have a question related to model inheritance and accessing the fields in a Django template. My Model: class Security(models.Model): name = models.CharField(max_length=100, blank=False) class Stock(Security): wkn = models.CharField(max_length=15) isin = models.CharField(max_length=25) class Asset(models.Model): security = models.ForeignKey(Security, on_delete=models.CASCADE,blank=False) My views.py context["assets"] = Asset.objects.all() My template: {% for asset in assets %} {{ asset.security.wkn }} ... This gives me an error as wkn is no field of security. Any idea how I can solve this? Thanks in advance! -
purpose of using daphne with django channels
why is the primary purpose of using daphne with django channels , if we can already do the asgi configuration ourselves ? like what is the relationship between ASGI & daphne server if you could provide a clear explanation that would be very helpful -
How to play different audios on a single <audio> tag Django app
i'm making a music streaming website. In the homepage i have a carousel with songs and i want to play them onclick on a single HTML tag. how can i make? Do i have to write a javascript function? if yes, how it has to be? this is my HTML: <div class="main-carousel" data-flickity='{"groupCells":5 , "contain": true, "pageDots": false, "draggable": false, "cellAlign": "left", "lazyLoad": true}'> {% for i in songs %} <div class="carousel-cell"> <section class="main_song"> <div class="song-card"> <div class="containera"> <img src="{{i.image}}" id="A_{{i.id}}" alt="song cover"> <div class="overlaya"></div> <div> <a class="play-btn" href="...?" id="{{i.id}}"><i class="fas fa-play-circle fa-2x"></i></a> {% if user.is_authenticated %} <div class="add-playlist-btn"> <a id="W_{{i.song_id}}" title="Add to Playlist" onclick="showDiv(this)"></a> </div> {% endif %} </div> </div> </div> <div> <p class="songName" id="B_{{i.id}}">{{i.name}}</p> <p class="artistName">{{i.artist}}</p> </div> </section> </div> {% endfor %} </div> <audio preload="auto" controls id="audioPlayer"> <source src=...?> </audio> my models.py: class Song(models.Model): song_id = models.AutoField(primary_key=True) name = models.CharField(max_length=50) artist = models.CharField(max_length=50) album = models.CharField(max_length=50, blank=True) genre = models.CharField(max_length=20, blank=True, default='Album') song = models.FileField(upload_to="songs/", validators=[FileExtensionValidator(allowed_extensions=['mp3', 'wav'])], default="name") image = models.ImageField(upload_to="songimage/", validators=[FileExtensionValidator(allowed_extensions=['jpeg', 'jpg', 'png'])], default="https://placehold.co/300x300/png") data = models.DateTimeField(auto_now=False, auto_now_add=True) slug = models.SlugField(unique=True) def __str__(self): return self.name class Meta: ordering = ['name'] -
Images not displaying in my for loop Django
i'm making a music streaming website and i want to display the songs in the homepage. I'm using a for loop in songs and everything is working ( but the images are not displaying and i see this . How can i fix it? This is models.py: class Song(models.Model): song_id = models.AutoField(primary_key=True) name = models.CharField(max_length=50) artist = models.CharField(max_length=50) album = models.CharField(max_length=50, blank=True) genre = models.CharField(max_length=20, blank=True, default='Album') song = models.FileField(upload_to="media/songs/", validators=[FileExtensionValidator(allowed_extensions=['mp3', 'wav'])], default="name") image = models.ImageField(upload_to="media/songimage/", validators=[FileExtensionValidator(allowed_extensions=['jpeg', 'jpg', 'png'])], default="https://placehold.co/300x300/png") data = models.DateTimeField(auto_now=False, auto_now_add=True) slug = models.SlugField(unique=True) def __str__(self): return self.name class Meta: ordering = ['name'] and this is the html: {% for i in songs %} <div class="carousel-cell"> <section class="main_song"> <div class="song-card"> <div class="containera"> <img src="{{i.image}}" id="A_{{i.id}}" alt="song cover"> <div class="overlaya"></div> <div> <a class="play-btn" href="{{i.preview_url}}" id="{{i.id}}"><i class="fas fa-play-circle"></i></a> {% if user.is_authenticated %} <div class="add-playlist-btn"> <a id="W_{{i.song_id}}" title="Add to Playlist" onclick="showDiv(this)"></a> </div> {% endif %} </div> </div> </div> <div> <p class="songName" id="B_{{i.id}}">{{i.name}}</p> </div> <p class="artistName">{{i.singer1}}</p> </section> </div> {% endfor %} -
Django ORM Query aggregate datetime + timeoffset and filter on new value
I've the following table structure (note localised start time): id start_time offset score 1 2024-06-14 02:03:00.000 +0200 +1000 15 2 2024-06-14 02:04:00.000 +0200 +1000 15 3 2024-06-14 02:05:00.000 +0200 +1000 12 4 2024-06-14 02:06:00.000 +0200 +1000 10 I'm trying to come up with a query that fetch all the entries, where start time localised at column offset is greater than a given date. So far i tried something on the line of: from django.db.models import F, ExpressionWrapper from django.db import models from django.db.models.functions import TruncDate from datetime import datetime import pytz utc = pytz.timezone('UTC') localized_start_time = ExpressionWrapper( TruncDate('start_time', tzinfo=utc) + F('offset'), output_field=models.DateTimeField() ) result = MyModel.objects.annotate( localized_start_time=localized_start_time ).filter( localized_start_time=datetime.now() ) however when running the output query, i'm getting: operator does not exist: date + character varying Hint: No operator matches the given name and argument types. You might need to add explicit type casts. Any clue on how to add localised start time using the value on column offset? Unfortunately, i cannot change the way data is store since it's a production database and the impact would be too big. -
Django - Separate DBs for write and read & tests issue
I have set-up separate databases for read operations and for write operations. In my DEV environment this points to the same database but under different alias. In PROD environment this gets overwritten to point to 2 separate databases which are connected between each other and basically hold the same data. Nonetheless, while the configuration works correctly when using my Django web app (starting the webserver, playing around with the logic using my browser), my unit tests, which are creating/modifying and then asserting changes in model instances, are not able to run at all. The error I get when starting my unit tests is: ValueError: Cannot force both insert and updating in model saving. My set-up looks like this: settings.py DATABASES = { "default": { "ENGINE": "django.db.backends.mysql", "NAME": "django", "USER": "dj", "PASSWORD": "mypassword", "HOST": "127.0.0.1", "PORT": "3306", }, "read_db": { "ENGINE": "django.db.backends.mysql", "NAME": "django", "USER": "dj", "PASSWORD": "mypassword", "HOST": "127.0.0.1", "PORT": "3306", }, "write_db": { "ENGINE": "django.db.backends.mysql", "NAME": "django", "USER": "dj", "PASSWORD": "mypassword", "HOST": "127.0.0.1", # localhost because otherwise client is trying to connect via socket instead of TCP IP "PORT": "3306", }, "root": { "ENGINE": "django.db.backends.mysql", "NAME": "root", "USER": "xxx", "PASSWORD": "zzz", "HOST": "127.0.0.1", "PORT": "3306", }, } DATABASE_ROUTERS = … -
Raw input being recorded but data is not saving throwing "this field is required" error
For context, I've essentially got a form whereby the user fills in job details and can choose who was on the job from an existing list of workers and input their hours, rates, and total wages. I've implemented a script so the user can 'add' more workers to the form. The main issue is that the data is not saving specifically for the hours and rates field even though the wages field is, so I cannot submit the whole form. Given the JS is client-side it is more likely a django problem, I've tested it anyway by getting rid of my script. Wage Model: class EmployeeWage(models.Model): job = models.ForeignKey(Operating_Budget, on_delete=models.CASCADE, null=True, blank=True) worker = models.ForeignKey(EmployeeRecord, on_delete=models.CASCADE, null=True, blank=True) wages = models.DecimalField(max_digits=10, decimal_places=2) hours = models.DecimalField(max_digits=10, decimal_places=2, default=0) rates = models.DecimalField(max_digits=10, decimal_places=2,default=0) This is my Wage form: class WorkerWagesForm(forms.ModelForm): worker = forms.ModelChoiceField(queryset=EmployeeRecord.objects.all(), label="") wages = forms.DecimalField(label="", max_digits=10, decimal_places=2) hours = forms.DecimalField(label="", max_digits=10, decimal_places=2) rates = forms.DecimalField(label="", max_digits=10, decimal_places=2) class Meta: model = EmployeeWage fields = ('worker', 'wages', 'hours', 'rates') class JobWorkerWageFormSetBase(BaseInlineFormSet): def clean(self): super().clean() for form in self.forms: if form.cleaned_data.get('hours') is None: form.add_error('hours', 'Hours are required.') if form.cleaned_data.get('rates') is None: form.add_error('rates', 'Rates are required.') WorkerWagesFormSet = inlineformset_factory(Operating_Budget, EmployeeWage, formset = JobWorkerWageFormSetBase, … -
is model is woring attrs
raise dj_exc_value.with_traceback(traceback) from exc_value File "C:\Users\97326\AppData\Roaming\Python\Python310\site-packages\django\db\backends\utils.py", line 85, in _execute return self.cursor.execute(sql, params) File "C:\Users\97326\AppData\Roaming\Python\Python310\site-packages\django\db\backends\sqlite3\base.py", line 416, in execute return Database.Cursor.execute(self, query, params) django.db.utils.IntegrityError: NOT NULL constraint failed: new__Movie_movie.movie_download_file class movie(models.Model): movie_name=models.CharField(max_length=300) movie_descrition=models.TextField() movie_catagory_title=models.CharField(max_length=100,choices=catagory_title,default=0) movie_type=models.CharField(max_length=103, choices=catagory,default=0) movie_select=models.CharField(max_length=103, choices=topt,default=0,blank=True) movie_upload_time=models.DateTimeField(auto_now_add=True) movie_title_image=models.ImageField(upload_to='movie/movieTitle',blank=True) movie_file=models.URLField(max_length=3000,blank=True,default=None) movie_download_file=models.URLField(max_length=3000,blank=True,default=None) def __str__(self): return self.movie_name -
'payments' is not a registered namespace
I think I did a good job mapping the URL, so please check it out from django.urls import path from . import views app_name = 'payments' urlpatterns = [ path('request/<int:order_id>/', views.payment_request, name='payment_request'), path('success/', views.payment_success, name='payment_success'), path('fail/', views.payment_fail, name='payment_fail'), path('checkout/', views.checkout_view, name='checkout'), ] def checkout_view(request): return render( request, 'checkout.html', ) <form method="post" action="{% url 'payments:checkout' %}"> {% csrf_token %} {{ form.as_p }} created app_name = 'payments' -
i have uploded my django proejct on cloudfare through gunicorn but i seems like my css is not loading in it
Static files (CSS, JavaScript, Images) https://docs.djangoproject.com/en/5.0/howto/static-files/ Static files (CSS, JavaScript, Images) STATIC_URL = '/static/' This is where you put your uncollected static files STATICFILES_DIRS = [ BASE_DIR / 'static', ] This is where collected static files will be placed STATIC_ROOT = BASE_DIR / 'staticfiles' Default primary key field type https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field i want to make the css visible in my software -
django edit.py ProcessFormView() question
class ProcessFormView(View): """Render a form on GET and processes it on POST.""" def get(self, request, *args, **kwargs): """Handle GET requests: instantiate a blank version of the form.""" return self.render_to_response(self.get_context_data()) def post(self, request, *args, **kwargs): """ Handle POST requests: instantiate a form instance with the passed POST variables and then check if it's valid. """ **form = self.get_form()** if form.is_valid(): return self.form_valid(form) else: return self.form_invalid(form) # PUT is a valid HTTP verb for creating (with a known URL) or editing an # object, note that browsers only support POST for now. def put(self, *args, **kwargs): return self.post(*args, **kwargs) In that part, there is no part that is imported by inheriting self.get_form(), self.form_valid() so I am curious as to how to import it and just use it. Is that incomplete code? To use it normally, should I use "ProcessFormView(View, ModelFormMixin)" like this? The Django version I use is 4.1.5 I wonder why it suddenly appeared. The concept of inheritance clearly exists, but I have my doubts as to whether this is in violation of this. As an example, you can see that other codes inherit very well. `class BaseDeleteView(DeletionMixin, FormMixin, BaseDetailView): """ Base view for deleting an object. Using this base class … -
Raise error for when there is no header matching the specified row name from CSV
The issue is that when user clicks upload csv and picks a file and tries to submit the file. If the header of the file is not equal to "IP Address", then I get the debug menu from Django. The CSV file does not exist in any directory, so it is handled via upload, I was wondering what's best practice for raising an error, I have tried some methods below but still get the debug menu. This is the forms.py class that handles the CSV form. class CSVForm(forms.Form): csv_file = forms.FileField(required=True) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.ips_from_csv = [] def get_ips_from_csv(self): return self.ips_from_csv def clean_csv_file(self): csv_file = self.cleaned_data.get("csv_file") if not csv_file: return with csv_file.open() as file: reader = csv.DictReader(io.StringIO(file.read().decode("utf-8"))) for row in reader: form_data = self.cleaned_data.copy() form_data["address"] = NetworkUtil.extract_ip_address(row["IP Address"]) self.ips_from_csv.append(form_data["address"]) That is what currently works, below is the code that I have tried to implement, but I am no sure how to handle the error side of things. if form_data["address"] != row["IP Address"]: print("Invalid") and this with open(file, "r") as inf: csv_reader = csv.DictReader(inf) for header in csv_reader: if header != row["IP Address"]: print("Invalid") -
Python web development using django
My error is in tinymce admin.py have indentation error:unindent does not match any outer indentation level I tried in import From django.utils. encoding import smart_str.the error in the line formfield_overrides={ models.TextField:{"widget":TinyMCE()} ) -
why does coming this error when in visual studio terminal?
pipenv : The term 'pipenv' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 pipenv django + CategoryInfo : ObjectNotFound: (pipenv:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException i want to install pipenv Django -
One to many relationships in Django ORM
I have built several database systems for managing parts databases in small electronics manufacturing setups. I am repeating the process using Django5 and MySQL. I'm a noob with Django but have used MySQL a lot in Java and Python. Consider the tables class Bom(models.Model): bom = models.AutoField(primary_key=True); bompart = models.ForeignKey(Part, on_delete=models.CASCADE) revision = models.CharField(max_length=1) class BomLine(models.Model): bom = models.ForeignKey(Bom, on_delete=models.CASCADE) part = models.ForeignKey(Part, on_delete=models.CASCADE) designator = models.CharField(max_length=10, primary_key=True) ordinal = models.IntegerField() qty = models.DecimalField(max_digits=11, decimal_places=4) class Meta: constraints = [ models.UniqueConstraint(fields=['bom', 'designator'], name='bomdesignator')] class Part(models.Model): groupid = models.ForeignKey(PartGroup, on_delete=models.CASCADE) partno = models.AutoField(primary_key=True) partdescription = models.CharField(max_length=100) (I've omitted the PartGroup table as it is unrelated to my question). The idea is that a bill-of-materials is defined in the Bom table. The system automatically assigns an integer id, and a part is nominated as the 'parent' of this BOM - ie the BOM is the materials list need to make the nominated part. Each BOM refers to BomLines. We can have many lines in a BOM for each component. Since there may be many of the same type of component in a BOM, a 'designator' is used to state exactly where in the assembly the part belongs. (The 'ordinal' field is only … -
Is it safe to pass a user object to a Django template?
I have a user model that stores all user data, for example username, password, favorite_color, etc. I pass the data to the template like this TemplateView def get_context_data(self, **kwargs): data = super().get_context_data(**kwargs) user_object = User.objects.get(email=self.get_object()) data['user_data'] = user_object return data and I display non-confidential data on the page <span class="favorite_color">{{ user_data.favorite_color }}</span> I'm wondering if it's safe to pass a User object to a page, but not display private data through a template (for example, {{user_data.password}}) Do I need to only send the specific data I want to use on the page? Or can I still send the whole user object? Let's just assume the developer doesn't make any mistakes. -
django TemplateDoesNotExist at password_reset_subject
I'm building a user authentication app in django, and following this tutorial: https://dev.to/earthcomfy/django-reset-password-3k0l I'm able to successfully get to the password_reset.html template, where I can enter an email address and submit. If I enter an email that is not associated with a user, the success_message from the ResetPasswordView is triggered, but if I enter a valid email address, associated with a user, I get the error. I did everything as per the tutorial, and I've verified that my email configs work by using EmailMessage module from the django shell to send emails. my ResetPasswordView: class ResetPasswordView(SuccessMessageMixin, PasswordResetView): template_name = 'users/password_reset.html' email_template_name = 'users/password_reset_email.html' subject_template_name = 'users/password_reset_subject' success_message = "We've emailed you instructions for setting your password, " \ "if an account exists with the email you entered. You should receive them shortly." \ " If you don't receive an email, " \ "please make sure you've entered the address you registered with, and check your spam folder." success_url = reverse_lazy('users-home') I have all the templates in that class in the relevant places. The password_reset_subject is a .txt file as per the tutorial. Template-loader postmortem Django tried loading these templates, in this order: Using engine django: django.template.loaders.app_directories.Loader: /Users/.../user_management/users/templates/users/password_reset_subject (Source does not … -
Django The included URLconf '_mod_wsgi_...' does not appear to have any patterns in it
I am a Python novice and I am trying to run a Django hello world app on Windows. The upper error message shows up with the following code: import os import sys import site from django.core.wsgi import get_wsgi_application from django.conf import settings from django.urls import path from django.http import HttpResponse site.addsitedir("C:/Program files/python312/Lib/site-packages") sys.path.append('C:/Users/felhasznalo/Desktop/django') sys.path.append('C:/Users/felhasznalo/Desktop/django/todo') settings.ROOT_URLCONF=__name__ settings.ALLOWED_HOSTS = ['localhost', '127.0.0.1'] settings.SECRET_KEY = '1234' def hello(request): return HttpResponse("Hello World!") urlpatterns = [ path("", hello) ] application = get_wsgi_application() I checked a bunch of similar questions, but none of the answers appear to fix this. Any idea what to do or how to debug this? I have the urlpatterns variable present, the hello is a function, the "" is a valid path, still it does not seem to find the variable... :S :S :S I wonder why it uses global variables though instead of argument passing. Does not seem to be a well designed framework... -
django.contrib.auth.models.Group not shown in ios
In my django project (rechentrainer.app) I created two groups to manage my users: "lehrer" and "schüler". In all browsers and at all devices I can assign them to my users - but not in ios on my iPad or iPhone - the groups are not shown. In Safari on the Mac it works fine. I found no hint in the django manual and the guys in my german python/django forum have no idea. I even ask my provider. -
Django JSON file - Which file should "model": refer to?
I am trying to populate my model with the fields I have input in the json but I am unsure which file the "model": should refer to? I assume it should be where the model is located but I always get an error when I try to load the file - Problem installing fixture '/workspace/django-film-club/film/fixtures/films.json': film/fixtures/films.json; [ { "model": "film.movie", "pk": null, "fields": { "title": "Django Unchained", "slug": "django-unchained", "year": 2012, "genre": "WESTERN", "synopsis": "<p>With the help of a German bounty-hunter, a freed slave sets out to rescue his wife from a brutal plantation owner in Mississippi.<p>", "director": "Quentin Tarantino", "excerpt": "A freed slave sets out to rescue his wife from a brutal plantation owner in Mississippi.", "added_on": "2024-06-01T09:43:19.754Z" } }, ] film/models.py; class Movie(models.Model): title = models.CharField(max_length=200, unique=True) slug = models.SlugField(max_length=200, unique=True) year = models.IntegerField(('year'), default=datetime.datetime.now().year) genre = models.CharField(max_length=15, choices=GENRE_CHOICES, default='horror') synopsis = models.TextField() director = models.CharField(max_length=200, unique=True) excerpt = models.TextField(blank=True) added_on = models.DateTimeField(auto_now_add=True) The only thing I can thnk is that that the model in the json file is incorrect, I have tried diffent names for the model: input but still doesnt seem to work. I expected, if sucessful to load the data into the site but I … -
I wish to perform a case-insensitive search in Django with a MySQL database
I'm trying to perform a case-insensitive search on a model in Django. I get a case-sensitive search instead. According to the Django docs, utf8_general_ci collation will result in a case-insensitive search. My current collation is utf8mb4_0900_ai_ci. I tried: SELECT dbasename ALTER TABLE tablename CONVERT TO CHARACTER SET utf8mb4 collate utf8_general_ci; but that gave me: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ALTER TABLE website_card CONVERT TO CHARACTER SET utf8mb4 collate utf8_general_c' at line 2 I don't understand what I'm doing wrong. Please advise. -
Slack Events endpoint not trigerring for large payload
I'm using Slack Bolt in my Django application to handle Slack events and shortcuts. I have set up an events endpoint in Slack, and it works perfectly fine when the payload size is small. However, I'm facing issues when the payload is large, such as when there are multiple media attached to the text where the user triggered the shortcut or when the text itself is extensive. In these cases, my backend does not seem to receive any trigger from Slack. Here are the specific details and steps I've taken so far: Normal Payloads: When the payload size is small (normal text or media), the events endpoint works without any issues. Large Payloads: When the payload size is large, my backend does not receive the trigger. I used oscato to monitor the requests, and I can confirm that Slack is indeed sending the trigger. This suggests that the issue lies within my backend. Events Endpoint Setup: Here is what my events endpoint looks like in my Django backend: slack_request_handler = SlackRequestHandler(app=slack_app) def slack_handler(request): return slack_request_handler.handle(request) Steps I have taken to debug this issue: Confirmed that Slack is sending the trigger for large payloads using oscato. Verified that the endpoint works … -
Content Security Policy when clients access via Windows Remote Desktop
Have django-csp working in report only mode on application deployed on aws using gunicorn/nginx. No reported issues in dev or prod except when clients log into their work computers to work remotely. Using a secured remote desktop session (I can recreate accessing production web using browser running in vm). I get nothing but errors and warnings about hosted page injection. Now my understanding is that CSP is meant to protect against unauthorized CSS but are there settings or headers that will allow site to operate in an approved remote window. Any guidance is appreciated.