Anonymous
Hy! I am doing my internship in a company in Django. I want to build something from scratch in Python/Django. I am thinking to build a cool Laundry Application Backend. But I am not sure if I can build it alone like I am not much familiar with Django Set Up. I can create APIs, URLs and other stuff. It is a big community of Django Devs. Do anybody wants to join me? It would be very challenging as well as fun work. I will start it as a open source project. Guidance from seniors will be welcomed!
Ed
Hi everyone, i know the basic of python and i have some experience in node.js i want to learn django.can you suggest some tutorials that will help me to learn python.
Kasra
Best course's for django?
clouded
Best course's for django?
https://t.me/django/264163
clouded
You mean the documents?
Usually it is referred to as documentation, not documents.
Mark
django or fast api?
Anonymous
If you're unfamiliar with Django, start with the official tutorial.
I did course on Springboot and then got interview offer from a company as a sde python. They gave an assignment for making APIs. I took 5 days but build that working application in python. After doing that assignment I am confident about basic Django. If you want I can share the assignment with you.
Anonymous
oh sorry it was for @Edwashj
Ed
oh sorry it was for @Edwashj
Please share the assignment with me
Anonymous
Just an advice: stick to Java/Kotlin 😁 If you've managed to start it at least, it's both more profitable, interesting and less stressful)
I have worked on some projects in a java/Springboot in a bootcamp. Python is more developer friendly and easier Print('Easy') System.out.println("Difficult")
Anonymous
🤡🤡
Doragonsureiyā
I was using Java to practice my typing speed
Your question is not related to Django. If it's a Python related question go to @Python group, otherwise please move to @PythonOfftopic group and ask there.
Mohammad
from time import sleep from celery import shared_task from django_celery_results.models import TaskResult from core.celery import app @shared_task() def Task(): sleep(3) print('success') # tasks.py @shared_task def clean_up_completed_tasks(): completed_tasks = TaskResult.objects.filter(status='SUCCESS') for task in completed_tasks: task.delete() print("Cleaned up completed tasks.") Hello, I have a problem, those who know how to work which Celery Celery, I want to delete the tasks whose status is successful, but I can't do it, can anyone help me?
Jimmies San
When a task is executed, doesn't the status become success?
Yes but considering you are having trouble with that, I'd start with some debugging to be sure what is happening there
Mohammad
I just want the tasks that were able to be in the success state to be cleared in 10 seconds
Anonymous
how can i connect django to oracle database
Doragonsureiyā
how can i connect django to oracle database
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
Isa
I'm trying to figure out about ALLOWED_HOSTS, using the example of a vulnerability related to the substitution of the Host header when forming a link to reset the password (for example). 1) The user wants to log in to example.com 2) The attacker replaces the host with maliciousdomain.com 3) and the user receives, for example, a link to reset the password https://maliciousdomain.com/reset-password But how will the user's request, in principle, get to example.com if the host has changed?
Anonymous
Do I really need to focus on sqlite, and what DB should I learn PostgreSQL or MondoDB
Muflone
while Django abstracts the db used, you should prefer Postgres instead of sqlite
Asadbek8802
is there someone who I could help with projects on Django ? I don't want any payments, just for improving my knowledge
AZ
Do I really need to focus on sqlite, and what DB should I learn PostgreSQL or MondoDB
Start off with SQLite since it is included in Python. Once you get the basics of Django. Move on to other DBs. Postgres is the preferred choice because it is most compatible with Django's ORM.
AZ
I'm trying to figure out about ALLOWED_HOSTS, using the example of a vulnerability related to the substitution of the Host header when forming a link to reset the password (for example). 1) The user wants to log in to example.com 2) The attacker replaces the host with maliciousdomain.com 3) and the user receives, for example, a link to reset the password https://maliciousdomain.com/reset-password But how will the user's request, in principle, get to example.com if the host has changed?
Imagine someone sends a letter to your house, but on the envelope, they write a different return address, trying to trick you into thinking it's from somewhere else. Kind of what happens the attacker changes the address info in a website's request. They can't change where the request is actually going (like your house in the letter example), but they can change the details about where it seems to be coming from. Solution? ALLOWED_HOSTS. This is like a list of approved senders. Django looks at this list and will only pay attention to requests that match these approved senders. In production, this list (ALLOWED_HOSTS) should include the official website addresses you expect to use, like example.com
AZ
doesn't the Host header tell the DNS server to return the ip address of the website I need, respectively, if I replaced the host, then I won't get to the site that I'm attacking
there's some confusion.. changing the Host header doesn't affect how the request reaches the server; it affects how the server processes the request once it's received. ALLOWED_HOSTS is a security measure to ensure that your Django app only responds to requests for its legitimate domain.
AZ
1. HTTP request to example.com on the browser 2. DNS resolution (translates example.com to IP address) 3. The browser sends the request to the IP address (where the Django application server is hosted). The HTTP request includes the Host Header (under normal conditions will be example.com) 4. When the server receives the request, it looks at the Host Header to decide where to route the request internally because some servers may host multiple web applications. so if an attacker manipulates the Host Header to maliciousdomain.com, the request will still be sent to the IP address of example.com. However, the server will get the request and try to look for maliciousdomain.com. If the server doesn't check the validity of the Host header (which is what the ALLOWED_HOSTS setting in Django does), it might process the request incorrectly.
Muflone
the HTTP requests don't do DNS requests the DNS/IP resolution is made before the HTTP request is made
AZ
yes
AZ
The process of finding the IP address for a domain name (like example.com) occurs even before the HTTP request is even formed.
Muflone
ip = gethostbyname('example.com') socket.connect(ip) headers = {'host': 'malicious_website.com'} socket.send(headers)
Isa
I mean how I send to DNS: find me IP for example.com?
AZ
I mean how I send to DNS: find me IP for example.com?
https://toolbox.googleapps.com/apps/dig/
Isa
Now I understand, thank you very much)
refleks1a
hello everyone, im trying to make get request to my django/drf backend from react frontend but i get this error: Cross-origin redirection to http://127.0.0.1:8080/api/v1/properties/all/ denied by Cross-Origin Resource Sharing policy: Origin http://localhost:3000 is not allowed by Access-Control-Allow-Origin. Status code: 301 here is the axios request axios.get('http://127.0.0.1:8080/api/v1/properties/all') .then(response => { }) .catch(error => { });
refleks1a
yes, i do
Muflone
then set the allowed allowed origins constants
refleks1a
and i added it to installed apps and added middleware sa well as CORS_ORIGIN_ALLOW_ALL = True
Muflone
CORS_ALLOW_ALL_ORIGINS not CORS_ORIGIN_ALLOW_ALL
Muflone
while this defeats the whole scope of CORS
Muflone
check your settings if you made some other typo in that
Ahmed kamal
im working in a simple form and using POST Method, i have an error, Although using csrf still give me missing csrf: •i check that its inside the form •check that the template file is rendered in the view what is the solution..
Muflone
you should show the code in a pastebin
Muflone
open the html page loaded from the browser and check if the csrf token is there
Юрий
What is the best way to store money in django? Only the one currentcy is needed. DecimalField, IntegerField or MoneyField (use django-money). How will it be stored in postgres? I don't want to loss cents: round and etc.
Jimmies San
And a stack overflow thread is linked there as well
refleks1a
check your settings if you made some other typo in that
I just cleaned the cash and everything works now)
renji
hey guys how can i give a route stop number in commute project
renji
can i give it in dropdown or enter
renji
the stopnumber
Д.....
Hello, a question for those who write in Django. I have a project where 2 types of authentication are possible: default from Django and through Google (I use allauth). Now I'm writing tests for CustomLoginView (I just overrode form_invalid method , but that's not the problem). When I run tests, it returns the error allauth.socialaccount.models.SocialApp.DoesNotExist. I understand that this error occurs because allauth is my default authentication method. If so, how to specify in the tests that the tests use the default login and not from Google? Thanks in advance
Ali
Hi community I want to use python for backend just for handle database and models، create api and websocket connection. My database is postgresql. Which is the best for these aims: Django rest framework or fastapi?
Anonymous
Can you provide me full roadmap to learn Django
Anonymous
Or which one is best flask or djnogo for web framework which the commonly used by companies.
Yazan
I am building a mobile application using Django and Flutter and I need to use Firebase for the messaging feature. Is there anything that can help me with this matter? Or how to use Firebase