Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
[Nginx][Django] Cannot access the media files in production via Nginx
I am trying to access the media files using Nginx. The file exists in the directory: /usr/src/app/backend/media/profile/c4ebe33d-7da1-4a62-bb17-8da254d69b36, where the part profile/c4ebe33d-7da1-4a62-bb17-8da254d69b36 is created dynamically. The media root is: /usr/src/app/backend/media. I know the file exists cause I am able to see it in the container. This is my nginx config: proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=STATIC:10m inactive=7d use_temp_path=off; upstream backend { server backend:8000; } upstream frontend { server frontend:3000; } server { listen 80 default_server; server_name _; server_tokens off; gzip on; gzip_proxied any; gzip_comp_level 4; gzip_types text/css application/javascript image/svg+xml; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; client_max_body_size 100M; location /_next/static { proxy_cache STATIC; proxy_pass http://frontend; } location /static { proxy_cache STATIC; proxy_ignore_headers Cache-Control; proxy_cache_valid 60m; proxy_pass http://frontend; } location /media/ { autoindex on; alias /usr/src/app/backend/media/; } location / { proxy_pass http://frontend; } location /api/ { proxy_pass http://backend; proxy_set_header Host $http_host; } } When trying to access the file I get 404. This is the link to file: http://localhost/media/profile/c4ebe33d-7da1-4a62-bb17-8da254d69b36/da258fe5-f57c-44d2-94cf-00bef250b86d.png I tried modifying nginx, cause I think this is the reason, but without success. -
when I console.log fetched data it appears as undefined but it appears when I refresh
I have this function in react to fetch the data from my django api: const [filterData, setFilterData] = useState([]); const fetchFilterData = async () => { const filter_url = 'http://127.0.0.1:8000/api/filters/' try { const response = await fetch(filter_url) const result = await response.json(); setFilterData(result) } catch (error) { console.error('error fetching data: ', error); } } and when I try to console.log the data it is show as undefined at first but if I change something in the code (like add a white space or a new line) and save the fetched data appears and everything works fine but the issue is that I can't render that data or pass it down as a prop to other components here's the react useEffect hook: useEffect(() => { fetchData(); fetchFilterData(); }, []); and I have tried logging the data in several ways but no use it always returns undefined at first here are several ways I have tried: inside fetchFilterData function: if (filterData) {console.log(filterData.all_blocks) } else { console.log("this data is undefinde") } *and this has return undefinde as well and I still don't know why * passing it down as a prop to another component: return ( {filterData && <DropDown items={filterData.all_blocks} /> } ); … -
Django Deployment failed during build process on railway
When I deploy my Django app on rail after adding nessary variables and updated file everything done unless this failed do u know why and how to fix it Build logs on railway;here the problem how can i fix it"#8 [4/5] RUN pip install -r requirements.txt #8 0.343 /bin/bash: line 1: pip: command not found #8 ERROR: process "/bin/bash -ol pipefail -c pip install -r requirements.txt" did not complete successfully: exit code: 127 [4/5] RUN pip install -r requirements.txt: 0.343 /bin/bash: line 1: pip: command not found Dockerfile:15 13 | # build phase 14 | COPY . /app/. 15 | >>> RUN pip install -r requirements.txt 16 | 17 | ERROR: failed to solve: process "/bin/bash -ol pipefail -c pip install -r requirements.txt" did not complete successfully: exit code: 127 Error: Docker build failed I should note that when I try to run this command locally on my project file “ py manage.py collectstatic” some css file failed is it because that ? If it not plz tell me how can fix it -
Nothing happens when transferring data to the database
I have a problem. I'm new to django. And so the error lies in the fact that nothing happens during the data transfer. The database is not being updated. I will be very grateful for your help! this is code: registration/urls.py: from django.contrib.auth import views as auth_views from django.urls import path from . import views urlpatterns = [ path('/register', views.register, name='register'), ] registration/views.py: from django.shortcuts import render from django.contrib.auth import login, authenticate from django.shortcuts import render, redirect from .forms import RegistrationForm from django.shortcuts import render, redirect def sign_up(request): if request.method == 'POST': form = RegistrationForm(request.POST) if form.is_valid(): user = form.save() login(request, user) return redirect('home') else: form = RegistrationForm() return render(request, 'registration/register.html', {'form': form}) def register(): print("hello!") urls.py(In the project itself): from django.contrib import admin from django.urls import path, include from django.conf import settings from django.conf.urls.static import static from django.contrib.auth import views as auth_views from django.urls import path urlpatterns = [ path('admin/', admin.site.urls), path('', include('main.urls')), path('news/', include('news.urls')), path('accounts/', include('django.contrib.auth.urls')), ] urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) register.html: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Регистрация</title> </head> <body> <h1>Регистрация</h1> <form method="post" action="{% url 'register' %}"> {% csrf_token %} {{ form.email }} {{ form.password1 }} {{ form.password2 }} <button type="submit">Зарегистрироваться</button> </form> </body> </html> forms.py: from … -
Data Flow in Django Rest Framework?
I have recently started learning Django Rest Framework, and hit a little roadblock trying to understand the data flow in DRF. From what I understand, views take in a web request and return a web response, so they are the first component in the DRF data flow right? (after the urls). Then what's the second step? Views generally refer to a serializer, so does our serializer get executed next. If so, why not our model because serializer is used to convert complex data types such as model instances into JSON. I have this and a couple of related questions after going through the DRF docs tutorial part-4. CONTEXT: In the docs we are creating code snippets and now we want to associate users with the snippets they created. We follow the steps below in the following order to achieve this: Below in the tutorial, we are creating a serializer to represent a user. How does a serializer help in representing a user, aren't serializers used to convert data? 1 Adding endpoints for our User models Now that we've got some users to work with, we'd better add representations of those users to our API. class UserSerializer(serializers.ModelSerializer): snippets = serializers.PrimaryKeyRelatedField(many=True, queryset=Snippet.objects.all()) … -
Django Model Form, seems like there is an anomaly where my user creation form's clean_username method is not throwing a ValidationError when it should
Background I have a custom User model that I have extended from BaseUserManager and AbstractBaseUser. Similarly, I have a custom sign-up form that I've extended from UserCreationForm (all these custom items are extended from django.contrib.auth). The custom UserCreationForm I've made has a method called clean_username() that checks for usernames that do not have any alpha-numerical characters (-@, --_, +@-_, etc.) and throws a ValidationError if that is the case (aside: the method also checks for usernames that, when slugified, would result in non-unique slugs). Problem When I test the aforementioned ValidationError, it still is somehow returning the form as valid, which causes the rest of my view's logic to run, which causes the User Model's clean() method to run, and in the User Model's clean() method, I have the same checks I have in the form's clean_username() method (for User's created without using this particular form). These checks throw a ValueError, which is not ideal because I need the form to be re-rendered with the proper ValidationError message so that users can fix what's wrong and still sign up. None of this makes sense. I've put print messages in my clean_username() method so that I know for sure the branch … -
Cant run django-admin in windows11
I was trying to start a new project in django and ran into this error.enter image description here i already created venv and installed django with venv activated.But even after successfull installlation of django i can't run django-admin command (it gives above error). OS: Windows 11. python: 3.13.0a6 Django: 5.0.6 i was expecting to create a new django project using django-admin startproject ... -
I want to add CMS feature in my current website, which lib would you recommend?
Curretly, I want to add CMS feature in my current website, which lib would you recommend? Hi, I already using Django build a simple website, but don't have CMS feature yet. Recently, I want to add CMS feature in the website. Following is my search result, which would you recommend me to use? Thanks a lot. Wagtail 2.django CMS 3.Mezzanine 4.FeinCMS 5.Django Suit Thanks a lot. If you can share the experience, I will very appreciate. -
Displaying images from static folder in Django
We have a problem with displaying images on html pages. We create graph, save it and then pass it's url to html page via context, but django can't find the picture (Error 404 Not Found). There's no model to store urls as there's no need to access them later. Here's our views.py: def simple_upload(request): if request.method == 'POST' and request.FILES['file']: myfile = request.FILES['file'] fs = FileSystemStorage() filename = fs.save(myfile.name, myfile) uploaded_file_url = fs.url(filename) forecast, clean_df, graph_url = data_processing(myfile, filename) forecast = forecast.reset_index() cols_fc = forecast.columns.tolist() forecast[cols_fc[0]] = forecast[cols_fc[0]].dt.date forecast = forecast.values.tolist() clean_df = clean_df.reset_index() cols_df = clean_df.columns.tolist() clean_df[cols_df[0]] = clean_df[cols_df[0]].dt.date clean_df = clean_df.values.tolist() context = { 'filename': filename, 'cols_fc': cols_fc, 'forecast': forecast, 'cols_df': cols_df, 'clean_df': clean_df, 'graph_url': graph_url, } return render(request, 'project/results.html', context) return render(request,'project/example.html') Html document (result.html): <body> {% load static %} <p>{{ filename }}</p> <p>------------------------------------------------------</p> <div>{{ graph_url }}</div> <img src="{% static '{{ graph_url }}' %}"> <p style="color:red"> ------------ VALUES -----------</p> <p>{{ cols_df }}</p> {% for c in clean_df %} <p>{{ c.0 }} || {{ c.1 }}</p> {% endfor %} <p style="color:blue">------------- FORECAST -------------</p> <p>{{ cols_fc }}</p> {% for f in forecast %} <p>{{ f.0 }} || {{ f.1 }}</p> {% endfor %} </body> Function that creates, saves the … -
Mock patching an endpoint unittest that makes several requests to third party
I have a single endpoint written using django ninja. This endpoint executes a crawler that performs several requests. The sequence of requests has 3 different routines depending on whether or not the crawler already has valid login credentials in its session. I want to write e2e tests for these 3 routines and each of the possible exceptions that might be raised. The problem is there are up to 6 different requests in one sequence to a few different pages with a few different payloads. All I can think to do is patch each of these requests individually for each test but that is going to get ugly. My other thought is that I should just be satisfied with sufficient unit test coverage of the individual components of my crawler controller. Here is simplified code illustrating my issue api.py # This is what I want to test @api.get("/data/{data_id}") def get_data(request, data_id): controller = SearchController(crawler=Crawler, scraper=Scraper) response_data = controller.get_data(data_id) return api.create_response(request=request, data=response_data, status=200) # I have 5 of these right now and more to come @api.exception_handler(ChangePasswordError) def password_change_error_handler(request): data = { "error": "Failed to login", "message": "Provider is demanding a new password be set.", } return api.create_response(request=request, data=data, status=500) crawler.py Crawler(BaseAPI): def … -
KeyError error at /registration/register/ 'email'
I have a problem. When clicking on the link http://127.0.0.1:8000/accounts/register / returns the KeyError error at /accounts/register/ 'email'. I program in django in pycharm. I want to point out that there is a specific 'email' error here! this is code: registration/urls.py: from django.contrib.auth import views as auth_views from django.urls import path from . import views urlpatterns = [ path('/register', views.register, name='register'), ] registration/views.py: from django.shortcuts import render from django.contrib.auth import login, authenticate from django.shortcuts import render, redirect from .forms import RegistrationForm from django.shortcuts import render, redirect def sign_up(request): if request.method == 'POST': form = RegistrationForm(request.POST) if form.is_valid(): user = form.save() login(request, user) return redirect('home') else: form = RegistrationForm() return render(request, 'registration/register.html', {'form': form}) def register(): print("hello!") urls.py(In the project itself): from django.contrib import admin from django.urls import path, include from django.conf import settings from django.conf.urls.static import static from django.contrib.auth import views as auth_views from django.urls import path urlpatterns = [ path('admin/', admin.site.urls), path('', include('main.urls')), path('news/', include('news.urls')), path('accounts/', include('django.contrib.auth.urls')), ] urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) register.html: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Регистрация</title> </head> <body> <h1>Регистрация</h1> <form method="post" action="{% url 'register' %}"> {% csrf_token %} {{ form.email }} {{ form.password1 }} {{ form.password2 }} <button type="submit">Зарегистрироваться</button> </form> </body> </html> forms.py: from … -
How to reverse a URL in format namespace:view:endpoint?
I have a Django project with the following urlpattern defined on project level: urlpatterns = [ path('', include(('ws_shopify.urls', 'ws_shopify'), namespace='shopify')), ] The file ws_shopify.urls defines the following urlpatterns: urlpatterns = [ path('api/shopify/', ShopifyWebhookAPIView.as_view(), name='webhook'), ] The class ShopifyWebhookAPIView defines the following endpoint: from rest_framework.views import APIView class ShopifyWebhookAPIView(APIView): @action(detail=False, methods=['post'], url_path='(?P<webshop_name>.+)/order_created', name='order-created') def order_created(self, request: Request, webshop_name=None): return Response({'message': f'Order created for {webshop_name}'}) My question is: What is the correct name of this endpoint to be used in a test case using reverse()? I am trying this now: class WebhookTestCase(TestCase): def test_that_url_resolves(self): url = reverse('shopify:webhook:order-created', kwargs={'webshop_name': 'my-shop'}) self.assertEqual(url, '/api/shopify/my-shop/order_created') But this fails with the following error message: django.urls.exceptions.NoReverseMatch: 'webhook' is not a registered namespace inside 'shopify' Not sure if it's relevant or not, this is how ws_shopify.apps looks like: from django.apps import AppConfig class ShopifyConfig(AppConfig): name = 'ws_shopify' -
django admin causing latency to load instances , the models have a related hierarcy
Case: I have relationships: 1 Distributor:M resellers, 1 reseller: M customers, 1customer: M domains, 1 Domain: M mailboxes. The model admin panel is taking a long time to load the objects for all the model admin. Does the default django return queryset return all the instances or load only that required in page 1 and then page2 on click etc. Why is there latency? Checked the pagination related document. But where does it say that all the objects in the queryset are retrieved at a time or only relevant to that page at a time? -
Django: How to use CURSOR .. WITH HOLD in Django ORM
In Django orm we have queryset.iterator https://docs.djangoproject.com/en/5.0/ref/models/querysets/#iterator that uses under the hood Postgres cursor www.postgresql.org/docs/current/sql-declare.html in case we using Postgres as a database of course. By default Django uses it with WITHOUT HOLD setting, which is default in Postgres, that why it is also default in Django. Question is - is it possibe to use django iterator() with WITH HOLD setting (not default) without switching to raw SQL somehow? Thank u -
Can we use post_save signals in apps.py?
There. I'm using django python. I've custom user model. I've created a separate django signals file. there is my method. I'm importing them in my apps.py and wanting to use there. cause, post_migrate signals are working that way. but post_save is different cause that takes model. whereas postmigrate are working with app name. You better understand with following code. signals.py import secrets from django.core.mail import send_mail def create_first_account(sender, **kwargs): if sender.name == 'accounts': user = User.objects.get_user_by_username("meidan") if user: return None password = secrets.token_hex(4) user = User.objects.create( username="meidan", email="meidanpk@gmail.com", password=password ) user.is_active= True User.objects.save_me(user) subject = 'Meidan Account' message = password from_email = settings.EMAIL_HOST_USER recipient_list = ['ahmedyasin1947@gmail.com'] send_mail(subject, message, from_email, recipient_list, fail_silently=False) def create_first_account(sender,created, **kwargs): if sender.name == 'accounts': print(created) apps.py from django.apps import AppConfig from django.db.models.signals import post_migrate,post_save from django.contrib.auth import get_user_model User = get_user_model() class AccountsConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' name = 'accounts' def ready(self): from accounts.signals import generate_banks,create_first_account,create_first_account post_migrate.connect(generate_banks, sender=self) post_migrate.connect(create_first_account, sender=self) post_save.connect(create_first_account,sender=User) right now getting error. File "/home/aa/playapp-backend/envMy/lib/python3.10/site-packages/django/apps/registry.py", line 201, in get_model self.check_apps_ready() File "/home/aa/playapp-backend/envMy/lib/python3.10/site-packages/django/apps/registry.py", line 136, in check_apps_ready raise AppRegistryNotReady("Apps aren't loaded yet.") django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet. -
How to show request body using django rest framework and drf_spectacular in function based views
I have the following problem, which has been difficult for me to find documentation on function-based views to document them with drf_spectacular since all this is found for class-based views I have tried different ways to document the requestBody in swagger using serializers_class, manual objects, inline_serializers but all this without any success, here I leave a fragment of my code and a screenshot of how it should be and where should I be @extend_schema( summary="Fetch order information", description="This endpoint filter orders based on the provided parameters.", tags=["orders"], request=OrderInfoParamsSerializer, # HERE IS MY PROBLEM responses={ 200: OrderInfoSerializer(many=True), }, ) @extend_schema(request=None) @api_view(["GET"]) @token_required def order_info(request: Request) -> Response: params = OrderInfoParamsSerializer(data=request.data) if not params.is_valid(): return Response({"error": params.errors}, status=status.HTTP_400_BAD_REQUEST) params = params.validated_data ... class OrderInfoParamsSerializer(serializers.Serializer): order_id = serializers.IntegerField( required=False, allow_null=True, help_text="Filter by order ID" ) class OrderInfoSerializer(serializers.ModelSerializer): class Meta: model = Orders fields = "__all__" I tried to migrate the views to those based on classes where it only worked with one in the POST method not with the GET (I could migrate all my views if this worked) I didn't want to have to refactor the entire project and would like to be able to find some solution that works for function-based … -
Generate SQL joins from list of Django models
Given a list of arbitrary Django models, how can you use the Django ORM to generate the JOIN statements for an SQL query? This of course will only work if the relationships are defined in the model and there is a way to get from one model to another. The supplied list would not necessary contain models that are directly related to each other. I am trying to manually generate an SQL query given a list of models and I would like to leverage the already defined model relationships and the ORM to do this. It must be possible, the ORM already does this when using filters, select_related etc. -
use ajax with django
I already created an animation in dom for the login and registration but the only thing I need is to validate the registration and I already have the registration with django but I need it to show me the error if something happens with ajax and not restart the page or anything for that matter but in real time, this is the django code in views.py: def registrar_usuario(request): if request.method != "POST": return render(request, "./login.html") else: if "cancelar" in request.POST: #no hace nada de momento return print("aca se pondra la animacion para que vuelva a login") try: #datos requeridos, haciendolos obligatorios required_fields= ["email_usuario", "nombre_usuario", "fecha_nacimiento", "password"] #despues de esto hay que generar un mensaje de error en caso de que falten campos, pero se debe hacer con javascript for field in required_fields: if not request.POST.get(field): print("todos los campos son necesarios") return redirect("./login.html") #cuando se configure javascript este mensaje puede ser borrado ya que javascript debe hacer el mensaje, sin embargo debe ir de la mano con este fragmento de codigo django #verifica que el usuario no este creado email_usuario= request.POST["email_usuario"] if Registro.objects.filter(email_usuario=email_usuario).exists(): #aca tambien debe ir un codigo javascript de la mano con django print(f"El email {email_usuario} ya existe!") return … -
Django local server doesn't update web site with the new data from the database
CRUD operations are working just fine when I check the admins site. All of the new created items, updated or deleted are shown in the admins site, but in order to make the data appear in the website I have to restart my local server what's the problem I'm working with python 3.11.9 -
Sending email Django with mailtrap
Hi I finished making my contact form but it doesn't let me send email, I'm using mailtrap as a test server but I get an error. I'm using Django 5.0 and Python 3.10 Settings.py # Email config EMAIL_HOST = 'sandbox.smtp.mailtrap.io' EMAIL_HOST_USER = '811387a3996524' EMAIL_HOST_PASSWORD = '********6d43' EMAIL_PORT = '2525' Error message SMTPServerDisconnected at /contact/ Connection unexpectedly closed Request Method: POST Request URL: http://127.0.0.1:8000/contact/ Django Version: 5.0.4 Exception Type: SMTPServerDisconnected Exception Value: Connection unexpectedly closed Exception Location: /usr/lib/python3.10/smtplib.py, line 405, in getreply Raised during: contact.views.contact Python Executable: /home/andres/.local/share/virtualenvs/CursoDjango-IwbI9JP5/bin/python Python Version: 3.10.12 Python Path: ['/home/andres/Escritorio/CursoDjango/webempresa', '/usr/lib/python310.zip', '/usr/lib/python3.10', '/usr/lib/python3.10/lib-dynload', '/home/andres/.local/share/virtualenvs/CursoDjango-IwbI9JP5/lib/python3.10/site-packages'] Server time: Fri, 17 May 2024 22:26:46 +0000 -
Is there a way to insert a default field to each user's 'wincon' model or lock the form field to a value based on another form field?
I am building a game tracker. I would like to have it where if the user selects anything other than 'Win' then the wincon field of the form is unchangeable or set to a default field. This is to make it easier to understand that when they don't win they shouldn't add a wincon. It would also be nice if the user had a blank field that if they didn't want to input a wincon then it would default to '------' Ideally if it is a win then the wincon field would be able to be changed. But if a loss is selected then the form defaults to null or a prepopulated field like '------' models.py class Profile(models.Model): user = models.ForeignKey(User, max_length=10, on_delete=models.CASCADE, null=True) def __str__(self): return str(self.user) class Wincon(models.Model): wincon = models.CharField(max_length=100,) user = models.ForeignKey(User, max_length=10, on_delete=models.CASCADE, null=True) def __str__(self): return self.wincon class Game(models.Model): # ForeignKeys user = models.ForeignKey(User, max_length=10, on_delete=models.CASCADE, null=True) wincon = models.ForeignKey(Wincon, on_delete=models.CASCADE, null=True, blank=True,) views.py @login_required(login_url='my-login') def wincon(request): wincon_list = Wincon.objects.filter(user=request.user) user = User.objects.get(username=request.user) if request.method == "POST": wincon_form = WinconForm(request.POST) if wincon_form.is_valid(): obj = wincon_form.save(commit=False) obj.user = request.user obj.save() return HttpResponseRedirect('/wincon') else: wincon_form = WinconForm() context = {'wincon_form': wincon_form, 'wincon_list': wincon_list, 'user': user} return … -
Django and IIS (wfastcgi.py, httpPlatform or ...)
I need to run next some years Django on IIS (don't ask why :-). I found two ways https://learn.microsoft.com/en-us/visualstudio/python/configure-web-apps-for-iis-windows?view=vs-2022 1. httpPlatform + runserver wsgi.multithread:True wsgi.multiprocess:False The solution is multithreaded, working almost well, low resources, good performance. 2*5 processes can solve something like 1500req/second. But: IIS server returns "HTTP Error 502: Bad Gateway" sometimes during app poll recycle. Not so often, but... Django runserver documentation says in big letters: "DO NOT USE THIS SERVER IN A PRODUCTION SETTING" some sites said "HttpPlatformHandler has been replaced by ASP.NET Core Module" And HttpPlatformHandler is not a part of IIS. 2. fastCGI + wfastcgi wsgi.multithread:False wsgi.multiprocess:True This solution is a single threaded, working well, with no error, even if recycle or hi load occurs. But consume high resources: 1500req = 1500 running processes, 100GB of memory for almost none. Big amount of running processes means big system heap consumptions, load global variables, resources, imports ... again and again. Some sites say, of course: "wfastcgi is essentially deprecated ..." So - is there an effective and reliable way to run Django under IIS, which will last over some Windows versions from 2019, 2022 and next few at least 5-10 years? Is there some port from … -
Is it possible customize drf api root and grappeli in a Django Project?
I am using Django Rest Framework and Grappelli in my Django project. I need to add a cookie consent notice. Is it possible to customize both to show the notice? Do I need to create a new template? -
Django form submission not redirecting to success page and the post request is not being done
I'm encountering an issue with Django where form submission is not redirecting to the success page as expected and the data input its not happening . Here's a breakdown of the problem: I have a Django application where users can book rooms using a form. Upon successful submission of the form, the user should be redirected to a "booking success" page. However, after submitting the form, the page remains unchanged, and there's no redirection happening.Yes need authentication for book it . **this is my views.py ** `def book_room(request): if request.method == 'POST': form = BookingForm(request.POST) if form.is_valid(): form.save_booking() return redirect('booking_success') else: form = BookingForm() return render(request, 'bookings/appbooking.html', {'form': form})` my urls `from . import views from django.urls import path urlpatterns = [ path('', views.index, name='bookings'), path('booking_success/', views.booking_success, name='booking_success'), path('book_room/', views.book_room, name='book_room'), ` -
Docker compose enter debug mode upon breakpoint while dropping stdout from web server
Have a question on using docker-compose when entering into debug mode by manually setting breakpoint(). This is my service and it has a /health which calls almost every 5s, and it prints out 200 status code to stdout. However, when using docker attach <container_id> to enter into the container, as it hits a breakpoint, it is interlaced with the (pdb) debugger. Is there a way to redirect these stdout from /health temporarily to not "bother" the debugger session?