No CSS in Admin panel in Azure App Service hosted Django APP


I cant figure out how to make Azure App Service use css for admin panel.
In I included these:

from pathlib import Path
import os

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')

#    'django.contrib.staticfiles.finders.DefaultStorageFinder',

But somehow css is still not working for the admin panel.
How can I fix this? As far as I know Oryx which works under Azure App Service should automatically run

python collectstatic

Any ideas?

Installed apps



There are something to check might help:

  1. Click F12 on your Admin page to check if it is the 404 Not Found error.

  2. Check the static files exist in your azure web app or not. You could see it in https://{your-web-app} site.

  3. Check if your file structure match with the Any spell error would make the static file not found.

  4. If your file exists well, you should check if you use them correctly in your code like this answer. Here is how he use:

     from django.conf.urls.static import static
     urlpatterns = [
             path('myapp/', include('myapp.urls')),
         ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

Answered By – Doris Lv

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published