Django template not displaying

mrpopo

I have a template for an about page which refuses to show. I'm probably doing something silly but I can't work out why and it's driving me insane!

part of views.py:

# About view
def about(request):
    return render(request, 'blog/about.html')

urls.py:

from django.conf.urls import patterns, include, url
from django.contrib import admin
from blog.views import post as blog_post
from blog.views import profile as blog_profile
admin.autodiscover()
urlpatterns = patterns('',

url(r'^admin/', include(admin.site.urls)),
url(r'^$', 'blog.views.index'),
url(r'^about/$', 'blog.views.about'),
url(r'^profiles/$', 'blog.views.profile_index'),
url(r'^profiles/(?P<profile_url>[\w\-]+)/$', blog_profile, name = 'blog_profile'),
url(r'^(?P<category>[\w\-]+)/$', 'blog.views.categoryIndex'),
url(r'^(?P<category>[\w\-]+)/(?P<slug>[\w\-]+)/$', blog_post, name = 'blog_post')
)

the about template (not including the base.html):

{% extends 'base.html' %}
{% block title %} About {% endblock %}
{% block content %}
<h1>About</h1>
{% endblock %}

Using Django 1.6.5

Tried to navigate to mysite.com/about/

Template hierachy:

templates
    base.html
    blog
        about.html
        ....
mrpopo

I've figured out the problem, the following url was being matched with the about page instead:

url(r'^(?P<category>[\w\-]+)/$', 'blog.views.categoryIndex'),

Removing this solves the issue and displays the about page. This page explains about url ordering http://www.webforefront.com/django/regexpdjangourls.html

Because my about url was listed before the conflicting one, it was skipped.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

template not displaying information - django

Django template displaying nothing

Django - Queryset results not displaying in template

Displaying uploaded images in the template - Django

Django extended template not displaying content

Displaying Django model field in template

Django 1.6: Form not displaying in template

Django template not displaying React component

Django Template is not displaying the table data

Django template displaying images in wrong position

Displaying single image field in django template not working?

Images from media folder is not displaying django template

ImageField class in django 1.8 not displaying image in the template

Parsing and displaying nested JSON in Django Template

Django: data from context not displaying in template

Need help in displaying items from ManyToMany relation in Django template

Displaying my current domain in my django template not working

Django trans template tag only displaying placeholder constant string

Django custom 500 error template not displaying request.user

ImageField upload_to in django 1.6 not displaying images to template

Django 1.6: Displaying a particular models Objects in another template

Displaying content from 2 models on a single Django template

Why is Django not taking the integer in the DB and displaying it in the HTML template?

Django Template: Exclude request.user from displaying user list

Django - Template is not displaying the entire context list that I am passing

Django foreign-key many to one relationship displaying on template

Displaying images "not featured" with featured images in Django template language

Popover not displaying in angular template

AngularJS directive not displaying the template