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
Mobin
hi, how can I use the static() function which is used in templates in my views?
Mobin
Luis
Binance
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' %}
Suryo Adhy Chandra
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
Venugopal
Kajal
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())
Venugopal
Kajal
Venugopal
Kajal
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
Charly
Kajal
Василь
Yo guys, what is the reasonable price for connecting nginx with gunicorn to django proj?
Василь
to simple static website
Binance
Hello. How do I create a task that will always be running in the background as long as the djano server is running
Mobin
afbao
Can someone help to deploy my django projects
Kriti
https://dpaste.org/Mcrwv
can somebody help me with this error?
꧁GHOST꧂
Sajjad
Dirn
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
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})
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})
When i go to the blog/create path
I'm going to go instead of blogcreate
Blog Runs
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'),
arad
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'),
Yes, I did it, but I want to know why it is like this.
Kajal
arad
Кот
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
Doragonsureiyā
@
What type of error will get sort simply others can refer
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!
Charly
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
Abhi
do_something()
Abhi
First remove the model and write again if it does not work to give the null value = 0 to the model
Abhi
do_something()
Just remove model. Sounds good I will try it ty man
Kumar Shreyansh
do_something()
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?
Abraham
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
To fix that, you should probably just first check if the user is logged in before you get whatever you want to get.