Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How to group filtering elements into groups in Django?
I need to do dynamic product filtering.I need to do dynamic product filtering. I had a problem, how to group filtering elements by categories. My model class CategoryCharacteristic(models.Model): category = models.ForeignKey("mainapp.Category", verbose_name='category', on_delete=models.CASCADE) feature_filter_name = models.CharField(verbose_name='name_of_filter', max_length=50) unit = models.CharField(max_length=50, verbose_name='unit_of_measurement', null=True, blank=True) class Meta: unique_together = ('category', 'feature_filter_name') ordering = ('id',) def __str__(self): return f"{self.category.title}-{self.feature_filter_name}-{self.unit}" class ProductCharacteristic(models.Model): product = models.ForeignKey(Product, on_delete=models.CASCADE, related_name='characteristics') feature = models.ForeignKey(CategoryCharacteristic,verbose_name='name_of_filter', on_delete=models.CASCADE) value = models.CharField(max_length=100) def __str__(self): return f'{self.feature.feature_filter_name} {self.value}' My forms class ProductFilterForm(forms.Form): min_price = forms.DecimalField(required=False) max_price = forms.DecimalField(required=False) characteristics = forms.ModelMultipleChoiceField( queryset=ProductCharacteristic.objects.all(), widget=forms.CheckboxSelectMultiple, required=False ) def filter_queryset(self, queryset): min_price = self.cleaned_data.get('min_price') max_price = self.cleaned_data.get('max_price') characteristics = self.cleaned_data.get('characteristics') if min_price: queryset = queryset.filter(price__gte=min_price) if max_price: queryset = queryset.filter(price__lte=max_price) if characteristics: characteristic_query = Q() for characteristic in characteristics: characteristic_query |= Q(characteristics=characteristic) queryset = queryset.filter(characteristic_query) return queryset view class ProductListView(ListView): model = Product template_name = 'mainapp/product_list.html' def get_queryset(self): self.category = get_object_or_404(Category, slug=self.kwargs['category_slug']) queryset = super().get_queryset().filter(category=self.category) filter_form = ProductFilterForm(self.request.GET) if filter_form.is_valid(): queryset = filter_form.filter_queryset(queryset) return queryset def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['filter_form'] = ProductFilterForm(self.request.GET) context['product'] = self.get_queryset() return context As a result, I want to get enter image description here I have no idea how to implement it -
Overriding serializers __init__ method to create nested serializers with custom parameters
I have created basic serializer in Django Rest Framework for model containing an ImageField. # images/models.py from django.db import models def upload_to(instance, filename): """Generate file path for the new image""": return 'changeit' class Image(models.Model): img = models.ImageField(upload_to=upload_to) user = models.ForeignKey('users.User', on_delete=models.CASCADE) # images/serializers.py """ Serializers for uploading images. """ import os from rest_framework import serializers from images.models import Image from images.utils import resize_image class ImageSerializer(serializers.Serializer): """Serializer for Image model.""" def __init__(self, instance=None, height=None, **kwargs): """Add height parameter to serializer contructor.""" super().__init__(**kwargs) self.height = height id = serializers.IntegerField(read_only=True) img = serializers.ImageField() def create(self, validated_data): """Assign uploaded image to authenticated user.""" return resize_image( user=self.context['request'].user, height=self.height, image=validated_data['img'] ) def validate_img(self, value): """Validate file extension.""" _, extension = os.path.splitext(value._get_name()) if extension not in ('.jpg', '.png'): raise serializers.ValidationError('Invalid file extension.') return value class BasicTierUserSerializer(ImageSerializer): """Serializer for Basic tier user.""" thumbnail_200px = serializers.SerializerMethodField() def get_thumbnail_200px(self, obj): return ImageSerializer(obj, height=200).data # images/utils.py """ Utility functions for manipulating uploaded images. """ from PIL import Image from config import celery_app from images.models import Image @celery_app.task(bind=True) def resize_image(self, user, image, height): if not height: return Image.objects.create( user=user, img=image, ) new_height = height new_width = int(image.width * (new_height / image.height)) return Image.objects.create( user=user, img=image.resize((new_height, new_width)), ) I want to return response … -
Deploying a Django-React app to Heroku: how to run npm and webpack
I'm currently trying to deploy a Django-React application to heroku using their build manifest approach. I have been roughly following this tutorial for configuring the relationship between React and Django. Everything works well locally with my React application rendering correctly and sending/receiving HTTP requests from the Django backend as expected. The problem comes when I try to deploy to production using the heroku build manifest. I can build and deploy to Heroku just fine, but the heroku app cannot find my "main.js" static file, which is the entry point to my react application. heroku.yml file looks as follows: build: docker: web: dockerfile: Dockerfile.heroku release: image: web command: - cd front_end && npm run dev run: web: gunicorn focal_point.wsgi:application --bind 0.0.0.0:$PORT where Dockerfile.heroku looks as follows: FROM python:3.9 AS back_end ENV NODE_VERSION=16.13.0 RUN apt install -y curl RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash ENV NVM_DIR=/root/.nvm RUN . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION} RUN . "$NVM_DIR/nvm.sh" && nvm use v${NODE_VERSION} RUN . "$NVM_DIR/nvm.sh" && nvm alias default v${NODE_VERSION} ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}" RUN node --version RUN npm --version WORKDIR /focal-point/front_end/ COPY ./front_end/package*.json /focal-point/front_end/ RUN npm install COPY ./front_end /focal-point/front_end/ EXPOSE 3000 ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 ENV DEBUG 1 WORKDIR /focal-point COPY ./Pipfile … -
How to hook up DRF ModelViewset to the app's root
I have a small django app with a single ViewSet that extends DRF's ModelViewSet. I've tried attaching it to the app's root url like so urlpatterns = [ path(r"", NotificationViewSet.as_view(), name="company"), ] But this is causing an error: TypeError: The actions argument must be provided when calling .as_view() on a ViewSet. For example .as_view({'get': 'list'}) The error is helpful enough to show how to map the get method and github copilot suggests: urlpatterns = [ path( r"", NotificationViewSet.as_view( { "get": "list", "post": "create", "patch": "partial_update", "delete": "destroy", } ), name="company", ), ] But I'm not sure this is correct. And this doesn't appear to handle retrieve which would require a URL parameter. I am surprised I have to be so explicit. Surely there is an easier way. -
Can't submit options in dropdown using bootstrap 5 in Django
I will use the dropdown in the registration system and the menus will have business and customer, how can I present them separately? enter image description here this register page enter image description here this register page views.py folder -
Call a viewset in another viewset with POST method
I want to call a function of a viewset in another viewset, with POST method. I succeed this with GET : params = {"number" : 44} zm = ZoneViewSet.as_view({"get": "zm"})(request._request, **params).render().content but, I can't with POST, I don't known how to do that :(, I've this error "GET method not allowed" : params = { "target": datetime.now().strftime(self.format_date), "value": 9, "origin": "auto", } post_zm = AccessViewSet.as_view({"post": "add"})(request._request, **params).render().content Can you help me please ? Thanks F. -
Pass in dynamic href using Django include template tag AND url tag
I'm trying to reuse a component and invoke it multiple times using the include tag. But when I want to pass in a url, I can't figure out the syntax. Usually it would be something like: <a href="{% url 'slug' %}">{{link_title}}</a> But as I'm already using an include, I want to do something equivalent to: # parent template: {% include 'my-template.html' with slug='someslug' link_title='My Link Title' %} # include template: <a href="{% url '{{slug}}' %}">{{link_title}}</a> I currently get django.urls.exceptions.NoReverseMatch from this code -
nginx+uwsgi stops responding after auto reload
I have a docker container based off Alpine 3.16 It runs nginx/uwsgi with supervisord for a django based app. This Dockerfile has been pretty much the same for several years now. Auto reload worked fine. Suddenly today after the container rebuilt, auto-reload fails in a strange way - it get hung up for minutes and then works - here is the log: 2023-02-20 14:57:28,771 INFO RPC interface 'supervisor' initialized 2023-02-20 14:57:28,771 INFO RPC interface 'supervisor' initialized 2023-02-20 14:57:28,771 INFO supervisord started with pid 1 2023-02-20 14:57:28,771 INFO supervisord started with pid 1 2023-02-20 14:57:29,774 INFO spawned: 'nginx' with pid 7 2023-02-20 14:57:29,774 INFO spawned: 'nginx' with pid 7 2023-02-20 14:57:29,777 INFO spawned: 'uwsgi' with pid 8 2023-02-20 14:57:29,777 INFO spawned: 'uwsgi' with pid 8 [uWSGI] getting INI configuration from /usr/lib/acme/lib/wsgi/uwsgi.ini 2023-02-20 14:57:29 - *** Starting uWSGI 2.0.21 (64bit) on [Mon Feb 20 14:57:29 2023] *** 2023-02-20 14:57:29 - compiled with version: 12.2.1 20220924 on 15 February 2023 09:44:04 2023-02-20 14:57:29 - os: Linux-6.1.11-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 09 Feb 2023 20:06:08 +0000 2023-02-20 14:57:29 - nodename: b5d838731ef0 2023-02-20 14:57:29 - machine: x86_64 2023-02-20 14:57:29 - clock source: unix 2023-02-20 14:57:29 - pcre jit disabled 2023-02-20 14:57:29 - detected number of … -
'Response' object has no attribute 'get' in django
AttributeError: 'Response' object has no attribute 'get' in django enter image description here -
Static files not loading in django app + nginx server + docker
I have a django app I want to host on virtual machine via a docker container and I am using an nginx server to run the application. The problem now is i am not sure how to configure the nginx server to ensure that static files are being served. This is how the admin page loads without static files Here are my configuration files Dockerfile FROM python:3.10 ENV PYTHONUNBUFFERED=1 RUN mkdir -p /kings WORKDIR /kings COPY requirements.txt /kings/requirements.txt COPY ./kings /kings RUN pip install -r /kings/requirements.txt COPY ./entrypoint.sh /kings/entrypoint.sh CMD ["sh", "/kings/entrypoint.sh"] docker-compose.yml version: '3' services: kings-app: build: context: . dockerfile: ./DockerFile volumes: - .:/kings ports: - "8000:8000" image: kings-app:kings container_name:kings-ap depends_on: - kings-redis environment: - DB_NAME=${DB_NAME} - DB_USER=${DB_USER} - DB_PASSWORD=${DB_PASSWORD} - DB_HOST=${DB_HOST} - DB_PORT=${DB_PORT} - ALLOWED_HOSTS=${ALLOWED_HOSTS} - REDIS_HOST=${REDIS_HOST} - REDIS_PORT=${REDIS_PORT} kings-redis: image: redis:alpine container_name: kings-redis nginx: image: nginx:alpine container_name: kings-nginx ports: - "1337:80" volumes: - ./nginx/default.conf:/etc/nginx/nginx.conf - ./static:/kings/static depends_on: - kings-app nginx.conf worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; upstream app_server { server kings-app:8000; } server { listen 80; server_name localhost; location /static/ { alias /kings/static/; } location / { proxy_pass http://app_server; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; … -
How to convert date in python
Iam using fullcalendar fullcalendar From my web template iam getting 2 dates in django a startdate and an enddate Getting my startdate: start = request.GET.get('start', None) I need a datetime for my django model, so iam getting an error: django.core.exceptions.ValidationError: ['“Mon Feb 20 2023 16:07:47 GMT+0100 (Midden-Europese standaardtijd)” value has an invalid format. It must be in YYYY-MM-DD HH:MM[:ss[.uuuuuu]][TZ] format.'] Can i convert it to datetime? -
Django-Delete window/Browsing history
I want to delete the browsed pages record from browser back button and want to redirect to a specific page. Is there a way to do this? -
How to create a django generic relation to the same model like foreignkey to self
I am building a comment model which i made generic using the django recommended way like so class GenericRelationship(models.Model): content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE) object_id = models.PositiveIntegerField() content_object = GenericForeignKey() date_created = models.DateTimeField(default=timezone.now) class Meta: abstract = True class Comment(GenericRelationship): created_by = models.ForeignKey( "account.User", on_delete=models.CASCADE, related_name="comments", related_query_name="comment", ) mentions = models.ManyToManyField( "account.User", related_name="mentions", related_query_name="mention" ) content = QuillField() text_content = models.TextField() likes = GenericRelation(Liked, related_query_name="comment") class Meta: ordering = ["-date_created"] indexes = [ models.Index(fields=["content_type", "object_id"]), ] def __str__(self): return self.created_by.username but in my case a comment can also have comments and i want a reverse relationship(related_query_name) with itself and wont be able to refer to the Comment class like so class Comment(GenericRelationship): ... comments = GenericRelation(Comment, related_query_name="comment") i dont know if i could use a string with self inplace of concrete class i tried using the self but i dont know if its correct cause no real migrations can be made since it's just a reverse relationship: therefore i wont be able to see errors -
I got a problem with send a random message from DRF to all users(Aiogram)
The code doesn't throw any errors, but it doesn't work the way I would like it to. It doesn't send the message to the users. I put a print on the time function, but apparently it didn't work. I've been messing around with this for a very long time and don't understand where I went wrong from aiogram import Bot from aiogram.types import ParseMode from aiogram.utils import exceptions from servises.advertisement_services import advertisements_service from servises.subscription_services import subscription_service async def send_message(user_id, message): try: await Bot.send_message(chat_id=user_id, text=message, parse_mode=ParseMode.HTML) except exceptions.BotBlocked: print(f"Target \[ID:{user_id}\]: blocked by user") except exceptions.ChatNotFound: print(f"Target \[ID:{user_id}\]: invalid user ID") except exceptions.RetryAfter as e: print(f"Target \[ID:{user_id}\]: Flood limit is exceeded. Sleep {e.timeout} seconds.") await asyncio.sleep(e.timeout) return await send_message(user_id, message) except exceptions.TelegramAPIError: print(f"Target \[ID:{user_id}\]: failed") async def send_message_to_all_users(message): users = subscription_service.get_users() for user in users: user_id = user\['account_id'\] await send_message(user_id, message) async def send_random_message_to_all_users(): current_time = datetime.datetime.now().strftime('%H:%M') print(f"Current time: {current_time}") if current_time == '17:20': response = advertisements_service.all_advertisement() messages = response.json() message = random.choice(messages) await send_message_to_all_users(message) async def scheduler(): while True: await send_random_message_to_all_users() await asyncio.sleep(5) if __name__ == "__main__": loop = asyncio.get_event_loop() loop.create_task(scheduler()) loop.run_forever() -
Excluded fields is appears django fomrs
I wants to exclude the email and image fields but during the rendering it still shows both fields.. class UserRegisterForm(UserCreationForm): username = forms.CharField(max_length=10, widget=forms.TextInput(attrs={'class': 'form-control','placeholder':'username'})) email = forms.EmailField(max_length=20, widget=forms.EmailInput(attrs={'class': 'form-control','placeholder':'Email'})) password1 = forms.CharField(label="Password", widget=forms.PasswordInput(attrs={'class': 'form-control','placeholder':'Password'})) password2 = forms.CharField(label="Confirm Password", widget=forms.PasswordInput(attrs={'class': 'form-control','placeholder':'Confirm Password'})) image = forms.ImageField(required=False) class Meta: model = User fields = ['username', 'password1', 'password2'] exclude = ('email','image',) profile.html <div class="col-sm-5 offset-1"> <div class="form-group"> <form method="post"> {% csrf_token %} {{ form|crispy }} <div class="text-center mt-3"> <button type="submit" class="btn btn-primary btn-lg">Update</button> </div> </form> </div> Additionally when I tried fields = "__all__" exclude = ('email','image',) it shows information such as Last login,Superuser status,Groups which is visible at /admin [] How can i render only specific fields..? -
Django transaction rollback failed
I have problems in facing for transaction rollback. So I try to change the is_active status. As I input 10 for is_active(BooleanField), Validation Error will be raised as 10 is invalid. When I excute the following codes, id=2 's status will change to 1 and id="5" status will not be changed. What I want is I want even id="2" status also rollback and does not change. Could any please kindly assist? data = { "2":"1", "5":"10" } save_id = transaction.savepoint() try: with transaction.atomic(): for key, value in data.items(): User.objects.filter(id=key).update(is_active=value) except Exception as e: print(e) transaction.savepoint_rollback(save_id) return False transaction.savepoint_commit(save_id) return True I want even id="2" status also rollback and does not change. Could any please kindly assist? -
Integrity Error in Django project (NOT NULL constraint failed)
I am making auctions site right now and when i try to set my boolean to True/False by clicking a button, i get this error: NOT NULL constraint failed: auctions_bid.bid_offer It revealed after I added listing.save() to POST button Here is the code: Views: if request.method == "POST": # listing.owner = bid_owner # listing.price = bid_offer listing.isActive = False listing.save() Here is where i get error if request.method == "POST": #BID FORM new_bid = request.POST.get("new_bid") f = Bid(bid_offer = new_bid, listing_offer = listing, bid_owner = request.user) f.save() return HttpResponseRedirect(f'./{itemID}') Form itself: <form action = "{% url 'auctions:listing' itemID %}" method = "post"> {% csrf_token %} {%if user.id == owner.id%} <input type = "submit" value = "Accept" id = "accept_bid"> {% endif %} </form> Bid model: class Bid(models.Model): bid_offer = models.IntegerField() listing_offer = models.ForeignKey(Listing, on_delete = models.CASCADE, related_name = "listings", null = True) bid_owner= models.ForeignKey(User, on_delete = models.CASCADE) Listing Model: class Listing(models.Model): title = models.CharField(max_length= 64) description = models.CharField(max_length= 128) img = models.ImageField(upload_to = 'auctions/media/images') isActive = models.BooleanField(default= True, blank=True) owner = models.ForeignKey(User, on_delete = models.CASCADE, related_name="user") categories = models.ForeignKey(Category, on_delete = models.CASCADE, blank= True, null = True, related_name = "category", default = "None") price = models.IntegerField(default = 0) When I … -
How to debug a dockerized django in Visual Studio Code?
I am facing problems integrating the VS Code debugger into my project which is dockerized. About my project, it was not made by me, so as much I entered before, I am facing some challenges with Docker, but also learning. We use this command to access the local host: docker-compose -f docker-compose.dev.yml up -d And this is the docker-compose.dev which is here as file: /.vscode /config /example_app ... .dockerignore .gitignore docker-compose.dev #The one who we up And this is the file volumes: postgres_data_test: {} hashes: {} product_api_root: {} services: postgres: image: postgres:10 volumes: - postgres_data_test:/var/lib/postgresql/data - ./backups:/backups ports: - "8889:5432" environment: - POSTGRES_USER=example - POSTGRES_PASSWORD=example django: build: context: . dockerfile: Dockerfile.dev command: python /app/manage.py runserver 0.0.0.0:8000 volumes: - .:/app - hashes:/hashes - product_api_root:/product-api-root ports: - "8000:8000" environment: - POSTGRES_USER=example - POSTGRES_PASSWORD=example - DATABASE_URL=postgres://example:example@postgres:5432/example - REDIS_URL=redis://redis:6379/0 - DJANGO_SETTINGS_MODULE=config.settings.local depends_on: - postgres - redis redis: image: redis:6.2.6 I have been trying two options to debug it First option This is the one which VS Code itself documented which is configuring the tasks.json and launch.json inside the .vscode folder: For reference: https://code.visualstudio.com/docs/containers/debug-python This is the launch.json that I tried (I tried a lot but this was the last one, the others I tried … -
Inertia Link not redirecting on click (this.resolveComponent is not a function)
I'm trying to get Django, Inertia and Vue running. I followed this doc (including the referred ones inside that): https://pypi.org/project/inertia-django/ While it works basically (the Vue pages/components render, pages load), I can't use the <Link> component. It renders and shows the correct destination on hovering, but when you click on it, the console shows Uncaught (in promise) TypeError: this.resolveComponent is not a function and it's not redirecting. Although it's changing the page, I can see the corresponding get request in the django server console. The router.visit() function works fine. main.html {% load django_vite %} <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> {% vite_hmr_client %} {% vite_asset 'js/main.js' %} <title>Django-mysite</title> <script src="https://cdn.tailwindcss.com"></script> </head> <body> {% block inertia %}{% endblock %} </body> </html> main.js import 'vite/modulepreload-polyfill' import {createApp, h} from 'vue'; import {createInertiaApp } from '@inertiajs/vue3'; const pages = import.meta.glob('./pages/**/*.vue'); createInertiaApp({ resolve: async name => { return (await pages[`./pages/${name}.vue`]()).default }, setup({el, App, props, plugin}) { const app = createApp({render: () => h(App, props)}) app.use(plugin) app.mount(el) }, }) vite.config.js const { resolve } = require('path'); import vue from '@vitejs/plugin-vue'; module.exports = { plugins: [vue()], root: resolve('./static/src'), base: '/static/', server: { host: 'localhost', port: 3000, open: false, … -
Django: Internal error popped in the first page of list view but normal in other pages
My project has an Order model and a corresponding ListView integrated with a Paginator. I run the code successfully in local development. There is no problem rendering the first and other pages of orders. Also, even after I deployed my project on Heroku, it rendered perfectly. However, the ListView now popped out internal error when I was viewing the first page but no problem at all in case of other pages (e.g page 2, 3 etc). Having checked all the codes in the template, view and model, I still couldn't find the problem. Any insights on this please? What other part am I missing? Thank you. -
Django duplicate column name after dropping and re-creating table
I'm new to Django and am working on my first project. I have multiple tables in the project (I'm using the default sqlite3). One of the tables 'C' is empty. All of the other tables have already been populated with data. Among them table 'M' has a foreign key that is linking it to C's id field (c_id). At some point I changed the max_length of C's id field (c_id) from 5 to 4. I run migrations after that and got an error: django.db.utils.IntegrityError: The row in table 'myapp_M' with primary key '00001' has an invalid foreign key: myapp_M.c_id contains a value '' that does not have a corresponding value in myapp_C.c_id. the field 'c' in 'M' table that is a foreign key has blank=True. I tried adding null=True and running migrations again but it did not help. I decided that maybe dropping the C table, since it's still empty, and creating it again might solve the problem. I have dropped it manually using SQL DROP TABLE, and then used this tutorial to re-create it: https://techstream.org/Bits/Recover-dropped-table-in-Django When I'm running the migrations I am getting the error: django.db.utils.OperationalError: duplicate column name: c_id (which is the first column defined in my model) … -
How to have vscode syntax highlight for django template tag in js
Is there a way to have a proper django syntax highlight in vscode when using django template tag in a tag in templates ? -
How to run a bokeh server app without 'bokeh server --show' command in Django project?
I have a Django project in which I need to add graphs with python callbacks implemented in Bokeh. How to run a bokeh server app from django view without 'bokeh server --show my_app.py' command? I found realization with commandline, but I don't know how i should retun it as HTTPResponse from the Django view. -
Test email does not arrive in mail.outbox when sent by Django-RQ worker
I've set up a test within Django that sends an email, in the background, using Django-RQ. I call the code that enqueues the send_email task, then, I get the django-rq worker, and call .work(), with burst=True. In my console, I can see the django-rq worker picking up the job, and confirming that it's been processed successfully. However, the email never arrives in Django's test mail.outbox. Here is the test code: def test_reset_password(self): c = Client() page = reverse_lazy("accounts:password_reset") response = c.post(page, {'email': 'joe@test.co.uk'}) self.assertRedirects(response, reverse_lazy("accounts:login"), 302, 200) django_rq.get_worker(settings.RQ_QUEUE).work(burst=True) self.assertEqual(len(mail.outbox), 1) self.assertEqual(mail.outbox[0].subject, 'Password reset instructions') And here's the output from the console when the test is run: Found 2 test(s). Creating test database for alias 'default'... System check identified no issues (0 silenced). .Worker rq:worker:0e599ef7e7e34e30a1b753678777b831: started, version 1.12.0 Subscribing to channel rq:pubsub:0e599ef7e7e34e30a1b753678777b831 *** Listening on default... Cleaning registries for queue: default default: send() (214c3a65-c642-49f2-a832-cb40750fad2a) default: Job OK (214c3a65-c642-49f2-a832-cb40750fad2a) Result is kept for 500 seconds Worker rq:worker:0e599ef7e7e34e30a1b753678777b831: done, quitting Unsubscribing from channel rq:pubsub:0e599ef7e7e34e30a1b753678777b831 F ====================================================================== FAIL: test_reset_password (accounts.tests.AccountsTest.test_reset_password) ---------------------------------------------------------------------- Traceback (most recent call last): File "/workspace/accounts/tests.py", line 30, in test_reset_password self.assertEqual(len(mail.outbox), 1) AssertionError: 0 != 1 ---------------------------------------------------------------------- Ran 2 tests in 1.686s FAILED (failures=1) Is it possible the email is going to … -
Django Channels Data Compression
Is there a way to compress stream data sent via Django-Channels consumer? Couldnt find any information in Documentation. Is it not recommended to compress stream data?