Question

I have problm with subpage on my blog taken in django. When I click on the link to it I get an error: Server Error (500), but get this error only when I use the tag {% extends "base.html" %}

I use django 1.6

Hosts a blog on a free hosting heroku.com. Below my settings.py file:

"""
Django settings for blog_project project.

For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
from os.path import join
import dj_database_url

# Honor the 'X-Forwarded-Proto' header for request.is_secure()
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'secret :)'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False

TEMPLATE_DEBUG = False

ALLOWED_HOSTS = ['*',]


# Application definition

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'app',
    #'grappelli',
)

MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

ROOT_URLCONF = 'blog_project.urls'

WSGI_APPLICATION = 'blog_project.wsgi.application'


# Database
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}

# Internationalization
# https://docs.djangoproject.com/en/1.6/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.6/howto/static-files/

STATIC_URL = '/static/'
STATIC_ROOT = 'staticfiles'

STATICFILES_DIRS = (
    os.path.join(BASE_DIR, 'static'),
)

TEMPLATE_DIRS = (
    join(BASE_DIR, 'templates'),
)

base.html:

<!DOCTYPE html>
<html>
<head>
    <title>{% block title %}Strona www{% endblock %}</title>
    <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}app/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}app/css/main.css">
</head>

<body>
    <div class="container">
    {% block landing_page %}
      <div class="header">
        <ul class="nav nav-pills pull-right">
          <li class="active"><a href="#">Home</a></li>
          <li><a href="#">About</a></li>
          <li><a href="#">Contact</a></li>
        </ul>
        <h3 class="text-muted">Project name</h3>
      </div>

      <div class="jumbotron">
        <h1>Jumbotron heading</h1>
        <p class="lead">Cras justo odio, dapibus ac facilisis in, egestas eget quam. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p>
        <p><a class="btn btn-lg btn-success" href="#" role="button">Sign up today</a></p>
      </div>
    {% endblock %}

    {% block content %}{% endblock %}

    {% block titles_blog %}
      <div class="row marketing">
        <div class="container">
          {% if posts %}
                {%for p in posts%}
                    <h1><a href="{% url 'app:detail' p.id %}">{{ p.title }}</a></h1>
                    <b>{{ p.create_at}}</b>
                    <p>{{ p.body }}</p>
                {% endfor %}
          {% else %}
                <p>Nie ma zadnych pol do wyswietlenia</p>
        {% endif %}
        </div>
      </div>
    {% endblock %}

    {% block footer %}
      <div class="footer">
        <p>&copy; Company 2014</p>
      </div>
    {% endblock %}
    </div> <!-- /container -->
  </body>
</html>

detail.html

{% extends "base.html" %}

{% block title %}Strona www{% endblock %}

{% block content %}
        {% if posts %}
            <p>{{ posts.body }}</p>
            <p>{{ posts.create_at }}</p>

        {% else %}
            <p>Nie ma zadnych pol do wyswietlenia</p>
        {% endif %}
{% endblock %}

{% block footer %}
        <p>LOL :)</p>
{% endblock %}

Heroku logs:

2014-03-02T20:58:12.542886+00:00 app[web.1]: 2014-03-02 20:58:12 [2] [INFO] Starting gunicorn 18.0
2014-03-02T20:58:12.544307+00:00 app[web.1]: 2014-03-02 20:58:12 [2] [INFO] Listening at: http://0.0.0.0:20509 (2)
2014-03-02T20:58:12.544626+00:00 app[web.1]: 2014-03-02 20:58:12 [2] [INFO] Using worker: sync
2014-03-02T20:58:12.560465+00:00 app[web.1]: 2014-03-02 20:58:12 [7] [INFO] Booting worker with pid: 7
2014-03-02T20:58:12.666721+00:00 heroku[web.1]: State changed from starting to up
2014-03-02T20:58:58.929336+00:00 heroku[router]: at=info method=GET path=/ host=arcane-coast-4373.herokuapp.com request_id=5d7415b9-b42a-4781-a5dd-c26ecd9183d9 fwd="89.79.178.23" dyno=web.1 connect=1ms service=331ms status=200 bytes=1597
2014-03-02T20:58:59.402281+00:00 heroku[router]: at=info method=GET path=/static/app/css/main.css host=arcane-coast-4373.herokuapp.com request_id=95cccf76-397b-441b-aa03-92d4054cf0fc fwd="89.79.178.23" dyno=web.1 connect=1ms service=3ms status=404 bytes=156
2014-03-02T20:58:59.245817+00:00 heroku[router]: at=info method=GET path=/static/app/css/bootstrap.min.css host=arcane-coast-4373.herokuapp.com request_id=65b6a8f8-8c91-44b1-b47a-42f31c0edccb fwd="89.79.178.23" dyno=web.1 connect=9ms service=20ms status=200 bytes=103129
2014-03-02T21:15:59+00:00 heroku[slug-compiler]: Slug compilation started
2014-03-02T21:16:50.960179+00:00 heroku[api]: Deploy 1c9398d by thewebmedia@gmail.com
2014-03-02T21:16:50.960249+00:00 heroku[api]: Release v47 created by thewebmedia@gmail.com
2014-03-02T21:16:51+00:00 heroku[slug-compiler]: Slug compilation finished
2014-03-02T21:16:55.489493+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2014-03-02T21:16:56.187124+00:00 heroku[web.1]: Starting process with command `gunicorn blog_project.wsgi`
2014-03-02T21:16:56.443342+00:00 app[web.1]: 2014-03-02 21:16:56 [7] [INFO] Worker exiting (pid: 7)
2014-03-02T21:16:56.490516+00:00 app[web.1]: 2014-03-02 21:16:56 [2] [INFO] Handling signal: term
2014-03-02T21:16:56.516431+00:00 app[web.1]: 2014-03-02 21:16:56 [2] [INFO] Shutting down: Master
2014-03-02T21:16:57.617163+00:00 app[web.1]: 2014-03-02 21:16:57 [2] [INFO] Starting gunicorn 18.0
2014-03-02T21:16:57.619377+00:00 app[web.1]: 2014-03-02 21:16:57 [2] [INFO] Using worker: sync
2014-03-02T21:16:57.627869+00:00 app[web.1]: 2014-03-02 21:16:57 [7] [INFO] Booting worker with pid: 7
2014-03-02T21:16:57.618870+00:00 app[web.1]: 2014-03-02 21:16:57 [2] [INFO] Listening at: http://0.0.0.0:16991 (2)
2014-03-02T21:16:57.741689+00:00 heroku[web.1]: State changed from starting to up
2014-03-02T21:16:58.381795+00:00 heroku[web.1]: Process exited with status 0
2014-03-02T21:16:59.542191+00:00 heroku[router]: at=info method=GET path=/static/app/css/bootstrap.min.css host=arcane-coast-4373.herokuapp.com request_id=09f71fd5-aefc-40b9-9c2d-473db951f224 fwd="89.79.178.23" dyno=web.1 connect=1ms service=16ms status=200 bytes=103129
2014-03-02T21:16:51.092695+00:00 heroku[web.1]: State changed from up to starting
2014-03-02T21:16:59.759832+00:00 heroku[router]: at=info method=GET path=/static/app/css/main.css host=arcane-co
ast-4373.herokuapp.com request_id=07c3835a-167f-4a25-bb7a-09b3e17549af fwd="89.79.178.23" dyno=web.1 connect=6ms service=14ms status=404 bytes=156
2014-03-02T21:17:48+00:00 heroku[slug-compiler]: Slug compilation started
2014-03-02T21:18:10.033965+00:00 heroku[web.1]: State changed from up to starting
2014-03-02T21:18:09+00:00 heroku[slug-compiler]: Slug compilation finished
2014-03-02T21:18:09.879716+00:00 heroku[api]: Release v48 created by thewebmedia@gmail.com
2014-03-02T21:18:09.879486+00:00 heroku[api]: Deploy 7685d74 by thewebmedia@gmail.com
2014-03-02T21:16:59.114416+00:00 heroku[router]: at=info method=GET path=/ host=arcane-coast-4373.herokuapp.com request_id=087fd530-2d71-4dda-9bf5-6c388b5c362c fwd="89.79.178.23" dyno=web.1 connect=1ms service=362ms status=200 bytes=1597
2014-03-02T21:18:13.169265+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2014-03-02T21:18:13.829703+00:00 app[web.1]: 2014-03-02 21:18:13 [7] [INFO] Worker exiting (pid: 7)
2014-03-02T21:18:13.830430+00:00 app[web.1]: 2014-03-02 21:18:13 [2] [INFO] Handling signal: term
2014-03-02T21:18:13.840606+00:00 app[web.1]: 2014-03-02 21:18:13 [2] [INFO] Shutting down: Master
2014-03-02T21:18:15.421682+00:00 heroku[web.1]: Process exited with status 0
2014-03-02T21:18:16.960174+00:00 heroku[web.1]: Starting process with command `gunicorn blog_project.wsgi`
2014-03-02T21:18:18.017121+00:00 app[web.1]: 2014-03-02 21:18:18 [7] [INFO] Booting worker with pid: 7
2014-03-02T21:18:17.997462+00:00 app[web.1]: 2014-03-02 21:18:17 [2] [INFO] Starting gunicorn 18.0
2014-03-02T21:18:17.998765+00:00 app[web.1]: 2014-03-02 21:18:17 [2] [INFO] Listening at: http://0.0.0.0:18109 (2)
2014-03-02T21:18:17.999443+00:00 app[web.1]: 2014-03-02 21:18:17 [2] [INFO] Using worker: sync
2014-03-02T21:18:18.294839+00:00 heroku[web.1]: State changed from starting to up
2014-03-02T21:18:20.103673+00:00 heroku[router]: at=info method=GET path=/ host=arcane-coast-4373.herokuapp.com request_id=9528075b-fab0-461b-a451-3db24a4c75f8 fwd="89.79.178.23" dyno=web.1 connect=31ms service=201ms status=200 bytes=1597
2014-03-02T21:18:20.915893+00:00 heroku[router]: at=info method=GET path=/static/app/css/main.css host=arcane-coast-4373.herokuapp.com request_id=36dce1e2-9864-46dd-862c-4056e04e3fa2 fwd="89.79.178.23" dyno=web.1 connect=95ms service=130ms status=404 bytes=156
2014-03-02T21:17:01.994306+00:00 heroku[router]: at=info method=GET path=/7/ host=arcane-coast-4373.herokuapp.com request_id=c26a33b0-1e6e-4581-b23e-a15800a9898b fwd="89.79.178.23" dyno=web.1 connect=6ms service=95ms status=500 bytes=237
2014-03-02T21:18:53+00:00 heroku[slug-compiler]: Slug compilation started
2014-03-02T21:19:23+00:00 heroku[slug-compiler]: Slug compilation finished
2014-03-02T21:19:23.837495+00:00 heroku[web.1]: State changed from up to starting
2014-03-02T21:19:23.651970+00:00 heroku[api]: Deploy c1de5c0 by thewebmedia@gmail.com
2014-03-02T21:19:23.652068+00:00 heroku[api]: Release v49 created by thewebmedia@gmail.com
2014-03-02T21:19:26.044465+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2014-03-02T21:19:26.488060+00:00 app[web.1]: 2014-03-02 21:19:26 [7] [INFO] Worker exiting (pid: 7)
2014-03-02T21:19:26.488783+00:00 app[web.1]: 2014-03-02 21:19:26 [2] [INFO] Handling signal: term
2014-03-02T21:19:26.496701+00:00 app[web.1]: 2014-03-02 21:19:26 [2] [INFO] Shutting down: Master
2014-03-02T21:19:27.730076+00:00 heroku[web.1]: Process exited with status 0
2014-03-02T21:19:30.377504+00:00 heroku[web.1]: Starting process with command `gunicorn blog_project.wsgi`
2014-03-02T21:19:32.217426+00:00 app[web.1]: 2014-03-02 21:19:32 [2] [INFO] Starting gunicorn 18.0
2014-03-02T21:19:32.218279+00:00 app[web.1]: 2014-03-02 21:19:32 [2] [INFO] Listening at: http://0.0.0.0:49575 (2)
2014-03-02T21:19:32.218356+00:00 app[web.1]: 2014-03-02 21:19:32 [2] [INFO] Using worker: sync
2014-03-02T21:19:32.225890+00:00 app[web.1]: 2014-03-02 21:19:32 [7] [INFO] Booting worker with pid: 7
2014-03-02T21:18:20.506842+00:00 heroku[router]: at=info method=GET path=/static/app/css/bootstrap.min.css host=arcane-coast-4373.herokuapp.com request_id=4e4e3b6c-380e-4bfa-a950-49153dc1c5f4 fwd="89.79.178.23" dyno=web.1 connect=8ms service=10ms status=200 bytes=103129
2014-03-02T21:19:32.605217+00:00 heroku[web.1]: State changed from starting to up
2014-03-02T21:18:22.925967+00:00 heroku[router]: at=info method=GET path=/7/ host=arcane-coast-4373.herokuapp.com reque
st_id=d57e48f3-707d-4f48-8a3b-936e00f6ee4f fwd="89.79.178.23" dyno=web.1 connect=1ms service=52ms status=500 bytes=237
2014-03-02T21:29:38.424389+00:00 heroku[router]: at=info method=GET path=/static/app/css/bootstrap.min.css host=arcane-coast-4373.herokuapp.com request_id=7bf8a3a7-0970-412c-9fbb-db23bf7b80e9 fwd="89.79.178.23" dyno=web.1 connect=1ms service=10ms status=200 bytes=103129
2014-03-02T21:29:38.610542+00:00 heroku[router]: at=info method=GET path=/static/app/css/main.css host=arcane-coast-4373.herokuapp.com request_id=f71168b2-3c82-412b-837d-013a2fcbeddc fwd="89.79.178.23" dyno=web.1 connect=1ms service=2ms status=404 bytes=156
2014-03-02T21:29:43.257490+00:00 heroku[router]: at=info method=GET path=/static/admin/css/dashboard.css host=arcane-coast-4373.herokuapp.com request_id=693d54f6-1de5-4bf0-a9ed-00df874bde0b fwd="89.79.178.23" dyno=web.1 connect=61ms service=111ms status=200 bytes=664
2014-03-02T21:29:44.193078+00:00 heroku[router]: at=info method=GET path=/static/admin/img/icon_changelink.gif host=arcane-coast-4373.herokuapp.com request_id=efc0efd8-7cef-4665-93cb-d71c29ec55d9 fwd="89.79.178.23" dyno=web.1 connect=1ms service=3ms status=200 bytes=349
2014-03-02T21:29:44.212913+00:00 heroku[router]: at=info method=GET path=/static/admin/img/icon_deletelink.gif host=arcane-coast-4373.herokuapp.com request_id=9ef9ff3c-91ce-4993-83a5-9a3a7d733335 fwd="89.79.178.23" dyno=web.1 connect=3ms service=6ms status=200 bytes=411
2014-03-02T21:29:44.298832+00:00 heroku[router]: at=info method=GET path=/static/admin/img/nav-bg.gif host=arcane-coast-4373.herokuapp.com request_id=b2bd1380-f13e-45b5-9fee-107868746df4 fwd="89.79.178.23" dyno=web.1 connect=36ms service=52ms status=200 bytes=504
2014-03-02T21:29:46.166588+00:00 heroku[router]: at=info method=GET path=/static/admin/img/nav-bg-reverse.gif host=arcane-coast-4373.herokuapp.com request_id=8a6aaf9d-d523-439d-8dc3-dca67cf227f3 fwd="89.79.178.23" dyno=web.1 connect=1ms service=2ms status=200 bytes=416
2014-03-02T21:29:45.892439+00:00 heroku[router]: at=info method=GET path=/admin/logout/ host=arcane-coast-4373.herokuapp.com request_id=4a2b7c03-3b20-44bd-aa89-3db9f99389c7 fwd="89.79.178.23" dyno=web.1 connect=2ms service=159ms status=200 bytes=1598
2014-03-02T21:29:48.112500+00:00 heroku[router]: at=info method=GET path=/admin/ host=arcane-coast-4373.herokuapp.com request_id=fca4a45b-e44b-4d6c-bc00-72879af604ee fwd="89.79.178.23" dyno=web.1 connect=1ms service=87ms status=200 bytes=2319
2014-03-02T21:29:43.999191+00:00 heroku[router]: at=info method=GET path=/static/admin/img/default-bg.gif host=arcane-coast-4373.herokuapp.com request_id=9e549014-8064-4b2b-be66-1de89b3c66be fwd="89.79.178.23" dyno=web.1 connect=1ms service=6ms status=200 bytes=1075
2014-03-02T21:29:38.128135+00:00 heroku[router]: at=info method=GET path=/ host=arcane-coast-4373.herokuapp.com request_id=468f620d-5b56-42f8-9f62-15e6f7c7e090 fwd="89.79.178.23" dyno=web.1 connect=2ms service=200ms status=200 bytes=1597
2014-03-02T21:29:42.755211+00:00 heroku[router]: at=info method=GET path=/admin/ host=arcane-coast-4373.herokuapp.com request_id=5af66f28-ece1-4f28-9804-693923b69f2a fwd="89.79.178.23" dyno=web.1 connect=1ms service=100ms status=200 bytes=6386
2014-03-02T21:29:43.998838+00:00 heroku[router]: at=info method=GET path=/static/admin/img/icon_addlink.gif host=arcane-coast-4373.herokuapp.com request_id=3f445247-5014-4ad9-b4cd-34fa940298dc fwd="89.79.178.23" dyno=web.1 connect=2ms service=2ms status=200 bytes=349
2014-03-02T21:29:43.079734+00:00 heroku[router]: at=info method=GET path=/static/admin/css/base.css host=arcane-coast-4373.herokuapp.com request_id=a722205d-f84c-487d-a4d7-df5b04030d72 fwd="89.79.178.23" dyno=web.1 connect=1ms service=3ms status=200 bytes=14401
2014-03-02T21:29:48.362633+00:00 heroku[router]: at=info method=GET path=/static/admin/css/login.css host=arcane-coast-4373.herokuapp.com request_id=1a3e800b-3ef3-429f-ac90-67f0e62d7c8b fwd="89.79.178.23" dyno=web.1 connect=13ms service=5ms status=200 bytes=1170
2014-03-02T21:30:26.944635+00:00 heroku[router]: at=info method=GET path=/ host=arcane-coast-4373.herokuapp.com request_id=45a365f0-4998-40c7-b82f-0dca8f8fdec5 fwd="89.79.178.23" dyno=web.1 connect=2ms service=134ms status=200 bytes=1597
2014-03-02T21:30:27.578660+00:00 heroku[router]: at=info method=GET path=/static/app/css/main.css host=arcane-coast-4373.herokuapp.com request_id=ce66c55a-9afd-4071-9265-e87c1cd2124e fwd="89.79.178.23" dyno=web.1 connect=27ms service=150ms status=404 bytes=156
2014-03-02T21:30:29.500853+00:00 heroku[router]: at=info method=GET path=/7/ host=arcane-coast-4373.herokuapp.com request_id=0987a456-71d3-4b45-9676-3ccce6aba07c fwd="89.79.178.23" dyno=web.1 connect=1ms service=174ms status=500 bytes=237
2014-03-02T21:33:29.713942+00:00 heroku[api]: Scale to web=1 by thewebmedia@gmail.com
2014-03-02T21:33:39.004659+00:00 heroku[router]: at=info method=GET path=/ host=arcane-coast-4373.herokuapp.com request_id=90eb0280-2eee-4408-8374-3f91ea6ca108 fwd="89.79.178.23" dyno=web.1 connect=67ms service=162ms status=200 bytes=1597
2014-03-02T21:33:39.377917+00:00 heroku[router]: at=info method=GET path=/static/app/css/bootstrap.min.css host=arcane-coast-4373.herokuapp.com request_id=8959daa2-5eaf-4b98-be2f-655e814a1862 fwd="89.79.178.23" dyno=web.1 connect=18ms service=10ms status=304 bytes=176
2014-03-02T21:33:41.169921+00:00 heroku[router]: at=info method=GET path=/7/ host=arcane-coast-4373.herokuapp.com request_id=b9db599d-aee2-4bfb-ad99-33265950f69a fwd="89.79.178.23" dyno=web.1 connect=4ms service=49ms status=500 bytes=237
2014-03-02T21:33:39.584615+00:00 heroku[router]: at=info method=GET path=/static/app/css/main.css host=arcane-coast-4373.herokuapp.com request_id=209ae2ea-f6fa-43ac-9aa5-3ae11581ce58 fwd="89.79.178.23" dyno=web.1 connect=2ms service=5ms status=404 bytes=156
2014-03-02T21:36:05+00:00 heroku[slug-compiler]: Slug compilation started
2014-03-02T21:36:25.403623+00:00 heroku[web.1]: State changed from up to starting
2014-03-02T21:36:25+00:00 heroku[slug-compiler]: Slug compilation finished
2014-03-02T21:36:28.208550+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2014-03-02T21:36:28.883501+00:00 app[web.1]: 2014-03-02 21:36:28 [7] [INFO] Worker exiting (pid: 7)
2014-03-02T21:36:28.884379+00:00 app[web.1]: 2014-03-02 21:36:28 [2] [INFO] Handling signal: term
2014-03-02T21:36:28.894856+00:00 app[web.1]: 2014-03-02 21:36:28 [2] [INFO] Shutting down: Master
2014-03-02T21:36:30.150421+00:00 heroku[web.1]: Process exited with status 0
2014-03-02T21:36:30.734716+00:00 heroku[web.1]: Starting process with command `gunicorn blog_project.wsgi`
2014-03-02T21:36:31.847204+00:00 app[web.1]: 2014-03-02 21:36:31 [2] [INFO] Starting gunicorn 18.0
2014-03-02T21:36:31.847875+00:00 app[web.1]: 2014-03-02 21:36:31 [2] [INFO] Using worker: sync
2014-03-02T21:36:31.847763+00:00 app[web.1]: 2014-03-02 21:36:31 [2] [INFO] Listening at: http://0.0.0.0:14377 (2)
2014-03-02T21:36:31.855416+00:00 app[web.1]: 2014-03-02 21:36:31 [7] [INFO] Booting worker with pid: 7
2014-03-02T21:36:32.379075+00:00 heroku[web.1]: State changed from starting to up

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top