Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Docker compose [emerg] 1#1: host not found in upstream "app" in /etc/nginx/conf.d/default.conf:9
I am trying to develop a Django application with Nginx and dockerize it. When running the docker compose I am getting the error proxy_1 | 2020/08/05 21:34:49 [emerg] 1#1: host not found in upstream "app" in /etc/nginx/conf.d/default.conf:9 proxy_1 | nginx: [emerg] host not found in upstream "app" in /etc/nginx/conf.d/default.conf:9 django_proj_proxy_1 exited with code 1 This is my docker file: FROM ubuntu:20.04 ENV TZ=America/New_York RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone RUN apt-get update -y && \ apt-get install -y python3-pip python-dev && \ apt-get install -y wget RUN python3 -m pip install --upgrade pip ENV PATH="/scripts:${PATH}" COPY ./requirements.txt /requirements.txt RUN pip install -r /requirements.txt RUN mkdir /app COPY ./app /app WORKDIR /app COPY ./scripts /scripts RUN chmod +x /scripts/* RUN mkdir -p /vol/web/media RUN mkdir -p /vol/web/static CMD ["entrypoint.sh"] This is my docker compose file: version: '3.7' services: app: build: context: . volumes: - static_data:/vol/web environment: - SECRET_KEY=samplesecretkey123 - ALLOWED_HOSTS=127.0.0.1, localhost, 0.0.0.0 proxy: build: context: ./proxy volumes: - static_data:/vol/static ports: - "8080:8080" depends_on: - app volumes: static_data: I also have a folder named proxy which contains default.conf, Dockerfile, uwsgi_params in the same directory. default.config: server { listen 8080; location /static { alias /vol/static; } location / { … -
send API exception over Django Channels websocket
I'm trying to implement a WebSocket in my Django API and I'm having trouble understanding the consumption process of the WebSocket. The basic idea of the socket is that the API receives a sort of "I'm Alive" pings from a camera every minute from one side and with the socket on the other side alert the front hand if there's not ping (i.e the camera is offline). I have successfully connected to the socket from the browser's console But no message is getting in, So I don't know if something's wrong with the socket, my browser's code, or is there something I haven't implemented. consumers.py class CameraOffline(APIException): status_code = 503 default_detail = 'Camera is currently offline' default_code = 'camera_offline' class CameraOnline(APIException): status_code = 207 default_detail = "camera is online" default_code = "camera_online" class CameraOnlineConsumer(AsyncJsonWebsocketConsumer): async def connect(self): await self.accept() check_data = await database_sync_to_async(self.check_events)() return check_data def check_events(self): queryset = CameraEvents.objects.filter(result=7).order_by('-time_stamp')[:2] minute_delta = timedelta(seconds=60) query_set = queryset difference = query_set[0].time_stamp - query_set[1].time_stamp if difference <= minute_delta: return CameraOnline() else: raise CameraOffline() async def disconnect(self, close_code): """ destroy the user's group & workflow when they disconnect """ await self.channel_layer.group_discard("workflow", self.channel_name) logger.info(f"Removed {self.channel_name} channel from workflow") routing.py: from django.urls import re_path from farm_api … -
Post.creator" must be a "Creator" instance. I don't understand why am having this error,
Cannot assign "<SimpleLazyObject: <User: Naza>>": "Post.creator" must be a "Creator" instance.I have already overridden the form_valid method. I don't know if this will help but for the first time i'm using this settings.AUTH_USER_MODEL instead of the normal user i always use and i'm also using form_class on the CBV CreateView because i want to be able to style the form. -
Django ListView of instances of an attribute
learning Django here and have a simple question that I'm struggling with. I'd like to make a page that is a list of the "Billing Month"s of Projects. Currently Project.project_billing_month is simply a CharField. I'd like the HTML page to list the months, i.e. "JAN_2020", "FEB_2020", "MAR_2020", etc, where I can create URLs to click through to a list of projects billed that specific month. From Models.py: from django.db import models from django.urls import reverse class Project(models.Model): project_name = models.CharField(max_length=100) inventory_number = models.CharField(max_length=20) creation_date = models.DateField() project_billing_month = models.CharField(max_length = 20, default='JAN_2020') From Views.py: class BillingMonthList(LoginRequiredMixin, ListView): model = Project template_name = 'billing_month_list.html' HTML: <tbody> {% for month in billing_month_list %} <tr> <td>{{ month }}</td> </tr> {% endfor %} -
Django model field clashes with other model field that doesn't exist?
I'm getting this error: ERRORS: pokollector.CustomPokemon.poke_id: (models.E006) The field 'poke_id' clashes with the field 'poke_id' from model 'pokollector.pokemon'. Here's the relevant code: class Pokemon(models.Model): poke_name = models.CharField(max_length=30) poke_type = models.ManyToManyField(PokeType) evolves_from = False evolves_into = False gen_added = models.PositiveIntegerField(validators=[min(1), max(gen)]) class Meta: verbose_name_plural = 'Pokemon' def __str__(self): return self.poke_name class CustomPokemon(Pokemon): #Add name and level for user's specific Pokemon poke_id = models.ForeignKey(Pokemon, on_delete=models.CASCADE, related_name='poke_id', verbose_name='Pokemon ID') name = models.CharField(max_length=30, blank=True) level = models.PositiveIntegerField(blank=True, null=True) #add owner attr class Meta: verbose_name_plural = 'Custom Pokemon' def save(self): if not self.name: self.name = self.poke_name super().save() def __str__(self): return self.name As you can see, I have two models, one of which inherits from the other. The error in question relates to the poke_id field in CustomPokemon. I thought this might be some weird conflict caused by inheritance, but if I change the field name to pokemon_id, the issue is resolved. While a workaround like that gets my code running, I'm curious what the underlying principle is here; Why does the exact same code run after adding those three letters? -
Django ValueError 'didn't return an HttpResponse object'
I have just started learning Python and Django. I was trying to create a simple blog website and ran into this error while updating the post. Django gives me this error when I try to update the post. Everything else seems to be working fine and I can update the post from admin. Error: ValueError at /post/4/ The view posts.views.PostDetailView didn't return an HttpResponse object. It returned None instead. Here is my code for the UpdateViews.py class PostUpdateView(LoginRequiredMixin, UserPassesTestMixin, UpdateView): model = Post form_class = PostForm def form_valid(self,form): form.instance.author = self.request.user return super().form_valid(form) def test_func(self): post=self.get_object() if self.request.user == post.Author: return True return False Here is my code for DetailView: class PostDetailView(DetailView): model = Post template_name = 'posts/post.html' context_object_name = 'obj' form = CommentForm def get_object(self): obj = super().get_object() if self.request.user.is_authenticated: PostView.objects.get_or_create(user=self.request.user,post=obj) return obj def get_context_data(self, *args, **kwargs): CatCount = Category_Count() context = super().get_context_data(*args, **kwargs) context['latest'] = Post.objects.order_by('-date_added')[0:3] context['Category_Count'] = CatCount context['form'] = self.form return context def post(self, request, *args, **kwargs): form = CommentForm(request.POST) if form.is_valid(): post = self.get_object() form.instance.Author = request.user form.instance.post = post form.save() return redirect(reverse("post", kwargs={ 'pk': post.pk })) I have no idea why it's returning me this error, so any solution would be appreciated. Thank You … -
Getting a FieldError when trying to populate my models with fake date, python
.When I run my population script using Faker to get fake data for my database i get this error, what is a fix for this? -
Why does django-compressor-postcss fail to compile static files only on Windows?
I am trying to get my Django app working on my Windows PC so I can more easily develop it in my preferred environment and whatnot. It works on the Ubuntu server I have been running it on, but not locally. Here's the error I've been getting: compressor.exceptions.FilterError: Input Error: You must pass a valid list of files to parse I have identified this as coming from npm postcss-cli, which django-compressor-postcss (which I use for tailwindcss and autoprefixer) makes use of. I made sure to make an exception in settings.py so that on Windows the STATIC_ROOT changes to a directory that actually can and does exist (C:\var\www\project_name\static\). I have also verified that django-compressor works on its own, which at least means it can find the files and compress them into the STATIC_ROOT. Here's the success response for that: [05/Aug/2020 15:10:02] "GET /static/CACHE/css/output.815596d438c0.css HTTP/1.1" 200 94 At this point I don't know what to do. Somehow, the postcss-cli call isn't receiving the files or something, and I don't know how to troubleshoot that. I would love to know what circumstances have caused people to get the above error from postcss-cli in any context. That way I might be able to better … -
SMTPSenderRefused at /Contact/ (530, b'5.7.0 Authentication Required. Learn more at\n5.7.0
I want the users of my website after the login with gmail account using the google api to send to the account1@gmail.com email after entring the name and the email address and the message in the contact.html but i get this error despite i have activated the 2 factor authentication for the account1@gmail.com and create a password for my website . this is my function contact in my views.py: def contact(request): if request.method=='POST': message_name=request.POST['message-name'] message_email=request.user.email message=request.POST['message'] print(message_email) send_mail( message_name, message, message_email, ['account1@gmail.com'], fail_silently=False ) return render(request,'store/Contact.html',{'message_name':message_name}) else: return render(request,'store/Contact.html',{} and this the settings.py: EMAIL_BACKEND="django.core.mail.backends.smtp.EmailBackend" EMAIL_HOST='smtp.gmail.com' EMAIL_PORT=587 EMAIL_HOST_PASSWORD='password_of_the_app' EMAIL_USE_TLS=True EMAIL_USE_SSL=False AUTHENTICATION_BACKENDS = ( 'django.contrib.auth.backends.ModelBackend', 'allauth.account.auth_backends.AuthenticationBackend', ) SITE_ID= 14 LOGIN_REDIRECT_URL= '/' but when i add the EMAIL_HOST_USER='account1@gmail.com' i can send the email from the account1@gmail.com to account1@]gmail.com but not from the email feild that exist in my template. really any help is appreciated -
Updating Record with ModelForm
I am working on calling up a pre-populated form based on user input. I want to allow editing of the record in the resulting form, and then save the updates to the DB Record. Below is not working and I'm stuck on next steps. def mod_customer(request): params = json.loads(request.body) selection = params['cst_id'] obj = AppCustomerCst.objects.get(id_cst=selection) instance = get_object_or_404(AppCustomerCst, id_cst=selection) form = CustomerMaintForm(request.POST or None, instance=instance) if '_edit' in request.POST: if form.is_valid(): form.save() return redirect('customers') elif form.is_valid() and '_delete' in request.POST: # just for testing purposes. once mod is working, will update with delete # AppCustomerCst.objects.filter(id_cst=selection).delete() context = {'form': form} return render(request, 'mod_customer.html', context=context) else: context = {'form': form} return render(request, 'mod_customer.html', context=context) -
How to make a Django filter display only to some users?
I'm working on a Django project, and want to know how can I make it so that a filter field displays only if the user is a superuser. My filter looks like this: class OrderFilter(FilterUserMixin): customer = django_filters.CharFilter(label='Cliente', method='filter_name') def filter_name(self, queryset, name, value): queryset = queryset.filter(customer__phone__icontains=value) return queryset class Meta: model = Order fields = ("store", "customer", "date") filter_overrides = { models.CharField: { 'filter_class': django_filters.CharFilter, 'extra': lambda f: { 'lookup_expr': 'icontains', }, } } All normal users should be able to filter by customer and date, but only superusers should be able to filter by store, the rest of users should always see the orders of a single store, so no filtering the store. I don't know how can I accomplish this, I'm using this view: class OrderTableView(LoginRequiredMixin, PagedFilteredTableView): model = Order table_class = OrderTable template_name = 'order/order_list.html' paginate_by = 50 filter_class = OrderFilter formhelper_class = OrderFilterFormHelper exclude_columns = ('actions',) export_name = 'orders' def get_queryset(self, **kwargs): qs = super(OrderTableView, self).get_queryset() if self.request.user.profile.store is not None and self.request.user.is_superuser is False: qs = qs.filter(store=self.request.user.profile.store) qs = qs.filter(total__gt=0).filter(address__isnull=False).filter(location__isnull=False) return qs -
Django error rendering view caused by missing url args
I'm trying to render view after POST request. For some reason I cannot pass url parameters. This is interesting part of my view: class PageView(TemplateView): template_name = 'my_template.html' def post(self, request, *args, **kwargs): formset = MyFormset(request.POST) form = MyForm(data=request.POST) if formset.is_valid() and form.is_valid(): return self.form_valid(form, formset) return render(request, self.template_name, context={'form': form, 'formset':formset}) And my url template is: path('<int:type>/<slug:name>/', PageView.as_view(), name='page_view') Error I am getting is following: Reverse for 'page_view' with arguments '('', '')' not found. 1 pattern(s) tried: ['(?P<type>[0-9]+)/(?P<service>[-a-zA-Z0-9_]+)/$'] -
How to Solve Heroku Django Admin section
I have a problem with my heroku app, blog website I made with Django, when I am signed in as an Admin, no other user can sign up, it throws an error that sign up page does not exist. How do I solve this problem? -
Prepopulate non-model form attribute when instantiating in Django
I want to set a minimum value for a DecimalField attribute on a form at the time when I instantiate it in the view. And I want to get that minimum value from an object I gather from the database. I made it (sort of) work by manually putting in the html form in the template, but want to refactor it to use the form class because I can do more useful things with data in the view than I can in the template. Based on my reading of other questions and docs, I can't set attributes with the .initial argument. I thought likely I need to override the __init__ method on the form, but I'm pretty sure I'm not doing this right and it makes no sense syntactically. Here's what I have tried: class BidForm(forms.Form): bid = forms.DecimalField(decimal_places=2) listing_bid = forms.CharField(widget=forms.HiddenInput()) def __init__(self, min_bid, listing_pk, *args, **kwargs): super(BidForm, self).__init__(*args, **kwargs) self.fields['bid'].min = min_bid self.fields['listing_bid'] = listing_pk My idea is to have this form take a min_bid and a listing_pk, and fill the "min" attribute on the html input with whatever is in the min_bid variable. I want to put the listing_pk that's passed in as the value in a … -
Adding groups to choices class in Django
I have a choices class set up for a field in one of my Django models. I need to figure out how to group this class and then refer back to the group name when looking for a match from a form. In case that isn't totally clear, I want users to be able to search for an object that is "inclusive" and pull back all of the objects with "inclusive". I've scoured the Django documentation, but haven't seen any examples that use groups on the choices class. The syntax in the enum example below threw a ton of errors so it doesn't seem to be quite what I need. Enum example from Django documentation MEDIA_CHOICES = [ ('Audio', ( ('vinyl', 'Vinyl'), ('cd', 'CD'), ) ), ('Video', ( ('vhs', 'VHS Tape'), ('dvd', 'DVD'), ) ), ('unknown', 'Unknown'), ] Here is a sample of the data. It is sort of working, but the human readable name (that should be the group) is showing multiple times in admin (one time for value 1, one time for value 2) and I'm having issues with getting "inclusive" on the form to pull all of the inclusive choices rather than just one. class CcugprofChoice(models.IntegerChoices): Two_year__higher_part_time … -
Issue to set cookie in browser with network load balancer and multiple Django servers
I use two EC2 instances and install django project on both of them and attach with single RDS and network load balancer to handle the load. Project is delivered perfectly. but when i open http://example.com/admin/ and try to login with superuser credential. It shows an error 403 forbidden 'Cookie is not set'. then i checked browser cookie. No csrftoken is present there. why it is happening i don't know. Please help me if anyone knows about it. Thanks in advance. -
Python KeyError: at / 'main'
city_info = { 'city': city.name, 'temp': res['main']['temp'], 'tempFeelsLike': res['main']['feels_like'], 'weatherDescription': res['weather'][0]['description'], 'icon': res['weather'][0]['icon'], 'windSpeed': res['wind']['speed'] } I am creating a weather app using OpenWeatherMap API and I have an error like KeyError at / 'main' Request Method: GET Request URL: http://localhost:8000/ Django Version: 3.1 Exception Type: KeyError Exception Value: 'main' Exception Location: C:\Users\vlads\WeatherApp\weather\views.py, line 26, in index Python Executable: C:\Users\vlads\AppData\Local\Programs\Python\Python38\python.exe Python Version: 3.8.3 Python Path: ['C:\\Users\\vlads\\WeatherApp', 'C:\\Users\\vlads\\AppData\\Local\\Programs\\Python\\Python38\\python38.zip', 'C:\\Users\\vlads\\AppData\\Local\\Programs\\Python\\Python38\\DLLs', 'C:\\Users\\vlads\\AppData\\Local\\Programs\\Python\\Python38\\lib', 'C:\\Users\\vlads\\AppData\\Local\\Programs\\Python\\Python38', 'C:\\Users\\vlads\\AppData\\Local\\Programs\\Python\\Python38\\lib\\site-packages'] Server time: Wed, 05 Aug 2020 20:25:55 +0000 Full code of the program, as follows: from django.shortcuts import render from .models import City from .forms import CityForm import requests def index(request): # This is MINE API key! You can change it to yours, if you need it. apiKey = '8bf70752121d2f2366e66d73f3445966' url = 'https://api.openweathermap.org/data/2.5/weather?q={}&units=metric&appid=' + apiKey if request.method == 'POST': form = CityForm(request.POST) form.save() form = CityForm() cities = City.objects.all() all_cities = [] for city in cities: res = requests.get(url.format(city.name)).json() city_info = { 'city': city.name, 'temp': res['main']['temp'], 'tempFeelsLike': res['main']['feels_like'], 'weatherDescription': res['weather'][0]['description'], 'icon': res['weather'][0]['icon'], 'windSpeed': res['wind']['speed'] } all_cities.append(city_info) context = {'all_info': all_cities, 'form': form} return render(request, 'weather/index.html', context) I tried to add [0] after the ['main'] but it was helpless. Stack Owerflow said, that my question is mostly code so I … -
Implicit auth flow for Shopify app using koa-shopify-auth
I have a React front end created by following: https://shopify.dev/tutorials/build-a-shopify-app-with-node-and-react It is a NextJs React app with a custom Koa server to serve the NextJs app. That Koa server uses the koa-ashopify-auth package to perform OAuth with Shopify and get an access token. This is the auth middleware code: server.use( createShopifyAuth({ apiKey: SHOPIFY_API_KEY as string, secret: SHOPIFY_API_SECRET_KEY as string, scopes: ['read_products'], afterAuth(ctx) { const { shop, accessToken } = ctx.session as IShopifyKoaSession >>> I would like to create a user on my own backend now and login the user. .... more stuff } }) ) I have a Django backend that I will be setting up a REST endpoint to do auth with my backend (I would like to use JWT). So I have performed OAuth with Shopify on client-side and have an access token How do I use this client side access token and securely create a new user on my backend in a secure way? I am thinking something like -> ... const { shop, accessToken } = ctx.session as IShopifyKoaSession await myApiService.createOrUpdateUser(shop, accessToken) // Calls my external backend How should I go about doing this? This is basically an implicit oauth flow. The above would not be … -
Redirect to same page or a special page on django
This funtion is to update an order, i would like to be redirected to the customer profile page where i can find all this customer's orders. on the costumer profile i have all orders listed with option to modify or delete. i would like to modify and to redirected to the same page, costumer profile page. def OrderUpdate(request, pk): order = Order.objects.get(id=pk) form = OrderForm(instance=order) if request.method == 'POST': form = OrderForm(request.POST, instance=order) if form.is_valid(): form.save() return redirect('orders') context = {'form':form} return render(request, 'orders/order_form.html', context) -
Django: how to make user chat function
I'm trying to implement this user chatting function on my django website, where users who are logged into my website can message each other through this feature! I'm thinking of creating a group collaboration website, where group chatting / one-by-one chatting are all available. I tried the django channels, from step one, but I had to give up because I had no idea how it worked :( Could you, program experts, please help me with this? It'll be amazing if I can manage to implement this feature on my website. Thank you all for helping me in advance!! -
file was loading in wrong encoding UTF-8: in pycharm when i trying compilemessages
Помогите если кто сталкивался с подобной проблемой. Я делал мультиязычность и в попытке compilemessages выводит "file was loading in wrong encoding UTF-8" эту ошибку уже прообовал ставить это - # -- encoding: UTF-8 -- в начале po документа не помогло Языки Русский и турецкий -
Implementing recaptcha in Django
I am trying to add recaptcha to my review form. I created an account and have the secret/public keys corrrect. The problem i have having is that when i go to submit the form, my views.py gets a response of None and an invalid-input-response. because of this, my review does not get created weather i click 'i am not a robot' or not. this is the logic to validate the recaptcha in views def create_review(request): if request.method == 'POST': ''' Begin reCAPTCHA validation ''' recaptcha_response = request.POST.get('g-recaptcha-response') url = 'https://www.google.com/recaptcha/api/siteverify' values = { 'secret': settings.RECAPTCHA_PRIVATE_KEY, 'response': recaptcha_response } data = urllib.parse.urlencode(values).encode() req = urllib.request.Request(url, data=data) response = urllib.request.urlopen(req) result = json.loads(response.read().decode()) ''' End reCAPTCHA validation ''' print(values) print(result) if result['success']: print(result['success']) name = request.POST.get('name') rating = request.POST.get('rating') message = request.POST.get('message') review = Testimonial(name=name, rating=rating, message=message) review.save() These are the variables that are printed {'secret': 'private_key', 'response': None} {'success': False, 'error-codes': ['invalid-input-response']} this is the html in my html form <div class="g-recaptcha" data-sitekey="public_site_key"></div> Any help is appreciated. Thank you. -
Passing parameters to a Django URL fails
I am trying to have a dummy call for the missing pages in a project so I can keep track of what is missing. A simple "In construction" page with the name of the missing link. Instead of putting the real link i put this in the calling html, vacia.html: <li><a href="{% url 'incid:xtodo' pagref='aquisalto' %}"> PuntoDeSalto </a></li> The url is decoded in urls this way: href="{% url 'incid:xtodo' pagref=aquisalto %}" It should go to incid/xtodo with the parameter "aquisalto" This is the xtodo code: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>En construcción</title> </head> <h1 align="left">EN CONSTRUCCIÓN</h1> <h1> <h1>{{pagref}}</h1> <div> <img src="http://{{ request.META.HTTP_HOST }}/static/logos/Under_construction_icon-orange.svg.png" width="300" height="250" alt="UnderConstruction"/> </div> </body> </html> And this is the xtodo view: def xtodo_view(request): # para pruebas, quitar global pagref if request.method == 'GET': pagref = request.GET.get('pagref', 'g') elif request.method == 'POST': pagref = request.POST.get('pagref', 'p') return render(request, 'incid/xtodo.html', {'pagref': pagref}) I do not find a way a form to make it work, and it should be so simple. I am using DJANGO 3 and Python 3. I have tried other call forms like : href="{% url 'incid:xtodo'?pagref='aquisalto' %}" or href="{% url 'incid:xtodo'%}?pagref='aquisalto'" with and without ? and with and without ' or " . … -
Django: why use uidb64? (in user email activation for example)
I want to implement user registration with email confirmation and I've noticed all of the tutorials are using User.id as in: In registration view: uid = urlsafe_base64_encode(force_bytes(user.pk)) it send email with link: domain.com/uidb64/token goes to activate view where uidb64 gets decoded back to User.id (uid): uid = urlsafe_base64_decode(uidb64) Question: Why is user.id gets encoded instead of just passing in url as it is? like: domain.com/id/token -
CRITICAL WORKER TIMEOUT in django cookie cutter with JsonResponse
I have the following logs $ docker logs 1e5e704507c2 PostgreSQL is available 2198 static files copied to '/app/staticfiles', 6582 post-processed. [2020-08-05 17:46:12 +0000] [10] [INFO] Starting gunicorn 20.0.0 [2020-08-05 17:46:12 +0000] [10] [INFO] Listening at: http://0.0.0.0:5000 (10) [2020-08-05 17:46:12 +0000] [10] [INFO] Using worker: sync [2020-08-05 17:46:12 +0000] [17] [INFO] Booting worker with pid: 17 [2020-08-05 17:46:12 +0000] [18] [INFO] Booting worker with pid: 18 [2020-08-05 17:46:12 +0000] [19] [INFO] Booting worker with pid: 19 [2020-08-05 17:46:12 +0000] [20] [INFO] Booting worker with pid: 20 INFO 2020-08-05 17:48:21,763 views 18 140288548957512 meeting_approve: [2020-08-05 17:48:51 +0000] [10] [CRITICAL] WORKER TIMEOUT (pid:18) [2020-08-05 17:48:51 +0000] [18] [INFO] Worker exiting (pid: 18) [2020-08-05 17:48:52 +0000] [21] [INFO] Booting worker with pid: 21 INFO 2020-08-05 17:52:06,252 views 17 140288548957512 meeting_approve: [2020-08-05 17:52:36 +0000] [10] [CRITICAL] WORKER TIMEOUT (pid:17) [2020-08-05 17:52:36 +0000] [17] [INFO] Worker exiting (pid: 17) [2020-08-05 17:52:36 +0000] [22] [INFO] Booting worker with pid: 22 and this is my view # views.py def approve(request, pk): logger.info("meeting_approve:") try: logger.info("approve: query company api") r = requests.get( f"{foo}/bar", timeout=5, ) except Timeout: messages.add_message( request, messages.WARNING, "Cannot connect to company api." ) logger.warn(f"meeting_approve: Cannot connect to company api") return JsonResponse({"error": "Cannot connect to company api"}, status=500) …