Yaquier
The best way is, STATIC_URL ='/static/' STATICFILES_DIRS = [ BASE_DIR / 'static', ]
Enes
I am kinda beginner I have just 3 years experience and I didn't gain toi much experience in these 3 years
Enes
I even don't know about middleware sessions
Д
Stupid middleware ordering matters
Д
CORS has to be first
Yaquier
Read this: - https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/
Yaquier
Enes
Man if u got 3 years on it, there must be sth wrong in your studying way
its a long story I am working at a different brand I am coding after work evenings
Yaquier
No excuses pal, just keep going
Proud of people like u
Enes
thank you
Yaquier
thank you
I was nothing
Д
Was Django written in Python
Д
Mostly 😊
Hmm so it seems. I'm wondering how scalable Django is.
cj
Hmm so it seems. I'm wondering how scalable Django is.
https://docs.djangoproject.com/en/dev/faq/general/#does-django-scale
Д
Quite scalable
Do you have some definitive resource on handling DRF auth? I've been struggling with that. Mostly understanding statefulness/statelesness and which parts are handled by which component
Neo
https://www.django-rest-framework.org/api-guide/authentication/
Д
Have you checked out the DRF documentation?
I've read it and re-read it. The thing assumes you know what you're doing 😅
Yaquier
I've read it and re-read it. The thing assumes you know what you're doing 😅
For instance, Django for API, Django RestFul Web Services, and so on
Yaquier
Yaquier
I've read it and re-read it. The thing assumes you know what you're doing 😅
But dude, you should fight with the docs in the end because inside it is all what u need or will need
Godfrey
Hello, great Django Devs, I have a little problem, I am trying to automatically add a user to a group when it is created, this is the view bellow
Godfrey
Oh, I can't send media 😅
Godfrey
But if anyone have an idea, I would really really appreciate if you give me a hand
Doragonsureiyā
Oh, I can't send media 😅
Read the rules before any activity: @PythonRules
Fredy
Hello group, I need help in Django REST Framework... I have a model, whose function is to receive floating data, performs arithmetic operations, the result of each operation depends on others... a = data_a b = data_b c = data_c d = a+c e = b * d The result of the operations are saved in the database... I've done a lot of research and I only find that they do it in the views.py this is fine???
Д
Because when you do it in the View, it means that you can feed the DB through the View (web) only
Fredy
Depends on how the data is distributed into the DB - maybe it is possible to move the calculations to the serializers?
I currently have it in the serializer... Overwrite the create() method Then I do the operations and it worked for me
Д
I currently have it in the serializer... Overwrite the create() method Then I do the operations and it worked for me
That's better I think. Now you can read CSV or JSON files for instance and feed them to the serializer and save them to the DB
Fredy
Only then could I achieve the goal...
Д
Only then could I achieve the goal...
I don't remember if I've often overwritten the create method but I do write my own fields
Д
I guess the instance.save() is how the serializer works. The serializer has that in its Meta though
Д
The Class I mean
Fredy
I guess the instance.save() is how the serializer works. The serializer has that in its Meta though
Correct, as I read that, views.py is the data presentation layer and should not be operational so leave it in the serializers
Д
Perfect, thanks
If the calculations were really hairy with multiple models involved before being shoved into multiple places, then the serialization layer for that particular view would have to be tailormade
Fredy
I'll check tomorrow
Thank you very much, I have to do many arithmetic operations some complex ...
Rudraksh
I am new to django I don't understand the date time concept in django. How to use dates ? What is timezone. Can i simply use python standard datetime lib? Please help me with this.
Lucky
How to create authentication token with user details
😒😒
context['iot']=Item.objects.filter(subobj.values('id')[0]['id'])  Trying to pass this into my context variable but I need it to be dynamic The slicing: values('id')[0 or 1]['id'] I can't think of any way to go about this I tried to do this values('id')[(i for I in range(len(ite))]['id'] and I ran into an error
😒😒
Error: qs indices must be integers or slices, not generator
Doragonsureiyā
How to create authentication token with user details
These single steps will help you a lot: Step 1️⃣: Open a browser Step 2️⃣: Write down https://google.com or https://duck.com and press Enter Step 3️⃣: In the search box, write down the same words you asked here Step 4️⃣: Read the first results
Adam
Hi all, does anyone know a video on creating a Media(News) Site in Django?
Aysuliw
#question Can I get data from any database without models in django? Just adding it to the DATABASES in settings file. Thanks in advance for your anserws!
Aysuliw
Sorry for the incomplete question😁 How can I do it?
Doragonsureiyā
Sorry for the incomplete question😁 How can I do it?
These single steps will help you a lot: Step 1️⃣: Open a browser Step 2️⃣: Write down https://google.com or https://duck.com and press Enter Step 3️⃣: In the search box, write down the same words you asked here Step 4️⃣: Read the first results
Vxvek
Can any one help with sending pdf to mail using django
Doragonsureiyā
Can any one help with sending pdf to mail using django
Don't ask meta questions like: "Any user of $x here?" "Anyone used technology $y?" "Hello, I need help on $z!" Just ask directly! The better you are at explaining the problem, the more likely you are to get help. Asking smart questions
Anonymous
guys do u have good recourses for build LMS by django
Anonymous
LMS(Learning mangmant system)
Doragonsureiyā
guys do u have good recourses for build LMS by django
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
Med
how to create an access token and refresh token using simple jwt for every user not only superusers ?
cj
how to create an access token and refresh token using simple jwt for every user not only superusers ?
actually it doesn't matter if it's a superuser or not, it should work out of the box
Med
it works fine when I create superuser but when i create a normal user it doesn't and it says "detail": "No active account found with the given credentials" why
Med
btw i am using Custom User from AbstractUser model
Med
my model
Med
class Myuser(AbstractUser): username = models.CharField(max_length=100 , unique=True) name = models.CharField(max_length=100 , blank=True) email = models.CharField(max_length=100 , unique=True) password = models.CharField(max_length=100) USERNAME_FIELD = 'email' REQUIRED_FIELDS = ["username"]