urls.py
from django.conf.urls.defaults import patterns, include, url
from blog import settings
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', 'blog.homepage.views.index', name = 'homepage_index'),
url(r'^about/$', 'blog.homepage.views.about', name = 'homepage_about'),
url(r'^contact/$', 'blog.homepage.views.contact', name = 'homepage_contact'),
url(r'^archive/$', 'blog.homepage.views.archive', name = 'homepage_archive'),
url(r'^admin/', include(admin.site.urls)),
url(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
)
--------------------------------------------------------------------------------------------
index.html
{% extends "homepage/base.html" %}
{% block title %}My Blog Index{% endblock %}
{% block navi %}
<a href="{% url homepage_index %}">home</a> - <a href="{% url homepage_about %}">about</a> - <a href="{% url homepage_archive %}">archive</a> - <a href="{% url homepage_contact %}">contact</a>
{% endblock %}
{% block content %}
<h3>Entries</h3>
{% for entry in entries %}
<div>{{ entry.title }} - {{ entry.created }}</div>
<div>{{ entry.text }}</div>
<br />
{% endfor %}
{% endblock %}
{% block footer %}
2011 - MyBlog
{% endblock %}
Комментариев нет:
Отправить комментарий