I tried this and it works like charm but I'm facing only one issue after following this article my website static files are working as expected but django admin panel static files not working and admin panel appears only in simple htmls not static file rendering, can you please help me with this.
I don't know how to thank you. I was struggling to find effective solution of this problem. I was getting this error on Microsoft Azure but man... Your video worked as if it's a miracle!!! Not even Stack Overflow was able to solve my issues but you did❤❤❤❤
Thx for the video! It solve my problem when I follow, but I needed to change the "from django.conf.urls import url" to "from django.urls import re_path"; and "url(r'^media..." to "re_path(r'^media..." because of the new django version
I have found a solution to your problem, why your static files are not loading. There are 2 solutions to this problem: 1. First, your static files are not loading because you add your "static folder" inside the app directory. Please add a "static folder" outside the app's directory. I mean inside the "DjangoDebugFalse-main folder". 2. Another solution is to add your Django app to "settings.py" inside INSTALLED_APPS. Like this ; INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'Django', 'app1', ] I hope your problem is solved Please don't forget to subscribe my channel.
Django does not serve static files on it's own. You have to tell it where the files are. STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'static')
I tried 100 videos before but i can't fix this problem ,Now I can because of you thanks
Thank you for your important words
Video starts at 2:15
I tried this and it works like charm but I'm facing only one issue after following this article my website static files are working as expected but django admin panel static files not working and admin panel appears only in simple htmls not static file rendering, can you please help me with this.
Thankyou sir/ma'am it helped me a lot now i can finally complete my portfolio
Thank you for your important words. I am very glad that it helped you.
@@coderwebsite :)
GREAT TUTORIAL. Deserves 1 million Subssribers.
The best solution ever.
wish I could give 1000 thumbs up
I don't know how to thank you. I was struggling to find effective solution of this problem. I was getting this error on Microsoft Azure but man... Your video worked as if it's a miracle!!!
Not even Stack Overflow was able to solve my issues but you did❤❤❤❤
Great video, thanks and if you have still errors you can use this.
from django.urls import re_path as url
thanks🤩
It really works. I solved my problem. thankyou, bro!
thank you i had this error for looong time now i fix it notice the you can use re_path if you have any error whit url
😄
Thankyou Sir..Helped me 🙇♂🙇♂
Thx for the video!
It solve my problem when I follow,
but I needed to change the "from django.conf.urls import url" to "from django.urls import re_path";
and "url(r'^media..." to "re_path(r'^media..."
because of the new django version
sir its working for me on website but it is not working on admin dashboard
python manage.py collectstatic; if debug=False
@@coderwebsite bro thanku You are legend
😋
Great tutorial worked smoothly..
Thanks alot you are AWESOME !!!
You're welcome :)
It worked perfectly. Thank you
I updated the urls.py and settings.py file but still static files are not loading.
I am running my project on localhost only.
Please help!!
I have also tried by doing changes in both files but website is not loading properly.
can you share a screenshot of your code?
I have found a solution to your problem, why your static files are not loading.
There are 2 solutions to this problem:
1. First, your static files are not loading because you add your "static folder" inside the app directory. Please add a "static folder" outside the app's directory. I mean inside the "DjangoDebugFalse-main folder".
2. Another solution is to add your Django app to "settings.py" inside INSTALLED_APPS. Like this ;
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'Django',
'app1',
]
I hope your problem is solved
Please don't forget to subscribe my channel.
can you share a screenshot of your code?
@@coderwebsite Yeah!! It got resolved by putting static folder inside main folder, instead of app folder.
Thank you so much.
I was struggling with this problem for a while and this fixed it. Thank you!
Thank you. You such a genius
You're welcome :)
Really helpful. It is the best tutorial for this manner and too easy
You just saved my life now thanks 🙏
Rather than:
url(r'^media/(?P.*)$', serve,{'document_root': settings.MEDIA_ROOT}),
url(r'^static/(?P.*)$', serve,{'document_root': settings.STATIC_ROOT}),
To use:
re_path(r'^static/(?P.*)$',serve,{'document_root':settings.STATIC_ROOT}),
re_path(r'^media/(?P.*)$',serve,{'document_root':settings.MEDIA_ROOT}),
didn't work for swagger and django admin
I tried this and it doesn't work
it doesn't work on a live server like heroku. Any suggestions?
I personally tested this code on the Heroku server, it works perfectly you need to review your code.
what about admin dashboard bro? there is no css loading.
Django does not serve static files on it's own. You have to tell it where the files are.
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
will this solution work for windows hosted django application?
OMG!!! it workssss
Thank you! Incredible!
TU ES UN GENIE !!!!!!!!!!!!!!
Bro mera to server error arra he ek page par pata nahi kyu but jaab debug=True karta hu wapas server error 500 chalajata hein
can you share your code with me I will see what is the problem?
@@coderwebsite github.com/Sam231221/codek
the problem lies in settings.py can u fix it for development mode it gives me the creep
@@sunilshrestha9576 error screenshot ?
Can you upload the whole project?
this solution is not working in my project, please help ................................>!!!!!!!!!!!
this is not logic, same as DEBUG=True.
Thanks dude its works
Thaaaaaank you broooo❤
Need to change Nging to add location:
location /media/ {
alias /home/xuser/xproject/media/;
expires 1d;
}
Thank you so much
You're most welcome
Didnt work
Thanks a lot , very helpful and saved lots of time
Awesome thank you for your help. It worked for me :)
thanks
You are welcome and plz subscribe my channel.
Greate, fixed the problem. But is this secure?
Thank you! it worked
thanks a lot
helped me a lot thanks man
thanks you are awesome!
perfect
wonderful!!!!
nice
Awesome! BTW is this secure?
I got the server error500
How to overcome it
tyvm
🙏🙏🙏🙏🙏
Thank you very much
Thank you
Thanks
Thank you very much
Thank you
Thanks