0

So my app has the following structure: base.html, which contains the nav and the links to the stylesheets and the home.html file, which loads the nav via extends. However, i can't really modify the css inside my home.html file, any suggestions whats wrong?

base.html:

{% load staticfiles %}
<!DOCTYPE html>

<html>
<head>
  <meta charset="utf-8">

  <title>App</title>
  <link rel="shortcut icon" href="{% static 'img/favicon.png' %}">
  <link rel="stylesheet" href="{% static 'css/app.css' %}">


...## navbar etc.



 <div id="body">
        <div class="container">
          {% block page %}
          {% endblock %}

        </div>
      </div>

home.html:

{% extends 'base.html' %}


{% load staticfiles %}

{% block page %}



  <div class="row">
    <div class="col-md-12">
      <img src="{% static 'img/banner.gif'%}" class="banner">
    </div>

{% endblock %}

As you can see in the base.html file, i load the app.css file via static method.

However, changing for example the banner class in the home.html isn't working at all:

#body .banner {
  width: 100%;
  margin-bottom: 150px;
}

No errors in the terminal / console. The app.css file works for the base.html by the way.

5
  • May be you for python manage.py collectstatic OR you may be not working on web server and in settings.py debug = False Commented Jan 23, 2018 at 7:17
  • have you tried {% load static %} instead of staticfiles? and if not can you post the settings of static and your main urls file Commented Jan 23, 2018 at 7:21
  • Try reloading your cache. Sometimes it's that simple Commented Jan 23, 2018 at 7:22
  • try it by opening the browser in incognito mode Commented Jan 23, 2018 at 8:37
  • Thanks all. I think it had something with the cache to do. I started the server on a different port and used incognito mode and its works now fine, even without incognito. Appreciate it! If you want, post your answer and i vote i up! Cheers! Commented Jan 23, 2018 at 12:21

1 Answer 1

2

Try ctrl + F5, in django you have to reload your cache after making changes to static files.

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

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.