Forums

Django Admin CSS not working?

Hello,

I have seen a few posts that suggest adding /usr/local/lib/python3.8/dist-packages/django/contrib/admin/static/admin/ to the static files part of the web tab but this still doesn't seem to add the previous Django Admin CSS that I had before?

Thank you in advance for your help,

That's only likely to be useful if you're using the same version of django as the one that the system has installed. We have a help page for setting up static files in Django: http://help.pythonanywhere.com/pages/DjangoStaticFiles/

The following works for me, add in your settings.py the following lines 1. STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'static/')

then run python manage.py collectstatic

  1. In your urls.py add: from django.conf import settings from django.contrib.staticfiles.urls import static

urlpatterns = [...]

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

  1. Finally reload your project from web dashboard and the django css should work

Note that this assumes that your files are in the same place as @obedrios, if they are not, then this will not work.