Maxim
I meant scanned pdf
what does this have to do with Django?
do you know what this group is?
….
Hello
Please I am using django-allauth headless for my authentication endpoints. Anytime I send a post request using postman to the _allauth/browser/v1/auth/login endpoint. i get a 403 forbidden saying CSRF cookie not set. Please how can I solve this
Maxim
Doragonsureiyā
Anybody knows pdf editing (private pdf)
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.
Chillguy
Where can i find best django and drf courses? (free or paid)
Doragonsureiyā
Mobin
Ahmad
TypeError: OAuth2Client.init() got multiple values for argument 'scope_delimiter' how solve this
Doragonsureiyā
شهرزاد محمد
شهرزاد محمد
Mobin
Mobin
Mobin
شهرزاد محمد
Hadi
I tried the same code and found that the issue is with the requests library. I tested this code, and it worked correctly:
import httpx
url = 'https://******/test_stream/'
with httpx.stream("POST", url) as response:
for line in response.iter_lines():
if line:
print(line)
If you handle the errors, the code will be better:
import httpx
url = 'https://**/test_stream/'
try:
    with httpx.stream("POST", url) as response:
        response.raise_for_status()
        for line in response.iter_lines():
            if line:
                print(line)
except httpx.HTTPStatusError as e:
    print(f"HTTP Error: {e}")
except httpx.RequestError as e:
    print(f"Request Error: {e}")
Eric
~~~
Hi all,
I am new to django, i studied the basics and also build a blog application. Now i am creating a ecommerce aplication...can anyone suggest best resource to study user authentication for the system..other than the documentation.
Hadi
For completeness shouldn't you handle all other errors, if the exception is not a HTTPStatusError or RequestError?
Yeah you're right. We can cover other exceptions by adding Exceptions block:
import httpx
url = 'https://******/test_stream/'
try:
    with httpx.stream("POST", url) as response:
        response.raise_for_status() 
        for line in response.iter_lines():
            if line:
                print(line)
except httpx.HTTPStatusError as e:
    print(f"HTTP Error: {e}")
except httpx.RequestError as e:
    print(f"Request Error: {e}")
except Exception as e:
    print(f"Unexpected Error: {e}")
Pablo
Sivaraj
Is there any feature difference for using mysql and postgres in Django?
Mirco
Mobin
Mobin
I tried the same code and found that the issue is with the requests library. I tested this code, and it worked correctly:
import httpx
url = 'https://******/test_stream/'
with httpx.stream("POST", url) as response:
for line in response.iter_lines():
if line:
print(line)
it works with flask but not with django, it waits for the generator to finish and then returns the data all at once
def stream(request: HttpRequest):
print(request.method.upper())
def large_data():
for i in range(10):
yield f"data: {i}\n\n"
time.sleep(0.5)
print(f"data: {i}")
yield "data: end\n\n"
response = StreamingHttpResponse(large_data(), content_type="text/event-stream")
response.headers['Cache-Control'] = 'no-cache'
return response
does it have something to do with the middlewares? maybe some middleware in the middle is causing this.
# settings.py
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
cj
Charly
You mean how we learned it?
Mobin
they are similar to function based views, in function based when you wanna write code for post or get requests you have to use a if statement to check if is a get or post
but in class based you implement the get and post methods and when a request comes in django automatically calls those methods based on the request.method
mbk
Hey
I want to create a dynamic cron using celery
A cron that schedules dynamic basis on time
If the time is updated it must reschedule to updated time and cancel the previous request of old time
How can I achive it ?
Sunken
Pablo
You will need to make use of celery to run the task and celery beat to schedule it.
By default when a change in schedule of a task occurs, it restarts celery beat
mbk
Celery beats sounds good to me also
mbk
But I have not implemented it yet anyhow
If there are any documentation that could help,please share it
mbk
bibi
mbk
bibi
❥︎ 𝓔𝓻𝓯𝓪𝓷
Hello, I'm using JWT.
For refreshing the token, I want to send the request using cookies instead of posting.
However, the frontend team is asking me to change it and receive it through headers.
Which method is safer and better?
Mobin
mohamad
Hello , If there are two domains the first one for backend django and the second one to react and i want to use django auth but i cant see in cookies of browser session or csrf what is the reason ?
شهرزاد محمد
T
Hi, i want to implement django redis caching. So what is the best approach in caching depends on multiple related models?
hamid
Hi guys
I have an ImageField in django admin
I want it to have a crop ability for image while uploading
How could I do that?
Mirco
KAKASHI
Hi guys
I have an ImageField in django admin
I want it to have a crop ability for image while uploading
How could I do that?
In your Django admin, you need to enable the cropping feature for the image field. You can do this by using the ImageCroppingMixin from django-image-cropping.
Here’s an example of how to do it:
from django.contrib import admin
from image_cropping import ImageCroppingMixin
from .models import MyModel
class MyModelAdmin(ImageCroppingMixin, admin.ModelAdmin):
list_display = ['image'] # Include image field in the list view
# You can also customize other admin options here
admin.site.register(MyModel, MyModelAdmin)
hamid
Mehda
hello evry one
i have question with drf
i have a class of user and child class of doctors , admin , patient
i dont now how to implement this in drf
if i use generalisation and specialisation
or just use group and permissions
crypto
Any tutorial here on YouTube to learn Django?
Karan
Anyone has idea about django Channels with rest apis integration with react app ? Any good source to read about their integrations
Lee@2731#
Hi i have django .. project i implemented most complex logic and i render page.. but it's taken long time ...how to we fix and ...any tool for rendering page debugging tool
clouded
clouded
Lee@2731#
kim
Where can I host django for free?
Pablo
kim
Pablo
Thanks
If you need a tutorial, you can watch this:
https://youtu.be/qbDi-v2NZgo?si=87JJBxdnFw10mebq
seyyed sajjad
Charly
Liara.ir
Please avoid sharing Links that are not in English
william
Hello good evening, excuse me I'm creating a web application, and I'm going in the part of groups and permissions, I know that django has a function of groups and permissions at the model level, but I was something to manage permissions to the templates, I mean that the user can only view parts of the website depending on his privileges
Any resources, blogs, tutorials that you could share with me
Omadbek
𝚆𝚘𝚛𝚕𝚍𝚕𝚎𝚜𝚜
Guys to make a good django resume , is it necessary for our projects to have a good frontend too? Recently i made a project with strong backend yet simple frontend (https://theartificialflower.pythonanywhere.com)
So yet again , is good frontend necessary for django projects? 🤔
And I'm sorry if it seems unrelated
Doragonsureiyā
Kasem
Hello everyone, is it feasible to pull tweets from X platforms to analysis? Is there a free plan for this purpose? If there anyone test that using Django could give me advice?
brandnew
Hello, Can anyone share me a website where I can learn and master django? Thanks in advance.
Doragonsureiyā
Looking for Django tutorials? you can follow these three recommended ones:
* Official documentation and tutorial
* Tutorial from MDN
* Tutorial from django-girls
Nasrullah
Guys, does anybody have worked with django uuid? Is it suitable to create certificate verification system?
Nasrullah