2

My 404.html page does not reference my finale.css file. My directory structure

musicworld/
   musicworld/
           __pycache__
           __int__.py
           settings.py
           urls.py
           wsgi.py
   feature/
           __pycache__
           migrations
           static/
                 feature/
                        finale.css
           templates/
                 feature/
                        about.html
                        detail.html
                 404.html
                 500.html
                 index.html
                 template.html
            __init__.py
            admin.py
            models.py
            tests

This is where in index.html I'm referencing the css

    <link rel="stylesheet" type="text/css" href="{% static 'feature/finale.css' %}" />

But 404.html that extends index.htmlis not referencing the css

{% extends "index.html" %}
{% load staticfiles %}
{% block 404page %}
<div class="box">
<p class="box-message" data-dead-message="AAAAAHHHHHH!">Oh No! Something went wrong.Punish the developer by clicking here.</p>
</div>

  <div class="robot">
    <img src="" alt="Robot" />
  </div>
{% endblock %}

static reference in settings.py

STATIC_URL = '/static/'

SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
ALLOWED_HOSTS = ['*']
STATIC_ROOT = 'staticfiles'
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)

MEDIA_URL = '/media/'

MEDIA_ROOT = os.path.join(BASE_DIR, "media")

Both the index.htmland template.html are placed in the same folder and are properly referencing the css.Plus all the html pages in feature that are extending index.html are also referencing the css.But both 404.html and 500.htmlare not.

WutWut
  • 1,204
  • 2
  • 17
  • 31
  • 1
    What is your `STATIC_URL` setting in `settings.py`? Have you run the [collectstatic](https://docs.djangoproject.com/en/1.8/howto/static-files/deployment/) command? – tatlar Jun 10 '15 at 23:36
  • @tatlar `STATIC_URL = '/static/'`. Never seen that command.New to django. But if it was necessary the other templates wouldn't be referencing the css file.Would they? – WutWut Jun 10 '15 at 23:47
  • Show all lines containing `static` in settings.py. It might be something there. –  Jun 11 '15 at 03:25
  • @AbhiP I've edited that part into the code. – WutWut Jun 11 '15 at 10:57
  • See this question: http://stackoverflow.com/questions/15121731/using-static-files-in-custom-404-500-pages-in-django – patrys Jun 11 '15 at 11:14

0 Answers0