Skip to main content

This is a simple Django app to publish some pages directly from templates

Project description

Introduction

This is a simple Django app to publish some pages directly from templates.

Yes, this is simply to use a django.views.generic.TemplateView but this app will help to manage many pages and with Django sitemaps support.

Install

Add it to your installed apps in the settings :

INSTALLED_APPS = (
    ...
    'staticpages',
    ...
)

Usage

In the settings :

STATICPAGES = [
    ...
    (r'foo/$', "foo.html", 'mypage-foo'),
    ...
]

Then in your urls.py :

url(r'^staticpages/', include('staticpages.urls')),

And so your page mypage-foo will be published on /staticpages/foo/ using the foo.html template.

If you want to publish them in your sitemap.xml with Django sitemaps, you will have to do something like this in your urls.py :

from staticpages.sitemaps import StaticPageSitemapBase, StaticPageEntryTemplate

class MypagesSitemap(StaticPageSitemapBase):
    page_entries = [
        StaticPageEntryTemplate(url_name='mypage-foo', template_name='foo.html'),
    ]

# Enabled sitemaps
sitemaps = {
    # For Prototypes
    'mypages': MypagesSitemap,
}

urlpatterns += patterns('django.contrib.sitemaps.views',
    url(r'^sitemap\.xml$', 'sitemap', {'sitemaps': sitemaps}),
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

emencia-django-staticpages-0.1.tar.gz (3.7 kB view details)

Uploaded Source

File details

Details for the file emencia-django-staticpages-0.1.tar.gz.

File metadata

File hashes

Hashes for emencia-django-staticpages-0.1.tar.gz
Algorithm Hash digest
SHA256 4de4a6bc18525975358d24bdfe991f2b28ba48ec46b1e96c77882e83090f06e6
MD5 be6ca51820fe5491f20899948c92200e
BLAKE2b-256 c0f1ef02ad28fd25d81a4fbe1a0d4895983845cf89dc9cb83b43c636dd27db0b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page