Mercurial > agora-palash
changeset 7:6c2d400091fd
Decouple bundle urlconfs; improve the skeleton layout to more than a few bones
author | Jordi Gutiérrez Hermoso <jordigh@gmail.com> |
---|---|
date | Sat, 26 Jun 2010 02:04:53 -0500 |
parents | c83460992637 |
children | 8be7bdae8fb6 |
files | apps/bundle/urls.py media/icon.png templates/base.djhtml templates/bundle/index.djhtml templates/index.djhtml templates/index.html urls.py |
diffstat | 7 files changed, 92 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/apps/bundle/urls.py Sat Jun 26 02:04:53 2010 -0500 @@ -0,0 +1,8 @@ +from django.conf.urls.defaults import * + +urlpatterns = patterns('agora.apps.bundle.views', + (r'^(?P<user>.*)/(?P<bundle>.*)/$', 'detail'), + (r'^(?P<user>.*)/$', 'index'), + +) +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/templates/base.djhtml Sat Jun 26 02:04:53 2010 -0500 @@ -0,0 +1,61 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> + <meta http-equiv="Content-Language" content="en-us" /> + + <title>Agora Octave — {% block title %}Free your math!{% endblock %}</title> + + <meta name="Copyright" content="This stuff is all free under the AGPLv3 or at you option, any later version" /> + + <meta name="keywords" content="Octave, mathematics, numerical + analysis, open source, free software, Agora" /> + + <meta name="description" content="Agora Octave is a website that + enables collaboration with Octave-related personal projects and + code" /> + + <link href="/media/{% block cssid %}base{% endblock %}.css" + rel="stylesheet" type="text/css" media="screen" /> + <link href="/media/print.css" + rel="stylesheet" type="text/css" media="print" /> + {% block extrahead %}{% endblock %} + </head> + + <body id="{% block sectionid %}generic{% endblock %}" + class="{% block coltype %}default{% endblock %}"> + + <div id="container"> + <div id="header"> + <h1 id="logo"><a href="http://www.octave.org/"><img src="/site_media/icon.png" + alt="Octave" /></a></h1> + <ul id="nav-global"> + <li id="nav-homepage"><a href="/">Home</a></li> + <li id="nav-about"><a href="/about">About</a></li> + <li id="nav-news"><a href="/news">News</a></li> + </ul> + </div> + <!-- END Header --> + <div id="billboard">{% block billboard %}{% endblock %}</div> + <div id="columnwrap"> + {% block columnwrap %} + <div id="content-main"> + {% block content %}{% endblock %} + </div> + <!-- END #content-main --> + {% endblock %} + </div> + <!-- END #content --> + <div id="footer"> + <p> + © 2005-{% now "Y" %} <a href="http://www.octave.org">John + W. Eaton and others</a> unless otherwise noted. + </p> + </div> + <!-- END #footer --> + </div> + <!-- END #container --> + </body> +</html> +
--- a/templates/bundle/index.djhtml Fri Jun 25 18:32:15 2010 -0500 +++ b/templates/bundle/index.djhtml Sat Jun 26 02:04:53 2010 -0500 @@ -1,3 +1,6 @@ +{% extends "base.djhtml" %} + +{% block content %} {% if bundle %} <p> Sup, this is {{ bundle.uploader }}'s {{ bundle.name }} bundle. @@ -6,7 +9,7 @@ {% if files %} <ul> {% for f in files%} - <li><a href="{{f.bundle_file}}">{{f}}</a></li> + <li><a href="/{{f.bundle_file}}">{{f}}</a></li> {% endfor %} </ul> @@ -20,3 +23,4 @@ Bundle not found! {% endif %} </p> +{% endblock %}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/templates/index.djhtml Sat Jun 26 02:04:53 2010 -0500 @@ -0,0 +1,6 @@ +{% extends "base.djhtml" %} +{% block content %} +<p> +Main screen turn on! +</p> +{% endblock %}
--- a/templates/index.html Fri Jun 25 18:32:15 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -<html> -<head> -<title>Agora Octave</title> -</head> -<body> -<p> -Main screen turn on! -</p> -</body> -</html>
--- a/urls.py Fri Jun 25 18:32:15 2010 -0500 +++ b/urls.py Sat Jun 26 02:04:53 2010 -0500 @@ -8,20 +8,22 @@ (r'^$', 'django.views.generic.simple.direct_to_template', - {'template': 'index.html'}), + {'template': 'index.djhtml'}), - # Uncomment the admin/doc line below and add 'django.contrib.admindocs' - # to INSTALLED_APPS to enable admin documentation: + (r'^admin/doc/', include('django.contrib.admindocs.urls')), - # Uncomment the next line to enable the admin: (r'^admin/', include(admin.site.urls)), - - - # Example: - # (r'^agora/', include('agora.foo.urls')), - - (r'^(?P<user>.*)/(?P<bundle>.*)/$', 'agora.apps.bundle.views.detail'), + (r'^', include('agora.apps.bundle.urls')) ) + +#Let Django itself serve static data during debugging +from django.conf import settings + +if settings.DEBUG: + urlpatterns.insert (1, + (r'^site_media/(?P<path>.*)$', 'django.views.static.serve', + {'document_root': 'media/', 'show_indexes': True}), + )