charan
I want to learn python and I know max important concepts in python now what do I need to learn do I need to learn a framework if yes what do I need to choose flask or django or fast api
Doragonsureiyā
Any django book
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
you7
How to upload more than one file for a single object ??
inactive
How to upload more than one file for a single object ??
creating separate table(model) with many-to-one relation(ForeignKey) for storing images and related objects, if you’re talking about the form layer then: https://docs.djangoproject.com/en/5.1/topics/http/file-uploads/ or https://docs.djangoproject.com/en/5.1/topics/forms/formsets/
@SamahTech
Hi, how can i store files using FileField(upload_to= ) to the ftp server
奈姆
Hi, how can i store files using FileField(upload_to= ) to the ftp server
https://docs.djangoproject.com/en/5.1/howto/custom-file-storage/ https://docs.djangoproject.com/en/5.1/ref/models/fields/#django.db.models.FileField.storage you can read this.
B
Anyone tried mjml in django for email?
Saturn
Hi I want to start reading Django.. Any suggestions for me
Ako
Hi everyone, I'm working with drf-spectacular for generating Swagger docs in my Django project, and I was wondering if there's a built-in feature to keep track of the last opened endpoint in the URL. In some other Swagger implementations, the address bar updates automatically when you open a new endpoint. Does drf-spectacular support this out of the box, or would I need to implement a custom solution to achieve it? Thanks a lot!.
Number one
Ridiculous problem😂 index.html page with page Cart_summary.html Header Is it one? It doesn't matter whether Index .html was there or not Now only program to Cart_summary.html It is related
Tech
Hello everyone please has anyone worked with playwright here?
Doragonsureiyā
Hello everyone please has anyone worked with playwright here?
This is not a Django specific question, please delete your offtopic message. If it's a Python related question go to @Python group, otherwise please move to @PythonOfftopic group and ask there.
.
addresses = ( Address.objects.filter(category__id=category, long__isnull=False) .annotate( position=Point(F("long"), F("lat"), srid=4326), distance=Distance("position", user_location), ) .order_by("distance") ) { "error": "Invalid parameters given for Point initialization." } how to fix t
Narendra
can any help me hosting a asgi application in any of the server
Vinay
You should place your static files under Django STATIC_ROOT. (Web servers just can't simply access any files on the host machine)
Hii, I tried to save apk in static folder and again download apk in the browser from static folder The path of the apk looks like C:\Users\vin\Desktop\apis\core\static\apks_folder\com.facebook.lite_435.0.0.8.107_new.apk But still I am getting the error like The requested resource not found on the server Anyone please help
Vinay
share your Django settings.py STATIC_ROOT and STATIC_URL values.
BASE_DIR = Path(file). resolve().parent.parent STATIC_URL = "static/" STATIC_ROOT = BASE_DIR / 'static' So I tried HttpResponse, FileResponse, HttpResponseRedirect from django.http and sendfile module But I am getting same issue for all "The requested resource not found in the server"
vch.py
hello! why did when i configure a custom jwt authentication it worked properly but when i started use drf simple-jwt i got the error about invalid token? sensitive data are the same
奈姆
Yes I did configure this
does accessing image files work?
Vinay
Yes, from static folder css,js and icons all are loading
Aza
Hi, Сan anyone help me, the template takes 10 seconds to load, it has 12 thousand rows in the table. When I look at the page size in the browser I get 1 gigabyte although if I save it the template size is much smaller which could be the problem?
Aza
What exactly is the problem here?
What can you recommend to speed up rendering?
Shaikh Ahmad Raza
clouded
Use react for frontend
Just using JavaScript to render a table of 12k rows might not do the trick of improving rendering performance.
奈姆
What can you recommend to speed up rendering?
Implement pagination (split data into multiple pages OR infinite scrolling). https://docs.djangoproject.com/en/5.1/topics/pagination/
clouded
What are your another suggestions or solutions sir?
https://t.me/django/287703 I stick with "render less".
Shaikh Ahmad Raza
https://t.me/django/287703 I stick with "render less".
So pagination is the another solution where we can divide rendering into multiple pages to load early..
clouded
So pagination is the another solution where we can divide rendering into multiple pages to load early..
Yeah, just I don't think a person will go through 120 pages a 100 entries and search for something manually... So, while pagination makes sense, filtering does too.
Shaikh Ahmad Raza
Yeah, just I don't think a person will go through 120 pages a 100 entries and search for something manually... So, while pagination makes sense, filtering does too.
True no one will scroll 120 pages filter option is better also we can provide search option on the basis of column which can be manually choose to get specific data
Hunny
Implementing Localization in DRF. In an ongoing development project of DRF, I have to support the translation for multiple languages. My question is how should I do it. Like upgrading existing APIs with the translated response (need to alter the viwesets and serializers). Having a separate translation APIs. The data which is added from the CMS is how it's translation to be done, cause from the CMS the translation can be updated as well and storing so much of the data for each language in the DB doesn't sound good to me. I know how the translation works with django and the Rosetta as well for the updatable interface. My question is how should I approach it for the entire project. Please guide me, if you can it would be very helpful. Thanks.
Nikita
Hi!I have question about Django templates, someone use them or not?Just as far as I know at the moment most of the sites are written with a separate frontend and a separate backend, so I do not know if there is a sense to go deep into the templates.
Rkh
Hi, I have a doubt. I'm trying to deploy my django project on AWS. I tried adding the csfr trusted origin yet I am still getting error
Rkh
Can anyone help me figuring out what the issue is
Rkh
I can't use the elastic IP address yet and I have a public ip address assigned nor can I excempt the csfr token.
Rkh
Have you incoparated nginx
CSFR token issue, cookie not set
Rkh
Forbidden (403) CSRF verification failed. Request aborted. You are seeing this message because this site requires a CSRF cookie when submitting forms. This cookie is required for security reasons, to ensure that your browser is not being hijacked by third parties. If you have configured your browser to disable cookies, please re-enable them, at least for this site, or for “same-origin” requests. Help Reason given for failure: CSRF cookie not set. In general, this can occur when there is a genuine Cross Site Request Forgery, or when Django’s CSRF mechanism has not been used correctly. For POST forms, you need to ensure: Your browser is accepting cookies. The view function passes a request to the template’s render method. In the template, there is a {% csrf_token %} template tag inside each POST form that targets an internal URL. If you are not using CsrfViewMiddleware, then you must use csrf_protect on any views that use the csrf_token template tag, as well as those that accept the POST data. The form has a valid CSRF token. After logging in in another browser tab or hitting the back button after a login, you may need to reload the page with the form, because the token is rotated after a login. You’re seeing the help section of this page because you have DEBUG = True in your Django settings file. Change that to False, and only the initial error message will be displayed. You can customize this page using the CSRF_FAILURE_VIEW setting.
Rkh
It works properly in local host, but when I deployed it in ec2 the issues comes
Rkh
I have tried setting the cookies, trusted originis
Shaikh Ahmad Raza
have you added @ensure_csrf_cookie in view function
Shaikh Ahmad Raza
also in setting.py Middleware
Shaikh Ahmad Raza
Let me try adding that
add that in the function where you are making request
Shaikh Ahmad Raza
from django.views.decorators.csrf import ensure_csrf_cookie @ensure_csrf_cookie def your_view(request): ...
Shaikh Ahmad Raza
This I have done
hlo brother have you deployed your frontend on another server
Vinit
Can anyone suggest best resource to learn django
Doragonsureiyā
Can anyone suggest best resource to learn django
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
Benyamin?!
Do I need to learn front end stuffs like html and css for learning Django or not
Bhavin
{% extends "layouts/app.html" %} {% load static %} {% block title %} <title>EARN HERE</title> {% endblock %} {% block link %} <link rel="stylesheet" href="{% static 'css/earn.css' %}"> {% endblock %} {% block content %} I have linked the css properly then too its not loading
Bhavin
So i wanted to send my ss.
Charly
So i wanted to send my ss.
No screenshots are allowed. Do you see any error in the browser console related to load the the CSS?
Bhavin
No
Charly
No
Then why you say is not loading?
Charly
do you see it properly linked in the rendered template? if you open the link of the css you see the code?
Bhavin
I have written some css in static -> css -> earn.css
Bhavin
The web page is loading only html
Bhavin
Other file css are all working but not this
𝘼𝙗𝙤𝙡𝙛𝙖𝙯𝙡
𝘼𝙗𝙤𝙡𝙛𝙖𝙯𝙡
ctrl + f5
your internet have to be on
Qwerty
Other file css are all working but not this
Check developer tools in the browser firstly.
Bhavin
Solved guys thanks. It was a cache problem