Pandu
hi i’m mid level in django and i don’t have any idea for project :( please give me some ideas 🤯💤
sure you can make CMS apps like blog, recipes, insta reel/yt shorts clone, productive apps like: todolist,notemaker wheather app, currency converter using apis or simple ecommerce i just made my recipes site main drawback was , images were not rendering which were uploaded by user, on deployment mode with debug=False i tried setting up whitenoise and external bucket but didn't worked so for now leaving it debug true , its working without any efforts lol i mean can learn about rendering static files uploaded by users on production.
Serhii
Hi there! Could someone share a few courses or YT videos about Django, I am a totally beginner, and know only python syntax. Or some advices would be great 😊 I do not know where the point to start is 🫣
Felix
Please, i need a mentor on Django
Victor
Tell us your question and we can help you.
clouded
Please, i need a mentor on Django
This is not a thing for these groups.
Felix
Tell us your question and we can help you.
Okay..thanks I need help on django form
Danya
AZ
Hello everyone how are you, i want to deploy my website in two separate droplets one for frontend and second for backend, the first one is 2GIB RAM and 2 vcpus is it enough for frontend, the visitors about 500000 per month
clouded
Hello everyone how are you, i want to deploy my website in two separate droplets one for frontend and second for backend, the first one is 2GIB RAM and 2 vcpus is it enough for frontend, the visitors about 500000 per month
If you decide to move to @pythonofftopic, add how the frontend is separate from the backend (as in DRF and SPA) or if you're merely referring to static files of a regular Django instance without DRF) alongside your request in @pythonofftopic. Don't forget to remove your request here, since crossposting is forbidden.
Anonymous
#question i have to use this variable {{file.author.avatar.url}}, but it is not working
clouded
#question i have to use this variable {{file.author.avatar.url}}, but it is not working
"Not working" is a very bad description of the issue you're facing.
Anonymous
Why?
I don't now
clouded
Or: Why do you think so?
clouded
Or: What makes you believe Django does not accept this?
Anonymous
Exception Value: The 'avatar' attribute has no file associated with it.
Anonymous
That's a start.
But where is an answer to this?
clouded
But where is an answer to this?
Google. But I'll help you this time: https://stackoverflow.com/questions/15322391/django-the-image-attribute-has-no-file-associated-with-it
I'm
Does anyone know why should we use csrfToken when we are posting in DRF? I know the application but I am using token authentication. Why should I use csrf too? Ehat is the difference between csrftoken and token authentication? The procedure of both look the same. A token is created when a user has logged in and in every url header the browser should give us that token to check.
Promiscuous Ferris
while using DRF you shouldn't use CSRF token... unless you're doing something wrong
a DRF api is just as vulnerable to CSRF attacks as are vanilla django ones. as long as you store tokens in a cookie, it'll be sent with every HTTP request. DRF apis are based on HTTP requests too.
Promiscuous Ferris
unless you use local storage based tokens, meaning that only the js codes that are received from your website, can access your website's token. which is generally how jwt is handled.
ʜᴀssᴀɴ 🥴
What can i use django
Promiscuous Ferris
Anonymous
google
very simple
py
Can someone tell me what does Key management means? and how to achieve or implement it in Django in terms of security?
I'm
while using DRF you shouldn't use CSRF token... unless you're doing something wrong
Why? I use next.js and djangoDRF. When I want to post something, csrf error has occurred.
I'm
a DRF api is just as vulnerable to CSRF attacks as are vanilla django ones. as long as you store tokens in a cookie, it'll be sent with every HTTP request. DRF apis are based on HTTP requests too.
I'm using authentication tokens already. And all of my views are accessible when users are logged in. So why should I use another token?
Hamid
I'm trying to lock object A that has fk to object B and C but I want to only lock object A and not B and C: one senarion is to make db_constraint=False in that fk but it has another risk that can fk to object that is not exists I want to know that is another way to handle this .
Alex Turner
Who knows how to configure Django (DRF) to work with Etag and If-None-Match headers?
Mirco
Who knows how to configure Django (DRF) to work with Etag and If-None-Match headers?
https://docs.djangoproject.com/en/5.0/ref/middleware/#django.middleware.http.ConditionalGetMiddleware You checked it ?
Shaun
I’ve got to build 5 web scrapers and have them handled via celery tasks. Is there a base cookie cutter or library I should use?
Software
Hello please instgram scrape in python django source code avilable any ??
Software
Hello please instgram scrape in python django source code avilable any ??
Soham
while using DRF you shouldn't use CSRF token... unless you're doing something wrong
I was thinking the same, I've never needed to add csrf tokens for my drf APIs
Promiscuous Ferris
I'm using authentication tokens already. And all of my views are accessible when users are logged in. So why should I use another token?
you can search more about how csrf works and why it's better to move to jwt tokens instead of normal tokens. jwt is not susceptible to csrf. (for apis) I'll just give you a summarized paragraph on how cookie tokens work. let's say you've given the client a token and it's stored in the cookies for your website. the way all modern browsers work is that every time any http request is sent to your website from that browser, be it from your next.js frontend client or another website's frontend client, the cookie will be sent. so essentially, if in another tab, a js code sends a http request to your website, the browser will send the cookie (and the token inside it) with the request. that tab won't see your cookie. but it won't matter. because your website receives the cookie. and you'll think you've received a request from your customer, but it was from another website.
Promiscuous Ferris
one warning. if jwt is stored in a cookie, it'll still be susceptible to csrf
Goodness
I do need assistance, I believe I am mixing up my serializers
Goodness
I successfully create an assignment but when i try to retrieve it, i observe that option and correct_option is not saved in the db this is the structure of my models.py https://www.useblackbox.io/editor?id=67b83e43-c3f5-46c2-9790-618cc462623b this is the serializer for creating an assignment https://www.useblackbox.io/editor?id=6572d5a1-9432-4d52-8edc-25aefbfaa8bf assessmentQuestionSerializer - https://www.useblackbox.io/editor?id=f6aaada1-947d-416e-87fd-2b686db09b52 and finally the answer serializer https://www.useblackbox.io/editor?id=f48ad9cb-ea73-492f-b4da-ada4d2554119
Yusif
Hi. During the user registration process, the function I wrote for e-mail confirmation returns an error. I created app password in Yandex and wrote it in the settings.py file. but it gives error again. can you help?: Error sending activation email: (535, b'5.7.8 Error: authentication failed: Invalid user or password! 1704910042-M7nb9xBAUqM0')
Yusif
Hi. During the user registration process, the function I wrote for e-mail confirmation returns an error. I created app password in Yandex and wrote it in the settings.py file. but it gives error again. can you help?: Error sending activation email: (535, b'5.7.8 Error: authentication failed: Invalid user or password! 1704910042-M7nb9xBAUqM0')
My settings.py email config: ` EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_HOST = 'smtp.yandex.com' EMAIL_PORT = '587' EMAIL_HOST_USER = '*********@yandex.com' EMAIL_HOST_PASSWORD = config('EMAIL_HOST_PASSWORD') EMAIL_USE_TLS = True DEFAULT_FROM_EMAIL = '**********@yandex.com'`
Yusif
yes. email confirmation
ruthless
yes. email confirmation
send_mail function is not working
Yusif
Error sending activation email: (535, b'5.7.8 Error: authentication failed: Invalid user or password! 1704910042-M7nb9xBAUqM0') Is that why this error?
Mahmuod
I’am trying to add rest auth but it returns NO MODULE NAMED rest_auth
Mahmuod
any help
Mahmuod
It’s all ready installed
Charly
It’s all ready installed
As the error says is not. You may not have installed it in the right virtualenv
Mahmuod
I reinstalled it few times but nothing happens
Charly
I reinstalled it few times but nothing happens
yeah but not in the right place
Mahmuod
Mahmuod
Done it
Habib
Hi there, I have a question Say i want to create a docker image of a django project Which commands are necessary to be included in dockerfile for it to work properly collectstatic Makemigrations Migrate Are they necessary? Or a good thing to do? I am still using python manage.py runserver in CMD [] to run it
Java
I don't know if it sounds absurd but is there a way to put two forms in the same html (the two forms have different models)?
Java
I've been searching for information but I can't find what exactly I'm looking for.
Habib
None of these, at the moment of building the image you don't have access tot he database to run migrations and create migrations needs to be done in development
Yeah but what if i am using gunicorn instead...and one more thing django does come with default sqlite right ..what about it how will it be handled in image Sorry if my questions r too vague
Habib
Ok thank you so much
Charly
We don't know what's the purpose of your application
Charly
I meant that you are the only one that know what features are missing in your project
Charly
eyah if your project ha nothing else to do go with another roject
Charly
thats up to you
@Rp
Python connect to Outlook server using imap has error b'LOGIN failed.' I have a Microsoft account, that is an enterprise account, and I want to use IMAP in Python to connect to the Outlook server, port 993. I got this error after running ('b'LOGIN failed.''). I also used app passwords or disabled all 2FA, still get this error.  Please assist me if you are familiar with this situation.  Here is my code import imaplib import email from email.header import decode_header import webbrowser import os import rds_config # account credentials username = "*** Email address is removed for privacy ***" password = "mypassword or app-password" imap_server = 'outlook.office365.com' # create an IMAP4 class with SSL imap = imaplib.IMAP4_SSL(imap_server, port=993) # authenticate imap.login(username, password) # status, messages = imap.select('"Sent Items"') status, messages = imap.select('INBOX') messages = int(messages[0]) Here is the error:
@Rp
error Traceback (most recent call last) c:\Users\Among\Desktop\Code\UpWork\rodney_projects\lambda_sync_email_to_MYSQL\source\test.ipynb Cell 15 in <cell line: 26>() 24 imap = imaplib.IMAP4_SSL(imap_server, port=993) 25 # authenticate ---> 26 imap.login(username, password) 28 # status, messages = imap.select('"Sent Items"') 29 status, messages = imap.select('INBOX') File c:\Users\Among\AppData\Local\Programs\Python\Python39\lib\imaplib.py:612, in IMAP4.login(self, user, password) 610 typ, dat = self._simple_command('LOGIN', user, self._quote(password)) 611 if typ != 'OK': --> 612 raise self.error(dat[-1]) 613 self.state = 'AUTH' 614 return typ, dat error: b'LOGIN failed.'