'Boostrap.min.css not loading in django app after deploying to Azure Cloud

My website is running perfectly on localhost but when I upload my code to Azure cloud it doesn't load boostrap.min.css due to its theme is not loading

On localhost: Local host image

On Azure site Azure Screenshot

Why it is not fetching the bootstrap themes on site?



Solution 1:[1]

Here are the few workarounds that you can try :

Solution 1 : In urls.py , Add this code

from django.conf.urls.static import static

if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + \
              static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

and make sure that in your settings.py

DEBUG = True

Solution 2 : There may be some causes like changing the settings.DEBUG to false or the installed packages overridden the runserver. Here is the few steps you can try for the above causes :

  1. Define the STATIC_ROOT variable in settings and point it to a directory on your file system and
  2. If that directory do not exist, create it.
  3. Run this command python manage.py collectstatic
  4. Apply solution 1 as well.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 SuryasriKamini-MT