Macara
hi family, I'm looking for someone who has already created an online chat application with django
govind
User govind has 1/3 warnings; be careful! Reason: crossposting
Am Not getting any solution from this group that only I tried with other groups. How u point that crossposting
py
I'm developing a website using Django where students can send requests to tutors. The request form will contain basic information such as address, full name, and more. Tutors will then have the ability to accept or reject these requests. To implement this feature correctly, What things I have to know any clue ? Any input is welcome
Anonymous
hi guys, how can i send css file link from home.html to base.html using jinja?
Rose
User S has 1/3 warnings; be careful! Reason: totally offtopic
𝑴𝑼𝑯𝑨𝑴𝑴𝑬𝑻𝑨𝑳𝑰
The models code in the admin should be extracted from the template folder in the admin
Rose
User 😎 has 1/3 warnings; be careful! Reason: crossposting
Tb10
HI, django tests usually create a one time use database, is ther a way to combine this with testcafe?
Anton
guys really need help in understanding best way pass complicated data to templates https://stackoverflow.com/questions/78230383/django-correct-way-to-get-and-pass-complicated-data-to-template
Nushh
Hi everyone, I have been using Django framework for my OCR project, but my localhost is stuck at: "Watching for file changes with StatReloader Performing system checks..." without displaying any error. I would be so grateful if anybody helps me out.
Anonymous
Hello how are you guys, I want to asked you about something in Django i used Django only to handle the backend and i used vuejs3 in frontend i used separate servers for each project and the Django project has url cdn.example.com the problem here is if the user add this url in direct web browser he can access the server side how i make sure to prevent this access i want to allow requests that come to server only from the frontend url and server side if the request doesn’t come from the frontend url i want from the server to ignore it
first install django-core-headers and then got list of install apps in the module and add 'coreheaders" then finally goto django setting module again and define this CORS_ALLOWED_ORIGINS = ['http://localhost:5500'] and replace the http://localhost:5500' with frontend url that's means you can only access the ther server via the define url in the CORE_ALLOWED_ORIGINS
Nushh
yes
I mean, the server is stuck.
Nushh
Yws
Anonymous
Yws
can i see the error
Nushh
can i see the error
No errors being displayed in my cmd
Anonymous
No errors being displayed in my cmd
which OCR Library or API you're using
Nushh
I have already installed all the dependencies
Nushh
ultralytics Tensorflow silence_tensorflow numpy scikit-image autocorrect protobuff
Anonymous
you can use the some bunch of print statements in your code co that you easily find the point where the bug is
Anonymous
What bunch of statements?
i mean let say you wrote this code and you want to debug it import pytesseract from django.http import JsonResponse def extract_text_from_image(request): if request.method == 'POST' and request.FILES.get('image'): # for example add print statemet here print("getting the image request") image = request.FILES['image'] # Print("Extract the the text") extracted_text = pytesseract.image_to_string(image.read()) return JsonResponse({'extracted_text': extracted_text}) else: return JsonResponse({'error': 'Please upload an image.'}) This will help you you to find the point the bug is
Rose
User ! has 1/3 warnings; be careful! Reason: request for pirated book (rule #8)
Anonymous
I included some print statements, but it is still the same. I cannot see any error.
can i see the way you wrote the code because without enough information i can figure out the possible error.
Nushh
def ocr_process_view(request): if request.method == 'POST': # Get image data and UUID from the request base64_image_data = request.POST.get('image_data') uuid = request.POST.get('uuid') try: binary_image_data = base64.b64decode(base64_image_data) print("Image data decoded successfully") # Call the recognition_process function raw_recog_para, improve_recog_para, word_confidence_pair = recognition_process(binary_image_data, uuid) print("OCR processing successful") # Process the OCR results further as needed # Return the OCR results as a JSON response return JsonResponse({ # 'raw_recog_para': raw_recog_para, 'improve_recog_para': improve_recog_para, 'word_confidence_pair': word_confidence_pair }) except Exception as e: print("OCR processing failed:", e) # Handle exceptions if recognition_process fails return HttpResponseServerError("OCR processing failed: {}".format(e)) else: print("Non-POST request received") # Return an error response for non-POST requests return HttpResponseNotAllowed(['POST'])
Anonymous
ok no problem
Anonymous
please check
let me just create a django app and check the potential error, give me some moments
Anonymous
yes
Nushh
If you could tell me potential errors ?
Nushh
yes
okay, sir.
Nushh
yes give zip file
where should I send? can you provide me your gmail id?
Rose
User Bright C Web has 1/3 warnings; be careful! Reason: crossposting
Nushh
programmingwithbash@gmail.com
okay, I'll be sharing soon.
Anonymous
okay, I'll be sharing soon.
ok no problem i'm waiting for you
Sharafudheen
Ihave installed django but the default admin panel is in disorder what cn i do?
Charly
Ihave installed django but the default admin panel is in disorder what cn i do?
Check if static files (specifically css is loading correctly)
ßinary403
greetings.. please i have an issue when i try to use tuncateworlds_html ... for example on my html page i have {{ members.bio }} which renders the content from database.. but when i use {{ members.bio | truncatewords_html :50 }} it throws and error.. please i need help
ßinary403
Which error?
"only one argument is provided for truncatewords_html"
Charly
Charly
How to check
Check any errors loading these files on your browser
Nani
in model cretaed an signup from then after register the model,view,py post the data in databse using template file signup.html but signup form not open any any body pls respond
Nani
If request.method=="post"
Nani
Not got inside the if condion
Charly
Not got inside the if condion
And you added method post on the form html code?
Nani
I ready added
Null
If request.method=="post"
If you have any questions, you can send me a message through the anonymous link so that I can solve it, my friend😍🙏
Luiz H.
hello . how to solve this , ->> python manage.py makemigrations myproj-py/env/lib/python3.11/site-packages/django/core/management/commands/makemigrations.py:160: RuntimeWarning: Got an error checking a consistent migration history performed for database connection 'default': (2002, "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)") I'm accessing my mysql from localhost normally using another vscode and another projects . but I cant access from this new project that i donwloaded from creative-tim.com , the 'Soft UI Dashboard Django' template DB_ENGINE = os.getenv('DB_ENGINE' , None) DB_USERNAME = os.getenv('DB_USERNAME' , None) DB_PASS = os.getenv('DB_PASS' , None) DB_HOST = os.getenv('DB_HOST' , None) DB_PORT = os.getenv('DB_PORT' , None) DB_NAME = os.getenv('DB_NAME' , None) this is the settings.py if DB_ENGINE and DB_NAME and DB_USERNAME: DATABASES = { 'default': { 'ENGINE' : 'django.db.backends.' + DB_ENGINE, 'NAME' : DB_NAME, 'USER' : DB_USERNAME, 'PASSWORD': DB_PASS, 'HOST' : DB_HOST, 'PORT' : DB_PORT, }, } else: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'db.sqlite3', } } This is my .env # True for development, False for production DEBUG=True SECRET_KEY=(mysecret) DB_ENGINE=mysql DB_HOST=localhost DB_NAME=myDb DB_USERNAME=root DB_PASS=(mypassword is ok) DB_PORT=3306
Charly
I ready added
Show your code
Luiz H.
and my mysql is up f13f43ede2ab mysql "docker-entrypoint.s…" 8 days ago Up 3 hours (healthy) 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp
Charly
hello . how to solve this , ->> python manage.py makemigrations myproj-py/env/lib/python3.11/site-packages/django/core/management/commands/makemigrations.py:160: RuntimeWarning: Got an error checking a consistent migration history performed for database connection 'default': (2002, "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)") I'm accessing my mysql from localhost normally using another vscode and another projects . but I cant access from this new project that i donwloaded from creative-tim.com , the 'Soft UI Dashboard Django' template DB_ENGINE = os.getenv('DB_ENGINE' , None) DB_USERNAME = os.getenv('DB_USERNAME' , None) DB_PASS = os.getenv('DB_PASS' , None) DB_HOST = os.getenv('DB_HOST' , None) DB_PORT = os.getenv('DB_PORT' , None) DB_NAME = os.getenv('DB_NAME' , None) this is the settings.py if DB_ENGINE and DB_NAME and DB_USERNAME: DATABASES = { 'default': { 'ENGINE' : 'django.db.backends.' + DB_ENGINE, 'NAME' : DB_NAME, 'USER' : DB_USERNAME, 'PASSWORD': DB_PASS, 'HOST' : DB_HOST, 'PORT' : DB_PORT, }, } else: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'db.sqlite3', } } This is my .env # True for development, False for production DEBUG=True SECRET_KEY=(mysecret) DB_ENGINE=mysql DB_HOST=localhost DB_NAME=myDb DB_USERNAME=root DB_PASS=(mypassword is ok) DB_PORT=3306
How are you loading the .env file?
Luiz H.
solved, I changed the 'localhost' to 127.0.0.1 and it worked (weird)
Charly
solved, I changed the 'localhost' to 127.0.0.1 and it worked (weird)
That wasn't the reason of the error, in the error it showed it was trying to use socket which is the default option, meaning your .env file was not load at that moment
Charly
Rasoul
solved, I changed the 'localhost' to 127.0.0.1 and it worked (weird)
maybe the address for localhost isn't declared in the OS's hosts file.
Rasoul
that's very unlikely
Well I've encountered this issue many times before, specially on linux distros, sometimes you just gotta add the address binding manually. But you might also be right as well.
Rasoul
I never saw that con 15 years using linux and he's using docker
It has nothing to do with the docker since it's on the localhost. If it was running over docker compose and a specific docker network then your assumption would be logical.
Rasoul
Sorry you're right. But my point of a SO without localhost defined is very unlikely
I know and I just said it to be counted as a probability, also agreed that you might be right about the env file.
Husen
Hi all, how can i do google login in django admin panel?
Charly
Hi all, how can i do google login in django admin panel?
Try https://pypi.org/project/django-google-sso/
Charly
Or django-authlib