Hojiakbar
how to connect to the site with python to get news ever
Dev
had to scale my django app database connection pool so i used the connection pool option on digitalocean and now most of the page on my django admin returns Error 500 and i see this as part of the error django.db.utils.OperationalError: cursor "_django_curs_140571912341312_sync_43" does not exist
Hojiakbar
site have list products i need to connect to this and get info when it is change
ERMIA
Connect to where?
ERMIA
Your db?
ERMIA
Or external site?
Hojiakbar
Hojiakbar
when it refreshinig mine also
ERMIA
yes
You need websockets to have real time connection with your client
ERMIA
Or every 30s req backend which is not a good idea
Hojiakbar
have other way
ERMIA
Only way for real realtime connction is websockets it's simple
ERMIA
You need django channels
ERMIA
And socket.io or ws module in client side
ERMIA
have other way
Or in worst way request every minutes like (iranian goverment websites😂)
ERMIA
Or watch your database filesystem
ERMIA
There are many ways but standard is ws
A
Can any one tell how to use. MongoDB in django
A
And it is use Full or not
Doragonsureiyā
Can any one tell how to use. MongoDB in django
Do you want to use Django with MongoDB? Then you shouldn't Please read this article: https://daniel.feldroy.com/when-to-use-mongodb-with-django.html
kumar
resources to start learning django ?
Doragonsureiyā
resources to start learning django ?
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
Barss
Friends, I really need help with deploying a Django project on a Linux server. I'm using the Oracle Cloud service. We have a Ukrainian project and the task is to create an informational bot for internally displaced people. Unfortunately, the project doesn't have a budget, only volunteer work. I've already written the bot and its Django admin panel, but I've been trying to deploy it for almost a week without success. Perhaps someone could assist me with this task?
Soham
Hello, i want to add objects detection from image with yolov5 , and want to integrate it with django, so anyone know the most efficient way to detect objects from a image in yolov5
Nat
Hello, I was using post_generation decorator in my ModelFactory, but during test, it's resulting unstable result. Sometimes the model created with factory will be encluded in Model.objects.all(). Sometimes it won't. What could be the problem
Erkaboy
Hi all. I need some advice. I have driver's locations (lat,long). I used redis cache to save them. Now I have to find drivers in given radius. I go through to list again and again every time. I am going to know is there any better aproach for this. Thanks for answers.
123456
Help please I'm building a Django based app and I was asked to do few steps in the project . First one was data base using models.py ( I also configured MySQL in settings.py Second step I'm asked to do a data access layer ( using Django orm ) I know that DAL is used to interact with my database ( I was asked to use one class DAL based on CRUD for example to read customers update or delete and so on . So where and how do I work with the data access layer . Which file to implement it into ? Vies.py ? Any help is good Thank you
Katerina
Hi all. I need some advice. I have driver's locations (lat,long). I used redis cache to save them. Now I have to find drivers in given radius. I go through to list again and again every time. I am going to know is there any better aproach for this. Thanks for answers.
I would do this - depending on the scale of the map, try to divide your map into square sectors (say 1km to 1km). After you update the location of a driver, assign him a sector that he is in. If you have many drivers, it would be easier to just select drivers in a certain sector and work with them. It depends a lot on radius etc., but I would calculate on location update 100%
M. Hossein
I use LoginRequieredMixin on my view which redirect user to login page if user is not authenticated. What I want is to modify login page context when redirecting. For example if user wants to see his/her profile and not logged in, redirect to login page and write "Please login first". How is this possible?
Muflone
How?
From the view you use request.GET.get('next')
부산
Hello, how are you! There is a Product model and there is a ProductImage linked by a foreignkey. How to write a form to add several pictures to 1 product?
123456
Since it's something related to database , is it a good practice to put in models ? Business logic also goes inside models ... the file will be full of code . Not too much ?
Charly
add a new file
123456
부산
How can I write a form that allows me to upload multiple images at once?
𝔸𝟙𝕕𝕪𝕟
is mptt good for use?
부산
Charly
nothing working
We don't know what exactly your have done an how is it failing
부산
def clean_slug(self): slug = self.cleaned_data["slug"] if not slug: name = self.cleaned_data["name"] slug = slugify(name) return slug this is written in the forms.py but it is doing nothing. how can I slugify based on the name when I create a new product by without filling out slug field?
Derrick
Is your self. Cleaned_data dictionary preload and also check if it's empty or not
Никита
Hi all! Please tell me, I'm doing a 3-step registration, using 3 forms that inherit from ModelForm and view classes that inherit from FormView. The first two pages were ok. On the first, I write down the first name, last name, mail and number in the session. On the second, I confirm the mail using the code. But there is a problem with the third page. There should be two fields: 1) Enter password 2) Enter the password again. And here in the form I don’t know how to make the password validation be from Django (well, that is, checking for length, characters, similarity between the first and second input field, etc.). Tell me, please, how to do this? From what class to inherit in the form?
Anonymous
I want to set an option for the user (employee) who is allowed to add the latest news and decisions and can modify and update them constantly How can I do this?
Caleb
I want to set an option for the user (employee) who is allowed to add the latest news and decisions and can modify and update them constantly How can I do this?
You can either use the permissions module that is built into Django or you can have a role field in your user table with different values ie admin, staff, writer, employee and so on
Rev3rce
I don't understand the error in Django: Django.core.exeptions.Improperly.Configured, this is because of ..., include('account.urls') Can anyone help me?
ᴋʜᴀʏᴅᴀʀᴏᴠ
I don't understand the error in Django: KeyError: 'SECRET_KEY'
123456
need help with fixing models.py if anyone up for it ? i have been requested to make a project to handle flight search system . i took the liberty to fetch data from Amadeus API for real flights . when fetching the flights it's giving back information ( way more than i need , but some of the responses are useful and i've decided to use them into my project suh as terminal , grand_total , travelerType , currier_code,number and flight segments (which will show if the flight had a stop , if the flight is return , if the flight is one way ) my current models.py class that is taking care of this is class Flight : class Flights(models.Model): id = models.BigAutoField(primary_key=True) airline_company_id = models.ForeignKey('Airline_Companies', to_field='iata_code', on_delete=models.CASCADE) origin_country_id = models.ForeignKey('Countries', on_delete=models.CASCADE, related_name='origin_flights') destination_country_id = models.ForeignKey('Countries', on_delete=models.CASCADE, related_name='destination_flights') departure_time = models.DateTimeField(null=False) landing_time = models.DateTimeField(null=False) remaining_tickets = models.IntegerField(null=False, validators=[MinValueValidator(0)]) what would you do ? make another class or add fields to take care of the the data that's being returned from the API ?
akshay
Anyone can help me
𝙰𝚜𝚑𝚠𝚒𝚗
Anyone can help me
not until you explain your problem
Yaroslav
hi guise, I now deploy Django project and I have error with gunicorn, it's error: ● gunicorn.service - gunicorn daemon Loaded: loaded (/etc/systemd/system/gunicorn.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Sat 2023-06-24 20:28:51 UTC; 9s ago TriggeredBy: ● gunicorn.socket Process: 33046 ExecStart=/home/venv/bin/gunicorn --workers 5 --bind unix:/run/gunicorn.sock CryptExchangeSite.wsgi:> Main PID: 33046 (code=exited, status=200/CHDIR) Jun 24 20:28:51 ubuntu-dtx-2gb-2vcpu systemd[1]: Started gunicorn daemon. Jun 24 20:28:51 ubuntu-dtx-2gb-2vcpu systemd[33046]: gunicorn.service: Changing to the requested working directory fail> Jun 24 20:28:51 ubuntu-dtx-2gb-2vcpu systemd[33046]: gunicorn.service: Failed at step CHDIR spawning /home/venv/bin/gun> Jun 24 20:28:51 ubuntu-dtx-2gb-2vcpu systemd[1]: gunicorn.service: Main process exited, code=exited, status=200/CHDIR Jun 24 20:28:51 ubuntu-dtx-2gb-2vcpu systemd[1]: gunicorn.service: Failed with result 'exit-code'. maybe someone knows how to fix it
KingFx
how to fecth data in a django app from a form in a react app
Yaroslav
Drf(django rest framework) or websocket
Yaroslav
How it make ?
KingFx
Drf(django rest framework) or websocket
i have a form in the react app i just want to retrieve data when submit and sen them to the django backend app
Christian
i have a form in the react app i just want to retrieve data when submit and sen them to the django backend app
If you have a react app you should consider to build a rest api, but if you only need to fetch data from a “side” backend that has not an api you can create a “regular” function-based view that returns a json instead of a template, this needs the csrf_except decorator. This will emulate an api’s endpoint but it’s not a secure method. I recommend to add rest framework to your backend.
User
How can I authenticate an user across multiple databases without configuring in settings.py
Алексей
Hello everyone, please help
User
What are you talking about?
This is the case I'm working with : i need to create a database whenever a new user gets registered. That database is specified to that specific user. In django there are multiple db concepts which we can configure in settings.py.
Karthik
Hello can anyone give me a suggestion recently I joined to a company I have 2 options I can learn Nodejs or Django, which one has more scope and more job opportunities ? and I heard that now a days all companies are using nodejs since they can develop both frontend and backend using javascript only
Eric
Hello can anyone give me a suggestion recently I joined to a company I have 2 options I can learn Nodejs or Django, which one has more scope and more job opportunities ? and I heard that now a days all companies are using nodejs since they can develop both frontend and backend using javascript only
Learn Both, build the same REST APIs with Django+DRF and NodeJS+Express. But if you must choose then learn Django and then DRF soon after. And then when you've built a few APIs you can learn Typescript and Vue/React to build frontends that consume you're APIs
Eric
Hello can anyone give me a suggestion recently I joined to a company I have 2 options I can learn Nodejs or Django, which one has more scope and more job opportunities ? and I heard that now a days all companies are using nodejs since they can develop both frontend and backend using javascript only
With experience building backends with Python and Django as well as frontends with NodeJS, Typescript and Vue/React then you'll find it really easy to learn how to build backends with NodeJS and Express
Eric
How can I authenticate an user across multiple databases without configuring in settings.py
Auth0 maybe? and then you keep your individual client databases will be only for application data. But you have to config settings.py no matter what auth method you choose
Eric
Thank you for the suggestion 🙂
No prob: Start with Django
Anonymous
Brothers any suggest a better youtube channel or any playlist to learn django from scratch
.
How to disable certain options of a ForeignKey field using crispy forms? The form inherits a ModelForm, and the model has a ForeignKey to another related model. I still want to display all related model instances as dropdown options, but disable certain ones. Modifying the queryset alone isn’t enough because I still want to display all of them, with only certain options shown as disabled.