Odilov Abdullajon 👨🏻‍💻
#help from django.utils.encoding import force_text ImportError: cannot import name 'force_text' from 'django.utils.encoding' (/home/beshagroeksport/virtualenv/odilovme.uz/sxbteams/3.10/lib/python3.10/site-packages/django/utils/encoding.py) I am deploying my project to hosting, but I got this error. In local, my project is running
Odilov Abdullajon 👨🏻‍💻
in my local (venv) abdullajon@Abdullajons-MacBook-Pro sxbteams % python -m django --version 5.0.3 ——- in cpanel ((sxbteams:3.10)) [beshagroeksport@hosting2 sxbteams]$ python -m django --version 5.0.3
Charly
it is the same but I am getting same error
I doubt because force_text was removed on django 4
Odilov Abdullajon 👨🏻‍💻
I doubt because force_text was removed on django 4
from django.utils.encoding import force_text ImportError: cannot import name 'force_text' from 'django.utils.encoding'
Odilov Abdullajon 👨🏻‍💻
repeating the same thing won't change anything
what should i do bro to solve this problem
Charly
what should i do bro to solve this problem
Use the version you use locally which is not 5.0.3
Mahnoosh
Is There anything like dd() of laravel, in Django?
cj
Is There anything like dd() of laravel, in Django?
firstly, what does dd() do on Laravel?
Mahnoosh
firstly, what does dd() do on Laravel?
dump and die we can see values of any variables even objects with details in the browser with put dd($var) in any line of code and stop runing later lines
Vikend 🏆
Guys what is django and where can I learn it from? It's something like flask ?
Doragonsureiyā
Guys what is django and where can I learn it from? It's something like flask ?
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
‹m›Javad‹/n›
Guys, what does error 405 mean in Django?
clouded
Maxim
Guys, what does error 405 mean in Django?
exactly the same as not in Django https://www.google.com/search?q=http+405
‹m›Javad‹/n›
I wish I could send you a picture
Charly
I wish I could send you a picture
That won't change anything, a 405 code menas the same on django or other technologies, just do some search
PΛRSΛM
Hi, can I make a list like model.objects.filter return only 3 items or more?
PΛRSΛM
Im working on a socialmedia project and i want to show 3 posts with must likes in home page
PΛRSΛM
yes
Can you give me an example?
Charly
Can you give me an example?
Model.objects.filter(...)[:3]
PΛRSΛM
Model.objects.filter(...)[:3]
look i wrote this query but every time i like a post it returns that post again dpaste.org/jSJGQ
Charly
look i wrote this query but every time i like a post it returns that post again dpaste.org/jSJGQ
why it would return a differnt one if you are sorting by the same fields?
Charly
I dont understand the question, you asked if you could return a fixed number of obejcts
Charly
yes it returns well
So then whats the issue?
PΛRSΛM
So then whats the issue?
how can i send image in group?
Charly
PΛRSΛM
Im working on a socialmedia project and i want to show 3 posts with must likes in home page
look its a social media project when user1 like post1 it comes in home page where i wrote that query i asked before but the problame is when user2 like post1 it cames to home page again (duplicated) It would be better if I could show it with a picture
PΛRSΛM
You can try to filter by unique id
Can you give a code example?
Charly
Can you give a code example?
Can you do some effort to search?
Fahri
Duplicate records caused by SQL join?
Dairon
Does anyone knows how to deploy a Django app in a VPs server with plesk infrastructure??
Dairon
Maybe a meaningful resource to help me??
Parsa
Can you do some effort to search?
For Django database which is best database to use postgress?
Charly
For Django database which is best database to use postgress?
Any of the supported databases is fine. PostgreSQl is a common recommendation
Parsa
Any of the supported databases is fine. PostgreSQl is a common recommendation
as Django developer what level we have to learning can you describe some source ?
Charly
Describe a source of what?
Charly
Postgress
And you want the source code?
Parsa
And you want the source code?
Sorry doc or source of learning
Charly
Sorry doc or source of learning
I'd start to look to the official documentation
Sing
Can some one please help to do this I want to execute a small function daily at 10 a.m without using celery inside my django project Is there a way?
Sing
Yes you can use the celery beat for scheduler
Without celery ? Is there a way?
cj
Without celery ? Is there a way?
maybe with cron but it will depends how tied your function to Django is
Sing
django management command with cron job
Can u plz share me reference
Sahil
I want to upload file in django db with special chracters like “,/,\ is there any way to do this
Sahil
Like te”st.pdf
Sing
django management command with cron job
python3 manage.py crontab run 2e3cd82db7f102790499c08a4d8e0244. Specifying crontab id only i am able to run.but automatically it is not executing with runserver
Jahongir
Hi what can you advise me to convert html to pdf, I was using weasyprint but it makes the ui look bad
Doragonsureiyā
Hi what can you advise me to convert html to pdf, I was using weasyprint but it makes the ui look bad
This is not a Django specific question, please delete your offtopic message. If it's a Python related question go to @Python group, otherwise please move to @PythonOfftopic group and ask there.
Smart manu
django.core.exceptions.DisallowedHost: Invalid HTTP_HOST header: 'localhost:8000'. You may need to add 'localhost' to AL Can anyone help to solve this error'
Smart manu
Yes there must be somthing need to be changed in ALLOWED_HOST variable
Smart manu
ALLOWED_HOSTS = ['ip-address', 'www.your-website.com']
Smart manu
what i have to add , please tell
Smart manu
ALLOWED_HOSTS = ['localhost']
Smart manu
django.core.exceptions.DisallowedHost: Invalid HTTP_HOST header: 'localhost:8000'. You may need to add 'localhost' to ALLOWED_HOSTS. again the same error
Smart manu
ALLOWED_HOSTS = ['ip-address', 'www.your-website.com', 'localhost']
Smart manu
please tell what needs to be done