Vinod
https://www.youtube.com/watch?v=9e7CTR2Ya4Y I am trying to create a chat application with help of this tutorial, and I uploaded the files to ubuntu server for testing but when I try to start chat, socket getting closed, this is what shown in console, does anyone knows why it happens joinChatRoom main.js:140 Join as: Vinod main.js:141 Room uuid: r3monrtb2b main.js:158 data {message: 'room created'} main.js:173 onOpen - chat socket was opened main.js:166 onMessage main.js:69 onChatMessage {type: 'writing_active', message: 'writing_active', name: 'Vinod', agent: '', initials: 'V'} main.js:181 onClose - chat socket was closed main.js:229 WebSocket is already in CLOSING or CLOSED state.
Swetha
from . import views Import error :attempted relative import with no known parent package
Rishav
Can someone please explain to me wsgi in layman's terms.
Mobin
Can someone please explain to me wsgi in layman's terms.
it's like a set of instructions for the web application that tells the web server about how to communicate with your django application wich is based on these instructions (WSGI) , so if a web server knows these instructions it can communicate with any web application that are based on these instructions like flask, django etc... and as the name says: WebServerGatewayInterface its just an interface between your web server and web application wich is Django.
Mobin
hi, how can I use the static() function which is used in templates in my views?
Mobin
Mobin
What does it do?
from django.templatetags.static import static absolute_path = static("style.css") # it's the same function that you use in your templates. {% static 'style. css' %}
Amal
Hi anyone hosted their django project with gunicorn and removed server header : gunicorn ? I've been trying for days in vain
sj
Hello someone happens to you that in vscode the shortcuts or snippets do not complete the word with def and only `__str__(self): return self.title` 😅
Leonardo
Especify the GET method
Kajal
getting this error when click on pay after successful payment this error is coming Exception Value: Field 'id' expected a number but got '$ {form.elements["custid"].value}' how to solve this
Kajal
window.location.href http://localhost:8000/paymentdone?order_id=${response.razorpay_order_id}&payment_id=${response.razorpay payment_id}&cust_id=${form.elements["custid"].value}
Venugopal
Example import re cust_id = "$498" final_value = int(re.search(r'\d+', cust_id).group())
Jatin
Any good course for django ?
Doragonsureiyā
Any good course for django ?
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
Kajal
DoesNotExist at /paymentdone/ Customer matching query does not exist. Can anyone help me to solve this error
Kajal
That's an error in your code
Help me to fixed this error
clouded
Help me to fixed this error
https://t.me/django/277806
Василь
Yo guys, what is the reasonable price for connecting nginx with gunicorn to django proj?
Василь
to simple static website
Doragonsureiyā
Yo guys, what is the reasonable price for connecting nginx with gunicorn to django proj?
Adding the word Django to your Off-Topic question doesn't magically turn it to a Django related question, so delete your question here and move to the @PythonOfftopic group and ask there.
Binance
Hello. How do I create a task that will always be running in the background as long as the djano server is running
afbao
Can someone help to deploy my django projects
Kriti
https://dpaste.org/Mcrwv can somebody help me with this error?
꧁GHOST꧂
Example import re cust_id = "$498" final_value = int(re.search(r'\d+', cust_id).group())
import re cust_id = "$498" final_value = int(re.search(r'\d+', cust_id).group())
Charly
Help me to fixed this error
I can't see the code, it's impossible
Dirn
Might be a db migration issue
Dirn
Run your makemigration and migrate commands and check if it works fine
SALAMANDRA
Guys i need in html CSS templates for my Django project. Who can help?
Ibrohim
Guys i need in html CSS templates for my Django project. Who can help?
https://codepen.io/trending?cursor=ZD0wJm89MCZwPTE=
arad
Can anyone help me? I have a problem When I go to a URL, another function is executed instead of the function I defined.
arad
my urls path('',views.welcome_blog,name='welcome_blog'), path('blog/<str:tg>/',views.blog,name='blog'), path('blog/<str:tag>/<str:slug>/',views.blog_detail,name='blog_detail'), path('blog/create/',views.blogcreate,name='blog_create'), and my views : def blog(request,tg): tag = Tag.objects.get(name=tg) context = { 'blogs':BlogModel.objects.filter(tag=tag), 'tag':tag, } return render(request,'blogapp/blog.html',context) def blogcreate(request): if request.method == 'POST': form = BlogForm(request.POST) if form.is_valid(): BlogModel.objects.create(**form.cleaned_data) return HttpResponseRedirect('/blogs/') # return HttpResponse('form is ok') else: form = BlogForm() return render(request,'blogapp/blog_create.html',{'form':form})
J8n
When i go to the blog/create path I'm going to go instead of blogcreate Blog Runs
change the urls file to: path('',views.welcome_blog,name='welcome_blog'), path('blog/create/',views.blogcreate,name='blog_create'), path('blog/<str:tg>/',views.blog,name='blog'), path('blog/<str:tag>/<str:slug>/',views.blog_detail,name='blog_detail'),
J8n
Yes, I did it, but I want to know why it is like this.
any url starting with blog/ followed by a string matches blog/<str:tg>/. So the order matters
arad
any url starting with blog/ followed by a string matches blog/<str:tg>/. So the order matters
Oh, so if I write any URL like this one, this will happen. thank you very much👍
Кот
Hello everyone. I ran into a problem in the online store. I have a product with a price and there are additional services. But the price of services varies depending on the number of goods. This means that the price of the service is up to 50 pieces, 100 units, if from 50 to 100, 90 units. I am trying to add the price for services only when the checkbox is active. I can't figure out how to do this.
@
Admin allow our members to share images
@
What type of error will get sort simply others can refer
Doragonsureiyā
What type of error will get sort simply others can refer
Rule 5️⃣: Never post walls of text or screen photos. Use paste bins like https://dpaste.org, https://hastebin.com, https://bin.kv2.dev or your favorite one!
Ibrohim
{% extends 'users/base.html' %} Login {% block content %} <form method="post"> <h1>SignIn</h1> {% csrf_token %} {{ form.as_p }} <button type="submit">Submit</button> if you don't have account yet: <a href="{% url 'register' %}">SignUp</a> </form> {% endblock %} Forbidden (403) CSRF verification failed. Request aborted. Help Reason given for failure: CSRF token from POST incorrect. In general, this can occur when there is a genuine Cross Site Request Forgery, or when Django’s CSRF mechanism has not been used correctly. For POST forms, you need to ensure: Your browser is accepting cookies. The view function passes a request to the template’s render method. In the template, there is a {% csrf_token %} template tag inside each POST form that targets an internal URL. If you are not using CsrfViewMiddleware, then you must use csrf_protect on any views that use the csrf_token template tag, as well as those that accept the POST data. The form has a valid CSRF token. After logging in in another browser tab or hitting the back button after a login, you may need to reload the page with the form, because the token is rotated after a login. You’re seeing the help section of this page because you have DEBUG = True in your Django settings file. Change that to False, and only the initial error message will be displayed. You can customize this page using the CSRF_FAILURE_VIEW setting. i don’t understand, why it doesn’t work
Ibrohim
class CustomLoginView(View): form_class = LoginForm template_name = 'users/login.html' def get(self, request, *args, **kwargs): form = self.form_class() return render(request, self.template_name, {'form': form}) def post(self, request, *args, **kwargs): form = self.form_class(request.POST) if form.is_valid(): user = form.get_user() login(request, user) remember_me = form.cleaned_data.get('remember_me') if not remember_me: request.session.set_expiry(0) request.session.modified = True return redirect('home') return render(request, self.template_name, {'form': form}) it’s my view
Aju
Hello everyone I hope you're doing well. I'm currently working on a django project integrating customer references into user profiles using Frappe's APIs. While I've made progress with user creation and customer creation through APIs, I'm facing challenges adding reference customer to user. def create_connection(self, customer, email): connection_url = "https://****/api/resource/Connection/" payload = { "customer_name": customer, "email": email } headers = {'Authorization': f"token {token}", 'Content-Type': 'application/json', } response = requests.post(connection_url, headers=headers, json=payload) return response If anyone has experience with Frappe APIs or similar integrations, I would greatly appreciate your advice or insights. Thanks for your time!
do_something()
Hi everyone Im getting same error on all commands. Can u help( Django==4.2.11 >python3 manage.py runserver >django.db.utils.OperationalError: no such table: vacancies_coverlettertemplate >python3 manage.py makemigrations >django.db.utils.OperationalError: no such table: vacancies_coverlettertemplate >python3 manage.py migrate >django.db.utils.OperationalError: no such table: vacancies_coverlettertemplate >python3 manage.py showmigratons >django.db.utils.OperationalError: no such table: vacancies_coverlettertemplate All migrations and sqlite have been deleted idk 😬
Hari
1. How can we build an AI application where the admin can upload huge number of files (text,csv,docx,pdf) and we have to build a chatbot that replies users fir the questions asked by them ( the answer should be from the files uploaded from admin).
Hari
anyone plz help me
Abhi
First remove the model and write again if it does not work to give the null value = 0 to the model
do_something()
Just remove model. Sounds good I will try it ty man
do_something()
Try deleting the pycache files too?
No. Ty man. I will try it today
Mobin
hi, i installed Channels and configured my project with it. now how do i know that the server is running in ASGI or WSGI?
rtg
best python web software for technical assistance?
Doragonsureiyā
best python web software for technical assistance?
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.
Princode
Hey guys Please somebody Can help me. I have this error
Princode
TypeError: Field 'id' expected a number but got <SimpleLazyObject: <django.contrib.auth.models.AnonymousUser object>>
Tobi
TypeError: Field 'id' expected a number but got <SimpleLazyObject: <django.contrib.auth.models.AnonymousUser object>>
It means you tried to get an ID of a logged in user. But when you ran your code, you weren't logged in, so it didn't know where to get the ID from.
Tobi
To fix that, you should probably just first check if the user is logged in before you get whatever you want to get.