Muflone
You're welcome
23.6.666
if i remove this from main urls.py how can ı access admin panel
23.6.666
aaa you say it should be in main urls.py ?
Muflone
exactly
23.6.666
thank you youre really god person
23.6.666
****good person
Muflone
no, I'm not I'm a teacher, I want people to learn, I don't want to solve their tasks
23.6.666
thank you so much
Asukhan
guys, hi again, can you please tell me one more thing, in Django-created website, in my storage cookies there's a cookie named like "crsftoken" and ofc the value of it. but I see, that every Django-created website instead of "crsfroken" has the name "sessionid", so why would I have a "csrftoken" one?
Muflone
csrf is used to avoid other people to use your resources without being on your website session_id refers to the currently logged user
23.6.666
you have both
can ı ask one more question
23.6.666
order.html is inside hello/templates/hello/order.html and urlpatterns = [ path('admin/', admin.site.urls), path('newyear', include("newyear.urls")), path('', include('hello.urls')), path('home',include('order.urls')) ] is that correct ?
23.6.666
its main urls.py
Muflone
you're confusing templates with routes
23.6.666
it was a little bit difficult but ı am reading now
Muflone
close telegram and study seriously your project actually is entirely irrelevant, study the basics first
23.6.666
okay
Muflone
the django tutorial has it
motasim
How add the statics in my admin jazzman Please help...
Dambek
Hi, how do I can validators for models, like, if student in group, I can't add him in other group, I use Many to Many field
Dambek
One student can perticipate from one group or lot
Yeah, student can be only in 1 group
Dambek
And in 1 group can be a lot of students
Leonardo
OneToMany
Leonardo
One Group to Many Students
Rajan
Hey everyone I am using django backend and next js frontend. So when I make my first req and that is post req for signup csrf token validation failed error occured. Can anyone help me with it
Rajan
Please help me with this asap
Doragonsureiyā
This is neither a job board nor a bulletin board.
Doragonsureiyā
Okey
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
Freddy
Django restframework
Doragonsureiyā
Vorke
Hello guys, I have a Django web app (django templates) hosted in Django, issue is on first time load (i.e. after restarting gunicorn) the page takes very long to load. Strange part is that queries run under 1 second, but page can take upto 5 minutes to load. What could be the issue?
Maestro 🏀
Can anyone help me with this issue? Thanks a lot and sorry for the ignorance but I'm stucked with this problem for 3 days https://stackoverflow.com/questions/77086719/troubleshooting-a-django-collectstatic-error-after-upgrading-to-version-4-2
Rajan
Code like this <form method='post'> {% csrf_token %}
Bro I am using next js in frontend and already have form in there how can I write csrf token there
Naggafin
Bro I am using next js in frontend and already have form in there how can I write csrf token there
how exactly are you rendering your form? are you using django's template engine or are rendering templates/components with your frontend framework?
Naggafin
Frontend framework
you have chosen a hard path my friend. because the backend and frontend code bases are decoupled, the best way to accomplish this is to, at a point in your template that django does have control over (inside the <head> tag for example), include {% csrf_token %}, then from inside your JavaScript, you search for that element with csrf_token = document.querySelector(input[name='csrfmiddlewaretoken']).value;
Naggafin
django does not work very well with heavy handed frontend frameworks which decouple the codebase from the back end. if you are just starting out in your project, and you have time to learn, I would highly recommend you use htmx instead for your future sanity
Naggafin
if that is the case, then it would likely be most beneficial for you to use django REST framework to create an API like your frontend expects
Naggafin
DRF doesn't require csrf token validation. instead you can do JWT auth for example
Naggafin
Can we do something like this if we can set csrf token as cookie on site load and then use it in our code
I think so. I actually never tried it. let me look at the django docs real quick
Naggafin
Can we do something like this if we can set csrf token as cookie on site load and then use it in our code
have a look at this https://docs.djangoproject.com/en/4.2/howto/csrf/#using-csrf-protection-with-ajax
Bandar
Hi 👋 What is the best asynchronous protocol handler in Django ? Best = Easy to use Mature Less configuration Easy to integrate
Bandar
Answer will be much appreciated
Mirco
Answer will be much appreciated
https://docs.djangoproject.com/en/4.2/topics/async/ Everything you need is here
Bandar
🙄 I went through the docs before I came here
Bandar
Thank so much though 🤍
Bandar
Django suggests channels and I’m thinking about Starlette due to versions conflict
Bandar
Am I doing the right thing 😵‍💫?
Mirco
Django suggests channels and I’m thinking about Starlette due to versions conflict
Django suggests Channels for websockets If you use Django 4.x you can just use Uvicorn for running ASGI app of Django
Bandar
Thank you 🙏
Bandar
In this case do you still use channels.generic.websocket in consumer.py ?
Mirco
In this case do you still use channels.generic.websocket in consumer.py ?
https://testdriven.io/blog/django-channels/ Here you can find a full example with Django 4
Bandar
Thank you 🙏
我乃荣大
What can you do with Django as a backend for telegram bot
I want to ask about the migrations in django because i have met some bugs while i use makemigrations and sometimes i can fix it and sometimes not. In the offical document, it only talk about the use about migrations but i want to find some about the best practice about migration, which may include what should i do and should not do in models.py. Is there some blog or article about this?
Rajan
have a look at this https://docs.djangoproject.com/en/4.2/howto/csrf/#using-csrf-protection-with-ajax
So now I am fetching the csrf token as output and sending it as headed in my post req but still I am getting 403 forbidden error
Heast
How to disable username and password save in browser
⟨ Simon |
Heast
it will disable only in one application usage
Hello friends When I run Django with ASGI and uvicorn, inside the async views, I open an async loop with asyncio.gather, then when it reaches this line, the program becomes very slow and takes 2-3 seconds to respond. But when I run the project with WSGI and gunicorn, it is ok and there is no problem with asyncio.gather. In general, I want to make a request to two addresses at the same time and receive their response in a sync view, how can I implement this correctly? I am using Django 4.1.
Dj - 505
I have a django project for a small coffee shop and I would like to try it as a simple commercial website with online payments with postgresql database . Which the best server should I choose with an economical price ?