Husen
CommandError: You must set settings.ALLOWED_HOSTS if DEBUG is False. Hello everybody. when i run python manage.py runserver it gives me this error. what can i do?
Husen
You must set settings.ALLOWED_HOSTS if DEBUG is False
DEBUG = True ALLOWED_HOSTS = ["*"]
Dnyaneshwar
how to configure static files for debug=False
Dnyaneshwar
because when i do debug=False css has not applied on my project
Habib
Hi there, I have a question If I have a Django app and I hosted it somewhere say render or anything Now if I want more than 1 people to access and use it without any problem what do I need to do I need to change something in my django code or the server
Habib
So you mean just hosting it would do
Habib
Yeah actually it was API that I connected to separate basic frontend... It does open up the frontend but when two or more requests at the same time it fails
Habib
Maybe because of the free tier? It can't handle enough processing?
Habib
How does it fail?
Just stops there Bte the API it takes a title and creates a simple video
Habib
Actually let me share a more specific erorr
Mohit
Hi there, i want to try to connect RDS with AWS and also want to create table from lambda please suggest how can I do this
Habib
Why do you say it stops? Be more specific
t: 96%|█████████▋| 185/192 [00:16<00:00, 17.31it/s, now=None][2024-07-24 18:13:52 +0000] [1] [ERROR] Worker (pid:8) was sent SIGKILL! Perhaps out of memory? This is what I get sometimes
Charly
Hi there, i want to try to connect RDS with AWS and also want to create table from lambda please suggest how can I do this
Get connection parameters from database and setup it on Django in the same way as any database. To create tables in Django you should use migrations
Habib
Yeah the request takes just title like say top 3 mountains and returns a drive link to generated video... The Image downloading Combining them into video Uploading to drive All takes place in this
Habib
That's why I was saying maybe the memory and all..bcz this was on render's free tier
Charly
That's why I was saying maybe the memory and all..bcz this was on render's free tier
Or CPU or course you should not do that heavy stuff on the views
Habib
Yeah can you pls guide on what would be correct approach
Habib
The view itself is only calling functions but again the code is in another functionality.py file
Charly
Can anyone help me in this
I already answered that
Charly
Yeah can you pls guide on what would be correct approach
Probably using celery or something like that to run these heavy tasks in background
Mousam
Hello everyone, I am new to django Currently learning about django authentication Issue : when I hit "/login" url login form gets open but when I hit "/logout" it says this page is not working right now 😅
Mousam
I setting.py I have set the LOGOUT_REDIRECT_URL='/login'
The Inspired
have you set up path for /logout?
Mousam
have you set up path for /logout?
No I haven't, I haven't setup for login either
Mousam
urlpatterns = [ path('admin/', admin.site.urls), path('', include('loginapp.urls')), path('', include('django.contrib.auth.urls')), ]
Mousam
it's the app level url
Mousam
urlpatterns = [ path('',views.home,name='home'), path('home',views.home,name='home'), ]
Mousam
I didn't get what you are saying 😅
Mousam
Can you explain a bit
Charly
I didn't get what you are saying 😅
You are using the Django default auth
Charly
Show what you see in the console
Mousam
Method Not Allowed (GET): /logout/ Method Not Allowed: /logout/
Charly
Method Not Allowed (GET): /logout/ Method Not Allowed: /logout/
Method not allowed,.it means you are using get method when you should use post (probably)
Mousam
Yes, when I created a logout button using post method it works But when I hit the url 'logout' without using button it shows method not allowed (get)
Mousam
Not actually I was following a toturial video of 'tech with tim' to learn about authentication
Mousam
Maybe that method works on previous version of django
Mousam
Yes, when I created a logout button using post method it works But when I hit the url 'logout' without using button it shows method not allowed (get)
The conclusion which I came up on is .... By default django uses get method But for authentication related task it should be post , maybe that's why it is showing method not allowed (get)
A.JAHANGIR
Hello everyone, I use bootstrap in the main template and now I want to link a css file to the sub templates but I can't change the style with css file... I put that link anywhere in my code but it still doesn't work
Mousam
I have one more question,for authentication in production level projects we can use django default authentication or we have to create it by ourselves?
Mousam
🆗
colo
hello, sory my english is ver poor. I have a project DJ4.2, and delete one table. Then recreate it but not create the table. How can rebuild all ?
Charly
hello, sory my english is ver poor. I have a project DJ4.2, and delete one table. Then recreate it but not create the table. How can rebuild all ?
You shouldn't do that. You probably fucked your migrations. If you don't care about the data just delete the whole database and run migrations again
A.JAHANGIR
static files url
yes, css file is in my static files folder the problem because of bootstrap link
A.JAHANGIR
what bootstrap link?
I used bootstrap code and add a link it as stylesheet like always
A.JAHANGIR
how is "like always"?
I mean when we use bootstrap...
Charly
I mean when we use bootstrap...
yes but how? there are many ways
Charly
here the problem explanation
yes we are asking how exaxctly you are trying to do that
Charly
a link tag
If you are not specific no one will help you
A.JAHANGIR
what do you mean about the way?
Charly
what do you mean about the way?
what exactly you done?
A.JAHANGIR
I create a main template using bootstrap and for that I added a link tag for bootstrap documentation, now in the sub template I can't use css code because of that link
Charly
why you say because a link you can't use css? that makes no sense
A.JAHANGIR
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
A.JAHANGIR
why you say because a link you can't use css? that makes no sense
Because I saw a similar problem in Stackoverflow