diff --git a/pages/__init__.py b/pages/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/pages/models.py b/pages/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/pages/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/pages/urls.py b/pages/urls.py new file mode 100644 index 0000000..1c0cf82 --- /dev/null +++ b/pages/urls.py @@ -0,0 +1,5 @@ +from django.conf.urls.defaults import * + +urlpatterns = patterns('pages.views', + (r'^(?P.+)/$', 'index'), +) diff --git a/pages/views.py b/pages/views.py new file mode 100644 index 0000000..2f902a6 --- /dev/null +++ b/pages/views.py @@ -0,0 +1,18 @@ +import os.path + +from django.http import Http404 +from django.views.generic.simple import direct_to_template + +from settings import DEPLOY_PATH + +def index(request, page): + + template = 'html_pages/%s/index.html' % page + if not os.path.exists('%s/templates/%s' % (DEPLOY_PATH, template): + raise Http404 + + c = { + "page": template, + } + + return direct_to_template(request, "pages/index.html", c) diff --git a/templates/pages/index.html b/templates/pages/index.html new file mode 100644 index 0000000..18988f9 --- /dev/null +++ b/templates/pages/index.html @@ -0,0 +1,5 @@ +{% extends "base.html" %} + +{% block content %} +{% include page %} +{% endblock %} diff --git a/urls.py b/urls.py index a5e253d..3b24bf7 100644 --- a/urls.py +++ b/urls.py @@ -15,4 +15,8 @@ urlpatterns = patterns('', if DEBUG: urlpatterns += patterns('', (r'^static/(?P.*)$', 'django.views.static.serve', {'document_root': '%s/static' % DEPLOY_PATH}) + ) + +urlpatterns += patterns('', + (r'^', include("pages.urls")) )