Coder Social home page Coder Social logo

django-templatepages's Introduction

django-templatepages

django-templatepages is a Django app for mapping URLs to templates on the filesystem as if they were static web pages. This is useful for integrating static content into your Django project while still leveraging the Django templating language.

templatepages differs from django.contrib.flatpages in that the content is stored entirely in templates on the filesystem, rather than in a database. We developed this app to address a real-world situation where much of the content in a project is static and managed on the filesystem under version control. templatepages allows us to factor out the page layout using the Django templating language, and cleanly integrate the static content with other dynamic components implemented as Django apps.

Python's mimetypes.guess_type() is used to determine appropriate Content-type and Content-encoding headers for the HTTP response. This means that you can use templatepages for more than just HTML files; for example, we use it to serve dynamically-generated CSS stylesheets.

Usage

Using templatepages is relatively straightforward: just add it to INSTALLED_APPS in your project's settings.py file, and integrate the URL mapping in your project's urls.py file. Then place your templates in your project's templates/templatepages folder.

For example, the following stanza in urls.py will configure your project to map all requests beginning with articles/ to templatepages:

urlpatterns = patterns('',
    (r'^articles/', include('templatepages.urls')),
)

In this example, a request for http://your.site/articles/contact.html should result in templatepages attempting to return a rendered template based on templates/templatepages/contact.html. If this file cannot be found, templatepages will raise Http404.

If no filename is specified in the URL, templatepages will attempt to render index.html.

templatepages passes RequestContext to the template, so full access to template context processor variables is available.

django-templatepages's People

Contributors

bryanchow avatar data-platform-jenkins avatar njdevil avatar pkimber avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

django-templatepages's Issues

no setup.py

Can you add a setup.py file so that I can upload this package to my private pypi? I don't want to fork your project just to add a setup.py file for you.

Thanks,
Eric.

Can't install fro PyPI

Can you update PyPI, the tar ball's setup.py has the following which causes it to fail:

long_description = open('README.md').read(),

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.