Model-based HTML pages and redirects.
Project description
django-simple-pages allows you to store HTML documents in models, which can be served automatically without the need for hard-coded URL patterns.
Example use cases include:
Serving a static website.
Handling redirects for relocated resources.
Verifying site ownership for Google Search Console.
Quick-start
Install: pip install django-simple-pages.
Add: simple_pages to your INSTALLED_APPS.
Add: simple_pages.middleware.PageFallbackMiddleware to your MIDDLEWARE_CLASSES.
Run: python manage.py migrate simple_pages.
Usage
Simply navigate to /admin and create a new Page object. A Page consists of the following attributes:
title: The title of the page. This is rendered in the <title> tag if template_name is set to simple_pages/default.html.
access_url: The URL to access this page. All URLs should start with a leading slash.
redirect_url: The URL to redirect to. If set, content will not be rendered.
enabled: When set to True, this page is active. Setting this value to False means that you will see a 404 if you navigate to the page’s access_url.
template_name: The path to the template used to render content. Supported values include:
simple_pages/default.html: Renders a <head> containing a <title> tag, and a <body> containing the page’s content.
simple_pages/raw.html: Renders the page’s content only.
Note: Bold attributes are required.
Changelog
Version |
Description |
---|---|
0.1.1 |
Fixes incorrect help_text on Page.template_name. |
0.1 |
Initial version. |
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
Hashes for django-simple-pages-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5e54e7b73c5354b4e6438789062fe0c0ca82b674761146c8f6c1d7a8d817075 |
|
MD5 | 1c2f386a002374ca08180041873d7689 |
|
BLAKE2b-256 | e7bef86b8a1f03b6eab7d39ebcb5a2ca2b0c98f997067ed772be193f0fcc5c35 |