Django debug false not working | Static files not loading when debug is false | DEBUG=False | 404

Поделиться
HTML-код
  • Опубликовано: 2 дек 2024

Комментарии • 83

  • @just_me_rinz
    @just_me_rinz 3 года назад +3

    I tried 100 videos before but i can't fix this problem ,Now I can because of you thanks

    • @coderwebsite
      @coderwebsite  3 года назад

      Thank you for your important words

  • @mariamkhanam4037
    @mariamkhanam4037 2 года назад +1

    Video starts at 2:15

  • @vineetsingh1940
    @vineetsingh1940 2 года назад +1

    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.

  • @beastnighttv
    @beastnighttv 3 года назад +4

    Thankyou sir/ma'am it helped me a lot now i can finally complete my portfolio

    • @coderwebsite
      @coderwebsite  3 года назад +1

      Thank you for your important words. I am very glad that it helped you.

    • @beastnighttv
      @beastnighttv 3 года назад +1

      @@coderwebsite :)

  • @SocioBay
    @SocioBay Год назад

    GREAT TUTORIAL. Deserves 1 million Subssribers.

  • @ummehanyarozshandaanny2846
    @ummehanyarozshandaanny2846 2 года назад

    The best solution ever.
    wish I could give 1000 thumbs up

  • @DezyNationIndia
    @DezyNationIndia 3 года назад +1

    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❤❤❤❤

  • @prusa16
    @prusa16 Год назад

    Great video, thanks and if you have still errors you can use this.
    from django.urls import re_path as url

    • @EADEV
      @EADEV Год назад

      thanks🤩

  • @СаидЛутфуллин
    @СаидЛутфуллин 2 года назад

    It really works. I solved my problem. thankyou, bro!

  • @ilyaselmalikilive-j2f
    @ilyaselmalikilive-j2f Год назад

    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
    😄

  • @varadprabhu1543
    @varadprabhu1543 2 года назад

    Thankyou Sir..Helped me 🙇‍♂🙇‍♂

  • @Inter_Gus
    @Inter_Gus 2 года назад +1

    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

  • @webcog_pk
    @webcog_pk Год назад +1

    sir its working for me on website but it is not working on admin dashboard

    • @coderwebsite
      @coderwebsite  Год назад +1

      python manage.py collectstatic; if debug=False

    • @webcog_pk
      @webcog_pk Год назад +1

      @@coderwebsite bro thanku You are legend
      😋

  • @rajeshdlkumar5249
    @rajeshdlkumar5249 6 месяцев назад

    Great tutorial worked smoothly..

  • @momenaboessa
    @momenaboessa 3 года назад +2

    Thanks alot you are AWESOME !!!

  • @inviicttus
    @inviicttus Год назад

    It worked perfectly. Thank you

  • @ShivamKumar-nc2ez
    @ShivamKumar-nc2ez 3 года назад +1

    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!!

    • @softtechstar1955
      @softtechstar1955 3 года назад +1

      I have also tried by doing changes in both files but website is not loading properly.

    • @coderwebsite
      @coderwebsite  3 года назад

      can you share a screenshot of your code?

    • @coderwebsite
      @coderwebsite  3 года назад +1

      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.

    • @coderwebsite
      @coderwebsite  3 года назад

      can you share a screenshot of your code?

    • @ShivamKumar-nc2ez
      @ShivamKumar-nc2ez 3 года назад

      @@coderwebsite Yeah!! It got resolved by putting static folder inside main folder, instead of app folder.
      Thank you so much.

  • @Mindfuneral1349
    @Mindfuneral1349 3 года назад

    I was struggling with this problem for a while and this fixed it. Thank you!

  • @amirdharajanm793
    @amirdharajanm793 3 года назад +3

    Thank you. You such a genius

  • @wolfag2286
    @wolfag2286 3 года назад +1

    Really helpful. It is the best tutorial for this manner and too easy

  • @ezekielobiajulu5623
    @ezekielobiajulu5623 Год назад

    You just saved my life now thanks 🙏

  • @JacksonOsvaldo
    @JacksonOsvaldo 2 года назад

    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}),

  • @arielsantangelo1658
    @arielsantangelo1658 Год назад

    didn't work for swagger and django admin

  • @nikolacesarovic
    @nikolacesarovic Год назад

    I tried this and it doesn't work

  • @firminnganduli2323
    @firminnganduli2323 3 года назад +1

    it doesn't work on a live server like heroku. Any suggestions?

    • @coderwebsite
      @coderwebsite  3 года назад +1

      I personally tested this code on the Heroku server, it works perfectly you need to review your code.

  • @surajyadao6601
    @surajyadao6601 3 года назад +1

    what about admin dashboard bro? there is no css loading.

    • @coderwebsite
      @coderwebsite  3 года назад

      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')

  • @rahulakotkar3882
    @rahulakotkar3882 3 года назад

    will this solution work for windows hosted django application?

  • @MohdMunazilMohdAzlan
    @MohdMunazilMohdAzlan Месяц назад

    OMG!!! it workssss

  • @Pixeloided
    @Pixeloided 3 года назад +3

    Thank you! Incredible!

  • @pauwelsgnanih7136
    @pauwelsgnanih7136 2 года назад

    TU ES UN GENIE !!!!!!!!!!!!!!

  • @sunilshrestha9576
    @sunilshrestha9576 3 года назад +1

    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

    • @coderwebsite
      @coderwebsite  3 года назад

      can you share your code with me I will see what is the problem?

    • @sunilshrestha9576
      @sunilshrestha9576 3 года назад

      @@coderwebsite github.com/Sam231221/codek
      the problem lies in settings.py can u fix it for development mode it gives me the creep

    • @coderwebsite
      @coderwebsite  3 года назад +1

      @@sunilshrestha9576 error screenshot ?

  • @markbassem931
    @markbassem931 2 года назад

    Can you upload the whole project?

  • @devadmin781
    @devadmin781 2 года назад

    this solution is not working in my project, please help ................................>!!!!!!!!!!!

  • @pandemicovid9079
    @pandemicovid9079 2 года назад

    this is not logic, same as DEBUG=True.

  • @musicaccount8361
    @musicaccount8361 2 года назад

    Thanks dude its works

  • @Khal1l_0
    @Khal1l_0 Год назад

    Thaaaaaank you broooo❤

  • @Anihilatior
    @Anihilatior Год назад

    Need to change Nging to add location:
    location /media/ {
    alias /home/xuser/xproject/media/;
    expires 1d;
    }

  • @sacreations3044
    @sacreations3044 3 года назад +2

    Thank you so much

  • @amazinghenry8893
    @amazinghenry8893 2 года назад

    Didnt work

  • @shababshahjahan7079
    @shababshahjahan7079 2 года назад

    Thanks a lot , very helpful and saved lots of time

  • @suhaibmutawakel4661
    @suhaibmutawakel4661 3 года назад

    Awesome thank you for your help. It worked for me :)

  • @aaronmayendesa2520
    @aaronmayendesa2520 3 года назад +2

    thanks

    • @coderwebsite
      @coderwebsite  3 года назад

      You are welcome and plz subscribe my channel.

  • @seregainbel
    @seregainbel 2 года назад

    Greate, fixed the problem. But is this secure?

  • @ajayparambath2416
    @ajayparambath2416 3 года назад

    Thank you! it worked

  • @mmdchnar
    @mmdchnar 2 года назад

    thanks a lot

  • @vedantkadam4221
    @vedantkadam4221 2 года назад

    helped me a lot thanks man

  • @jpou23
    @jpou23 2 года назад

    thanks you are awesome!

  • @mmdchnar
    @mmdchnar 2 года назад

    perfect

  • @郭秉勳-y5y
    @郭秉勳-y5y 2 года назад

    wonderful!!!!

  • @mmdchnar
    @mmdchnar 2 года назад

    nice

  • @wispawelwis38
    @wispawelwis38 3 года назад

    Awesome! BTW is this secure?

  • @moulialluri5353
    @moulialluri5353 Год назад

    I got the server error500

  • @kaitonexy
    @kaitonexy 5 месяцев назад

    tyvm

  • @ramsagaryadav3799
    @ramsagaryadav3799 3 года назад +3

    🙏🙏🙏🙏🙏

  • @jizong234
    @jizong234 3 года назад +1

    Thank you very much

  • @AnilSardiwal
    @AnilSardiwal 2 года назад

    Thank you

  • @hakbe9833
    @hakbe9833 3 года назад

    Thanks

  • @Mohammad_ArshadAli
    @Mohammad_ArshadAli 2 года назад

    Thank you very much

  • @KOCKIE1
    @KOCKIE1 Год назад

    Thank you

  • @sagar-l1r
    @sagar-l1r Месяц назад

    Thanks