Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Incorrect results with `annotate` + `values` + `union` in Django
Here are my models: class ModelA(models.Model): field_1a = models.CharField(max_length=32) field_2a = models.CharField(max_length=32) class ModelB(models.Model): field_1b = models.CharField(max_length=32) field_2b = models.CharField(max_length=32) Now, create 2 instances each: ModelA.objects.create(field_1a="1a1", field_2a="1a2") ModelA.objects.create(field_1a="2a1", field_2a="2a2") ModelB.objects.create(field_1b="1b1", field_2b="1b2") ModelB.objects.create(field_1b="2b1", field_2b="2b2") If I'll query for only one model with annotations, I get something like that: >>> ModelA.objects.all().annotate(field1=F("field_1a"), field2=F("field_2a")).values("field1", "field2") [{"field1": "1a1", "field2": "1a2"}, {"field1": "2a1", "field2": "2a2"}] This is correct behavior. The problem starts, when I want to get union of those two models: # model A first, with annotate query = ModelA.objects.all().annotate(field1=F("field_1a"), field2=F("field_2a")) # now union with model B, also annotated query = query.union(ModelB.objects.all().annotate(field1=F("field_1b"), field2=F("field_2b"))) # get only field1 and field2 query = query.values("field1", "field2") # the results are skewed: assert list(query) == [ {"field1": 1, "field2": "1a1"}, {"field1": 1, "field2": "1b1"}, {"field1": 2, "field2": "2a1"}, {"field1": 2, "field2": "2b1"}, ] The assert passes correctly, which means that the results are wrong. It seems like the values() didn't match the variable name, it just iterated over the object as on a tuple. The value of field1 is actually the object's ID, and field2 is field1. This is pretty easy to fix in such simple models, but my real models are quite complex, and they have a different … -
Site not loading Static files
Django 2.1.15/ Python 3.7.3 I'm in the process of uploading my project (first time I have done so for Django), but I can't seem to get the Static files to load (so no CSS styling on the website). It works fine on my localhost My app will be placed in a subdomain (mywebsite/myapp) The file structure is... website_files |--myapp |--static |- <CSS & JS Files> |--myapp |-settings.py |-urls.py The settings file has the following STATIC_URL = '/static/' STATICFILES_DIRS = ( os.path.join(BASE_DIR, 'static'), ) STATIC_ROOT = os.path.join(BASE_DIR, 'static') MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'tmp') However, if I make the following tweak, then the CSS will load, but only on the index? STATIC_URL = 'myapp/static/' -
While opening a share link from gmail not sharing the session which already exists
We have generated a share link that will open a specific page in our web app if the user session exists otherwise, it will open the home page. While opening this link from Gmail it's not detecting the existing user web session cookie of our app. In case of opening the link from IM's like Skype, WhatsApp or even after copying the link to the browser is working fine. We are using Django Backend for processing these requests. -
Django form handling wih fields inside divs
I have form, that contains many div blocks and inputs inside them. I want to handle the result of submitting form, but when I watch for request, I see only csrfmiddlewaretoken and doesn't see data at all. Where there may be a problem? Form example: <form method="post"> {% csrf_token %} <div class="home-blbox"><input type="number" id="valueInput"></div> <input type="submit value="Submit"> </form> Code handling example: def handle(request): if request.method == "POST": print(request.POST) return render(.....) An output is dict contains only csrf token. -
When to use __str___ method inside Django model?
I have created a Django model with the following attributes. class Info(models.Model): number = models.IntegerField() ID = models.IntegerField() reading = models.IntegerField() date = models.DateField() I would like to make it so that when a user searches for an 'ID' or 'number' from the database, they are shown the date and reading. Here is my search results code in views.py: class SearchResultsView(ListView): model = Info template_name = 'search_results.html' def get_queryset(self): query = self.request.GET.get('q') reading_list = Info.objects.filter( Q(ID__icontains=query) | Q(number__icontains=query) ) return reading_list And here is my search_results.html template: <h1>Search Results</h1> <ul> {% for reading in reading_list %} <li> {{ reading.reading }}, {{ reading.date }} </li> {% endfor %} </ul> I am a little confused as to whether I should include a 'str' method in my model. Will the app be able to print the date and reading using just this code? -
How to dynamically use different existing database in django
i have around ten to twenty databases with same structure in mysql, and how can i load those database dynamically in django? (there will be a table storing those databases name, which may add/delete during the programme) -
Django not redirecting to next page with in-built login view
I don't know what's happening with my code, once a user that is not authenticated tries to access a page and it redirects to the login page, I can see the next parameter in the browser but after the user logins, it takes the user to the default LOGIN_REDIRECT_URL and not the next page. Also on the template next returns none, so seems the template is not getting thee next value, but in the url it shows the /?next=, thanks in advance. urls.py from django.contrib import admin from django.urls import path, include from django.contrib.auth import views as auth_views from blog import views urlpatterns = [ path('admin/', admin.site.urls), path('', views.HomeView.as_view(),name="index"), path('accounts/login/', auth_views.LoginView.as_view(), name='login'), path('accounts/logout/', auth_views.LogoutView.as_view(next_page='/'), name='logout'), path('accounts/profile/', views.ProfileView.as_view(), name='profile'), ] registration/login.html {% extends 'app/base.html' %} {% block link %} id="active" {%endblock%} {% block content %} <div class="row"> <div class="col-md-3"> </div> <div class="col-md-6"> <div class="jumbotron" id="font"> {% if next %} {% if user.is_authenticated %} <h2 class="customtext" align="center">Your account doesn't have access to this page. To proceed, please login with an account that has access.</h2> {% else %} <h2 class="customtext" align="center">Please login.</h2> {% endif %} {% else %} <h2 class="customtext" align="center">Enter your login details.</h2> {% endif %} <form action="{% url 'login' %}" method="POST"> … -
Automatically create django model instances at startup with empty database
My django project requires some model instances to be created at startup if they do not exist. I currently create the required model instances I need in an app config. class MyAppConfig(AppConfig): name = 'my_app' def ready(self): create_required_objects() def create_required_objects(): from my_app.models import MyObject for name in MyObject.reserved_names: if not MyObject.objects.filter(name=name).exists(): MyObject.objects.create(name=name, not_editable=True) This works perfectly when the sqlite database is initialized, however if I clear the database and then try to run the sever, I get the following error: django.db.utils.OperationalError: no such table: my_app_object I would like to be able to clear the database (preferably by just removing db.sqlite3) and run the server. -
Django DateTimeField received a naive datetime while time zone support is active
I'm using Django 2.2 In my application, timezone support is enabled by USE_TZ=True in the settings file. I have models with DateTime field created. I need to filter data based on the date. The date can be provided by the user or else it will be default to now(). This is what I'm doing from datetime import datetime, timedelta from django.utils import timezone class Generator: def __init__(self, start_date=None, end_date=None): if end_date: self.end_date = datetime.strptime(end_date, '%Y-%m-%d').date() else: self.end_date = timezone.now().date() if start_date: self.start_date = datetime.strptime(start_date, '%Y-%m-%d').date() else: self.start_date = self.end_date - timedelta(days=7) def get_query(self, d): query = MyModel.objects.filter( d__in=d, created__gte=start_date, created__lte=end_date ) return query But this is giving error RuntimeWarning: DateTimeField MyModel.created received a naive datetime (2020-02-28 00:00:00) while time zone support is active. How can I get this issue solved? -
Django: How to put each graphs on a page without saving it
I’m struggling to put several graphs created with Matplotlib on a page with saving it on memory. While single graph got success, one more graphs has failed. When I tried to embed two matplotlib graphs (graph1 and graph2) in a webpage, for instance, it were displayed one combined graph. In addition that, the designated color also didn’t work. Why? What I want to know is how to display each graph without integration. The following are my code Views.py Matplotlib graph are converted to binary data and saved on memory Each graph are connected to url parameter def graph(): #create graph and save it on memory buff=io.BytesIO() plt.savefig(buff, format='png') bute_file=buff.getvalue() buff.close return bute_file def test_graph(request,para): if para==1: #graph1 accounts=[6,2,3,6] label=['A','B','C','D'] col=['darkred','red','orange','gold'] plt.pie(accounts,labels=label,colors=col) chart=graph() plt.cla response=HttpResponse(chart, content_type='image/png') return response elif para==2: #graph2 accounts=[3,6,9] label=['E','F','G'] col=['blue','cyan','darkblue'] plt.pie(accounts,labels=label,colors=col) chart=graph() plt.cla response=HttpResponse(chart, content_type='image/png') return response else: #graph3 accounts=[5,1,2] label=['X','Y','Z'] col=['green','limegreen','yellowgreen'] plt.pie(accounts,labels=label) chart=graph() plt.cla response=HttpResponse(chart, content_type='image/png') return response url.py urlpatterns = [ path('test_view/',views.test_view, name='test_view'), path('test/<int:para>',views.test_graph,name='test_graph') ] html <div> <img src="{% url 'mysite:test_graph' 1 %}"> </div> <div> <img src="{% url 'mysite:test_graph' 2 %}"> </div> And here is the displayed page Changing para in test_graph() to 3,4 which does not exist on url parameter, the webpage showed exceptional … -
Unable to send email from Django Rest framework application
I am trying to send email via Django Rest framework application. The mail should be sent to the user who would register to our system using Gmail. I am also using docker images python:3.7-slim and MySql:5.6 First I have created email configurations inside the Django project setting.py file as stated below. # Email Settings. EMAIL_HOST = 'smtp.gmail.com' EMAIL_PORT = 456 EMAIL_HOST_USER = 'steinnlabs@gmail.com' EMAIL_HOST_PASSWORD = 'SteinnLabs@123!!*' EMAIL_USE_TLS = 1 EMAIL_USE_SSL = 0 This is how view.py file of application looks like. from __future__ import unicode_literals from django.shortcuts import render from . import views from rest_framework.views import APIView from django.db import IntegrityError from rest_framework import status from . import models, serializers from rest_framework.response import Response from django.core.mail import send_mail class UserAPIViews(APIView): """ """ def post(self, request, format=None): """ """ print(request.data) serialized_data = serializers.UserSerializer(data=request.data) if serialized_data.is_valid(): try: user_id = serialized_data.save() except IntegrityError as error: message = f"Email already exist." return Response ({ 'error_message' : message, 'status' : status.HTTP_226_IM_USED }) subject = 'Eitan - Case Manager Account Credentials' body = f"Hi {serialized_data.validated_data.get('first_name')} Your case manager account is ready. Please use following credentials to login. Email - {serialized_data.validated_data.get('email')}, Password - {serialized_data.validated_data.get('password')} Thank You! Team Eitan." sender = "steinnlabs@gmail.com" to = serialized_data.validated_data.get('email') send_mail(subject, body, sender, … -
Accessing an element in a dictionaty using another key
I have a dictionary: D = <Queryset[{'name' : 1 , 'id' : 3, 'val': 4}]> D here is list of dictionaries. I have an object which can fetch me id by using (s.game_id). By using s.game_id, I get '3' as its value, which is correct. However, this object doesn't have 'val' accessibility. I want to get the corresponding value of 'val' using 'id'. But, I am unable to do so and stucked. -
xhtml2pdf don't move elements in generated pdf
I create a pdf file and I need to move the elements, but it does not move. If you open the template, you can see that everything is moving. I need to raise the text so that it is higher than the images. Classes "stamp" and "podpis" it's images. <style> .table { display: table; } .table-row { display: table-row; } .table-cell { display: table-cell; border: 1px solid black; } .text { display: inline-block; vertical-align: top; } </style> <body> <div class="table"> <div class="table-row"> <div class="text"> Name: </div> <div class="table-cell"> <img class="stamp" src="{% link_callback supplier.image_dog.url %}" > </div> <div class="text"> {{ supplier.chief}} </div> <div class="text"> Seconf: </div> <div class="table-cell"> <img class="podpis" src="{% link_callback supplier.image_sign.url %}" > </div> <div class="text"> {{ supplier.chief}} </div> </div> </div> </body> -
Passing value to the Django view function from template
{% for key,value in ls.items %} {% if value == "1" %} <form id="myForm" action="/data_display/" method="post"> <input type="hidden" name="date_selected" value= {{ key }}> <a href="#" onclick="document.getElementById('myForm').submit();"><font size="+1">{{ key }}</font>><br>available</a> {% csrf_token %} </form> {% else %} <p> <font> {{key}} </font></br> not available </p> {% endif %} {% endfor %} Here, "ls" is the dictionary. I want to pass the "key" to Django views function. The value in the input tag does take different values of key during each for loop, but when I pass when I click on the link, it only passes the key of 1st element. For eg, suppose my dictionary is: {'2020_01_01': '1', '2020_01_02': '1', '2020_01_03': '0', '2020_01_04': '1', '2020_01_05': '0', '2020_01_06': '0', '2020_01_07': '0', '2020_01_08': '1', '2020_01_09': '0'} so when I click on any of the link, "2020_01_01,2020_01_02,2020_01_04,2020_01_08", every time only 2020_01_01 key passes to the view function. But I want that whenever I click on any other link like 2020_01_02, then 2020_01_02 should pass on the view function. -
How to create a PNG image from HTML page and save it to the database using Django?
I'm new to django. So basically i have created a card view in my HTML page. When i click download buttton, an image file (PNG) of the HTML card (as exactly shown in the picture) should be created and saved it to the database. The downloaded image should be in media/cardimage folder in django project. The image is shown below.(Screenshot)card image HTML code is shown below <div class="container"> <div class="col" > <div class="col-lg-4 d-flex align-items-stretch" > <div id="html-content-holder" class="card rounded-lg shadow bg-white rounded" style="width: 25rem; width: 50vw; margin:auto;"> <div class="overlay"> <img class="card-img-top" src="{% static 'images/ab_nba_040320.jpg' %}" alt="Card image cap"> </div> <!-- Card content --> <div class="card-body"> <!-- Title --> <div style="text-align: left;"> <h4 class="card-title font-weight-bold align-left"> <p style="font-size: 80%;">NBA: Davis sparks Lakers over Sixers with hot second quarter, LeVert hits career-best 51pts as Nets beat Celtics <a id="btn-Convert-Html2Image" class="fa fa-download" aria-hidden="true" style="cursor: pointer;" title="Download"></a> </p> </h4> <!-- Text --> <p class="card-text" style="font-size: 85%;">Anthony Davis produced a devastating burst of scoring, as the Los Angeles Lakers came from behind to defeat the Philadelphia 76ers 120-107 on Tuesday (March 3) in their National Basketball Association (NBA) game. He led the Lakers' surge with 37 points at the Staples Centre after the hosts … -
IDE showing me error on objects keyword in " latest_questions = Question.objects.order_by('-pub_date')[:10] "
Page not found (404) Request Method: GET Request URL: http://127.0.0.1:8000/polls/'polls/index.html Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order: admin/ ^polls/ ^$ [name='index'] ^polls/ ^(?P[0-9]+)/$ [name='detail'] ^polls/ ^(?P[0-9]+)/results$ [name='results']he current path, polls/'polls/index.html, didn't match any of these. You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page. -
Unable to initialise a Docker contained API server database
The goal is to set up the Bullet Train API server running on local servers. I'm completely new to dockerization, so need some help As per the docs at Bullet Train API server which I have cloned on my local machine. When I run docker-compose up on my local machine, the server seems to be up and running. However, I get this warning: When I search the code, I can't see this string anywhere in the code. I have some questions here. How do I force this docker container to initialize the database? What is causing this skip of database initialization? -
Django Cactus - NotImplementedError
Im following this guide on how to deploy a django app using Cactus to Netlify: https://www.netlify.com/blog/2016/04/08/a-step-by-step-guide-cactus-on-netlify/#building-your-site However, when I try to start the local server, I get this error: > cactus serve c:\...\desktop\dev\virtualenvs\ab_vb_py_3.8\lib\site-packages\django-1.6.11-py3.8.egg\django\template\base.py:1119: DeprecationWarning: inspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec() params, varargs, varkw, defaults = getargspec(func) c:\...\desktop\dev\virtualenvs\ab_vb_py_3.8\lib\site-packages\cactus-3.3.3-py3.8.egg\cactus\utils\internal.py:36: DeprecationWarning: inspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec() return inspect.getargspec(obj) c:\...\desktop\dev\virtualenvs\ab_vb_py_3.8\lib\site-packages\cactus-3.3.3-py3.8.egg\cactus\utils\internal.py:45: DeprecationWarning: inspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec() spec = inspect.getargspec(getattr(obj, FUNC_OBJ_ATTR)) Running webserver at http://127.0.0.1:8000 for C:\...\Desktop\DEV\ab_full_project\cactus\twentytwenty\.build Type control-c to exit Traceback (most recent call last): File "C:\...\Desktop\DEV\virtualenvs\ab_vb_py_3.8\Scripts\cactus-script.py", line 11, in <module> load_entry_point('Cactus==3.3.3', 'console_scripts', 'cactus')() File "c:\...\desktop\dev\virtualenvs\ab_vb_py_3.8\lib\site-packages\cactus-3.3.3-py3.8.egg\cactus\cli.py", line 159, in cli_entrypoint main(sys.argv[1:]) File "c:\...\desktop\dev\virtualenvs\ab_vb_py_3.8\lib\site-packages\cactus-3.3.3-py3.8.egg\cactus\cli.py", line 155, in main ns.target(**kwargs) File "c:\...\desktop\dev\virtualenvs\ab_vb_py_3.8\lib\site-packages\cactus-3.3.3-py3.8.egg\cactus\cli.py", line 65, in serve site.serve(port=port, browser=browser) File "c:\...\desktop\dev\virtualenvs\ab_vb_py_3.8\lib\site-packages\cactus-3.3.3-py3.8.egg\cactus\site.py", line 452, in serve self.server.start() File "c:\...\desktop\dev\virtualenvs\ab_vb_py_3.8\lib\site-packages\cactus-3.3.3-py3.8.egg\cactus\server.py", line 126, in start self._server.listen(self.port) File "c:\...\desktop\dev\virtualenvs\ab_vb_py_3.8\lib\site-packages\tornado-6.0.4-py3.8-win32.egg\tornado\tcpserver.py", line 152, in listen self.add_sockets(sockets) File "c:\...\desktop\dev\virtualenvs\ab_vb_py_3.8\lib\site-packages\tornado-6.0.4-py3.8-win32.egg\tornado\tcpserver.py", line 165, in add_sockets self._handlers[sock.fileno()] = add_accept_handler( File "c:\...\desktop\dev\virtualenvs\ab_vb_py_3.8\lib\site-packages\tornado-6.0.4-py3.8-win32.egg\tornado\netutil.py", line 279, in add_accept_handler io_loop.add_handler(sock, accept_handler, IOLoop.READ) File "c:\...\desktop\dev\virtualenvs\ab_vb_py_3.8\lib\site-packages\tornado-6.0.4-py3.8-win32.egg\tornado\platform\asyncio.py", line 100, in add_handler self.asyncio_loop.add_reader(fd, self._handle_events, fd, IOLoop.READ) File "C:\...\AppData\Local\Programs\Python\Python38-32\Lib\asyncio\events.py", line 501, in add_reader raise NotImplementedError NotImplementedError Thank you -
What is wrong with this Django code for template and model
so I'm trying to make dynamic pages with Django. I already have 'name', 'background', and 'introduction' data input in the admin page. And now I'm trying to show this to my '.../index' page. But it doesn't work. This is the python code for models.py class UserInfo(models.Model): name = models.CharField(max_length = 10) background = models.CharField(max_length=30) introduction = models.CharField(max_length = 60) and in my views.py file, I have this: def index(request): user = UserInfo.objects.all() return render(request, 'index.html', {'user' : user}) and finally in my 'index.html' file, I have this: <p>{{user.name}}</p> <p>{{user.background}}</p> <p>{{user.introduction}}</p> So these codes are supposed to show me the name, background, and introduction in '.../index' page, but it shows nothing. I don't see what I did wrong. I very much appreciate your help. :) Thanks. -
could not actually find how from_db_value works in django source code?
I have a some fields in my model where I am trying to apply encryption on all the fields. Each field encryption depends on the values of two other fields in that same model class. I am able to achieve the encrypted data. But I also need those two other fields in the same class to decrypt the other field values that is returned by the function def from_db_value(self, value, expression, connection, *args). I have read docs and source code, but I didn't see a proper explanation on these parameters in from_db_value(self, value, expression, connection, *args): 1. expression 2. *args I want to know, How and where we can supply these parameters. How else we can use that function. I know the function returns value from database in python object. But I want to know what else it can do or we can o with it? P.S: Yes, I am trying to make custom field classes. Inspiration: django-fernet-fields -
How to extend categories, 'parent-child' functionality from django oscar dashboard to oscars restful API for category?
In the oscar dashboard, I can make any root category, I can make children under a category. This functionality I am able to explore in the oscar Restful API. But I want to inherit the dashboard functionality, where we can make any category relative to another category. for example- I have 2 categories. 1) cat 1 a)subcat1 2)cat 2 now if I have to make subcat1 as a child of cat2 I can easily select from the dropdown and set 'subcat1' to cat2, in the oscar dashboard. But how can I do the same using Django oscar restful API? Please let me know. This is what I get from oscarapi for categories. which is http://localhost:8000/api/admin/categories/ serializers/admin/product.py class AdminCategorySerializer(BaseCategorySerializer): url = serializers.HyperlinkedIdentityField(view_name="admin-category-detail") children = serializers.HyperlinkedIdentityField( view_name="admin-category-child-list", lookup_field="full_slug", lookup_url_kwarg="breadcrumbs", ) def create(self, validated_data): breadcrumbs = self.context.get("breadcrumbs", None) slug = validated_data["slug"] if breadcrumbs is None: breadcrumbs = slug else: breadcrumbs = "/".join((breadcrumbs, slug)) try: instance = create_from_full_slug(breadcrumbs, separator="/") except ValueError as e: raise APIException(str(e)) return self.update(instance, validated_data) views/admin/product.py class CategoryAdminList(generics.ListCreateAPIView, CategoryList): queryset = Category.get_root_nodes() serializer_class = AdminCategorySerializer permission_classes = (APIAdminPermission,) def get_queryset(self): try: return super(CategoryAdminList, self).get_queryset() except NotFound: # admins might be able to create so hold the error. return Category.objects.none() def get_serializer_context(self): … -
django widget in forms is not working correctly
I'm using django widgets into my forms.py for the content field. But whenever I change the coloumn and rows in forms.py with the widgets it's not changing in the template. my forms.py: from django import forms from .models import Comment class CommentForm(forms.ModelForm): class Meta: model = Comment content = forms.CharField(widget=forms.Textarea(attrs={'class': 'form-control', 'placeholder': 'Text goes here', 'rows': '4', 'cols': '10'})) fields = ('content',) -
Getting a socketio client connection to receive a "signal only works in main thread" error
So, I am trying to make my django app automatically connect to socketio client when some conditions happen and parse data from it in order to thereafter send it to my own web socket and show on web page. When I'm using this code: views.py def match(request, match_id): match = get_object_or_404(Match, pk=match_id) context = {'match': match} if match.is_live: livescore = Livescore(match.match_id, ) context.setdefault('livescore', livescore) return render(request, 'myapp/match.html', context) to create this class' object: def socket(self): sio = socketio.Client() @sio.event def connect(): print("connection established") ready_data = {"listId": self.list_id} sio.emit("readyForMatch", json.dumps(ready_data)) @sio.event def log(data): # do stuff @sio.event def event(data): # do stuff @sio.event def disconnect(): print("disconnected from server") sio.connect("<websocket URI im trying to connect to for data parsing>") return sio and parse info with callbacks. So, when I create sio object from barely anywhere (views.py in this case) I receive this error: ValueError: signal only works in main thread So after I figure out this problem (if I do) I want to put this code into my django-cron class which will every time check whether the condition has been fulfilled, connect to socketio and store its instance somewhere else to operate with info I'm receiving and put it into my own … -
Django ListView pagination when passing multiple objects in queryset
I'm working on Django app and currently ran into a problem. I have my ListView as: class CategoryView(ListView): template_name = "categories.html" def get_queryset(self): ... ... queryset = {"category": parent, "items": items.all()} return queryset Is there any walkaround for paginating "items" from queryset dict? Because when I set paginate_by = xx I get error unhashable type: 'slice'. What is, from my understanding, and it's pretty obvious cause by the fact that it doesn't know what if I request to paginate "category" or "items". Thank you for every input. Michal -
Python support for data / task Parallelism along with Async processing
I am new to Python and quite keen to shift,owing to brilliant framework like Django, excelllent foundation libraries. Also the ML apis available out of box. I have researched a bit to understand the fundamental design and whether the future use cases can be met. Following are my technical use cases: System scalability is low, not more than 50 concurrent users at any point of time (peak load), average would be 30 users This is a planning and Optimization system, therefore every user executes a high latency call, where to provide an example each call may internally deal with data set of 1 million records, which needs to be further processed End result is either a filtered, paginated 100 records or some average calculations, thus not a heavy network pay-load during response. Though while executing select call in the DB there's a heavy network payload, if bought to the application memory. Design (To meet the technical use cases): For a technical pay load of 1 million divide a call into 10 / 20 async IO calls an thus aggregate the data at the application / backend layer Use in memory cache to make the IO faster for future calls, it …