1

I'm trying to load my own css file to replace base.css in order to customize Django Admin

{% extends "admin/base.html" %}
{% load static %}
{% block title %}VSPM{% endblock %}

{% block branding %}
<h1 id="site-name"><a href="{% url 'admin:index' %}">{{ site_header|default:_('Django administration') }}</a></h1>
{% endblock %}

{% block stylesheet %}{% static "admin/css/theme.min.css" %}{% endblock %}

{% block nav-global %}{% endblock %}

But the css file isn't loading in Django admin. What am I doing wrong?

2 Answers 2

2
{% block extrastyle %}{% static "admin/css/theme.min.css" %}{% endblock %}

Change your block name and try

Sign up to request clarification or add additional context in comments.

Comments

0
  1. Go to your project.
  2. Copy this folder /virualent_path//lib/python3.6/site-packages/django/contrib/admin/static/admin to 'static' folder of your project.
  3. Add this string to the settings.py: STATIC_ROOT = os.path.join(PROJECT_DIR, 'static')
  4. Then run this command: python3.6 manage.py collectstatic

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.