None
hi what is between status =200 and status= status .HTTP_200_ok in django rest framework ?
Charly
Hi All, Can someone tell me how to use pgbouncer in DRF?
DRF has nothing to do with it. For general django usage you just use the PGbouncer url insetad of the DB url for database config.
cj
between 200 and 200... there's nothing ¯\_(ツ)_/¯
None
what do you mean by saying "between" them?
I mean, what is the difference between them?
cj
I mean, what is the difference between them?
that's a totally different word/question. At "value" level there's no difference, they both are 200 ... at "coding" level, as Charly said, one is a constant (that you should use instead) and the other is a direct numeric value
None
Is just a constant with the same value
So there is no need to enter this code? from rest_framework import status status = status. .....
Charly
https://en.wikipedia.org/wiki/Magic_number_(programming)
Charly
status =200 ?
No, read it again both our messages
None
No, read it again both our messages
What do you mean? The first returns only the value, the second return HTTP 200 OK ?
None
Both have the same value
So, do we use the second one to cleanly write the code?
None
Yes, read the link I sent
Well, you would have told me this earlier, anyway, thank you for your help
Charly
Well, you would have told me this earlier, anyway, thank you for your help
Dude, you think i sent you the link for no purpose?
cj
In general, which method is better to use?
I've already said that in my message, didn't you read that?
Charly
I told you multiple times to read the messages
None
I told you multiple times to read the messages
I understood what I meant was the difference in the answer
Charly
The link is just additional info about why is better
cj
I understood what I meant was the difference in the answer
200 is not different than 200 ... ¯\_(ツ)_/¯
Charly
I will read it soon
🤦‍♂️
$🇳🇬
PLEASE I NEED HELP. I tried sending email via the gmail smtp server using send_mail(). The operation is SUCCESSFUL as indicated in the Python shell with a success code of "1", but the email is not delivered in the recipient email. Also, the email is not in the "Sent Mail" folder of the sender email. Yeah, I've checked the Spam/Junk folders of the recipient email, there's nothing there either. Any ideas what the problem is and possible solutions?
$🇳🇬
None
i think free for 100 emails but you can change your account 🙂
$🇳🇬
Send your code
# settings.py # Email Configuration EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_HOST = 'smtp.gmail.com' # Gmail's SMTP server EMAIL_PORT = 587 # The port for secure TLS connection EMAIL_USE_TLS = True # Use TLS (Transport Layer Security) to encrypt the connection EMAIL_HOST_USER = 'youremail@gmail.com' # Your Gmail email address EMAIL_HOST_PASSWORD = 'yourappspecificpassword' # App-specific password or your Gmail account password In the python shell: from django.core.mail import send_mail send_mail("Hello Friend", "Hello from Django", "myemail@gmail.com", ["clientemail@gmail.com"], fail_silently=False)
$🇳🇬
Do you have account in smtp.gmail.com?
I have a Gmail account. Isn't that the same thing?
Secret
I have a Gmail account. Isn't that the same thing?
https://eu.siteground.com/kb/gmail-smtp-server/
Secret
Please check that article.
Secret
Anyone knows any django-specific solution?
Where did you host django project?
$🇳🇬
$🇳🇬
Where did you host django project?
Not hosted yet, still on localhost
Secret
Not hosted yet, still on localhost
Once you host your app, you can use server's email service.
.
I have a base.html file where I store the title line for the site. I also have a file for a different page I extend base.html to. My question is: how can I make a specific title for my page?
Secret
Karunakar
Did anyone host ur django web app with sqlite on render if yes can u help me?
Karunakar
Or suggest me any free hosting service plzz
Doragonsureiyā
Did anyone host ur django web app with sqlite on render if yes can u help me?
No one can help you until you explain your difficulties.
Karunakar
No one can help you until you explain your difficulties.
Like It seems we can't host our project without postegre SQL integration in render so I wanna know did anyone hosted on render so that like I can connect with them regarding this
Karunakar
try pythonanywhere
Thanks I'll have a look
مريم خالد
hi ,everyone i keep getting this error despite i do not need to overide the update method and even after updating it i still get the same error NotImplementedError at /projects/api/update/4 update() must be implemented. Request Method: PUT Request URL: http://127.0.0.1:8000/projects/api/update/4 Django Version: 4.2.6 Exception Type: NotImplementedError
مريم خالد
this is the code :https://linkode.org/#7oo0EffDbWXYXOwjZRedg
Александр
Good afternoon, please tell me who may have faced an arbitrary stopping celery worker. Because of this I have situations where when I have a request 200 ok - I get an error log when there should be SUCCESS. At that, it is not for each tack, but on average, every 1.5 hours happens. From journalctl received such logs: окт 18 08:06:01 qsspchznrd celery[1645516]: [2023-10-18 11:06:01,185: ERROR/MainProcess] Process 'ForkPoolWorker-2' pid:1645519 exited with 'signal 15 (SIGTERM)' окт 18 08:06:01 qsspchznrd celery[1645516]: [2023-10-18 11:06:01,195: ERROR/MainProcess] Process 'ForkPoolWorker-1' pid:1645518 exited with 'signal 15 (SIGTERM)' That is, the process of the Worker was disabled. In the Django project put such a thing, so that there did not lose the task: CELERY_ACKS_LATE = True My celery tasks code: https://pastebin.com/KYix0PKZ My settings.py code: https://pastebin.com/hTmCpv9a As a result, falls into the common block except, which means that it is not a default python Exception, but some exit. Does anyone have any idea why celery is acting this way?
AZ
Monitor the memory
AZ
Suggest to set up some logging on the Celery to give you better insight on the part that is failing
AZ
SIGTERM seems like it managed to terminate gracefully
Александр
Maybe try provision additional resources for the celery tasks.
You mean to increase concurrency setting inside the worker process?
Александр
SIGTERM seems like it managed to terminate gracefully
I thought the same, but I see errors after log about 200 ok request to the device. I don’t even know, why celery creates error log when it is an exception
Александр
Hi all. I have many applications, there are pictures and posts and news. I want to give them a like system. The best option I found is to make a separate application, make a model in it, and send requests via the REST API using JS FETCH. Are there better options? By the way, I still don’t know how to implement the model :)
ƑѦⴽⵊⵠƲƝ
Hi, there! Where i can use Django as a backend? Cuz backend developers make APIs for frontend and they use it. But i don't wanna use API? 😅
ƑѦⴽⵊⵠƲƝ
Like.... Basic using Templates (jinjer)
Charly
Like.... Basic using Templates (jinjer)
Well and whats stopping you?
ƑѦⴽⵊⵠƲƝ
Like a frontend developer said that everything in backend is API
Charly
Like a frontend developer said that everything in backend is API
Well, templates are more a frontend thing thats true
Charly
but that should not stop you, or is it?
ƑѦⴽⵊⵠƲƝ
Like... I'm really lost 😩