django-flatly


Namedjango-flatly JSON
Version 0.3.1 PyPI version JSON
download
home_pagehttps://github.com/dldevinc/django-flatly
SummaryServing flat pages with Django without views and database.
upload_time2023-01-09 07:34:01
maintainerMihail Mishakin
docs_urlNone
authorMihail Mishakin
requires_python>=3.6
licenseBSD
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # django-flatly

Serving flat pages with Django without views and database.

Helps to separate deployment of front- and backend.

[![PyPI](https://img.shields.io/pypi/v/django-flatly.svg)](https://pypi.org/project/django-flatly/)
[![Build Status](https://github.com/dldevinc/django-flatly/actions/workflows/tests.yml/badge.svg)](https://github.com/dldevinc/django-flatly)
[![Software license](https://img.shields.io/pypi/l/django-flatly.svg)](https://pypi.org/project/django-flatly/)

## Compatibility

-   `django` >= 2.0
-   `python` >= 3.6

## Installation

Install the latest release with pip:

`pip install django-flatly`

Than add a URL to urlpatterns:

```python
# urls.py
urlpatterns = [
    ...,
    # all others urls above - flatly.urls last one to try!
    path('', include('flatly.urls')),
]
```

## Quick start

1. In your root template directory create `flatly` folder.

2. Define `FLATLY_TEMPLATE_ROOT` setting:

    ```python
    FLATLY_TEMPLATE_ROOT = 'flatly'
    ```

3. Any `.html` files you create in your `flatly` directory
   will be automatically served. So if you create a new file
   `flatly/about_us/overview.html` then it will be visible at
   `/about-us/overview/`.

Note that `django-flatly` automatically replaces underscores (\_)
with dashes (-).

## Search path

Suppose you are requesting the page `/account/user-profile/`,
`django-flatly` will render the first template that exists:

1. `${FLATLY_TEMPLATE_ROOT}/account/user_profile`
2. `${FLATLY_TEMPLATE_ROOT}/account/user_profile.html`
3. `${FLATLY_TEMPLATE_ROOT}/account/user_profile/index.html`

## Settings

### Template root

`django-flatly` based on Django's `get_template` function.
So, user can access any template on your website. You can
restrict access to certain templates by adding the path prefix
to the template name before search:

```python
FLATLY_TEMPLATE_ROOT = 'flatly'
```

Note that `flatly` folder can be located in both root and
application template directories.

Defaults to `flatly`.

### Template engine

You can restrict the template search to a particular template engine.

```python
FLATLY_ENGINE = 'jinja2'
```

Defaults to `None`.

### Template caching

By default (when `DEBUG` is `True`), the template system
searches, reads and compiles your templates every time
they’re rendered. It's convenient for local development,
because no need to restart the server after adding/removing
templates.

You can enforce template caching:

```python
FLATLY_CACHE_ENABLED = True
```

The cached `Template` instance is returned for subsequent
requests to load the same template.

Defaults to `True` is `settings.DEBUG` is `False`.

### Extensions

List of file extensions to iterate over all matching files.

```python
FLATLY_EXTENSIONS = ['html', 'jinja2']
```

Defaults to `['html']`.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/dldevinc/django-flatly",
    "name": "django-flatly",
    "maintainer": "Mihail Mishakin",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "x896321475@gmail.com",
    "keywords": "",
    "author": "Mihail Mishakin",
    "author_email": "x896321475@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/10/4a/6d56bb6df397c84e1f6d9068aeb35eaeefc93d41f90d0246f63e37ec463a/django-flatly-0.3.1.tar.gz",
    "platform": "OS Independent",
    "description": "# django-flatly\n\nServing flat pages with Django without views and database.\n\nHelps to separate deployment of front- and backend.\n\n[![PyPI](https://img.shields.io/pypi/v/django-flatly.svg)](https://pypi.org/project/django-flatly/)\n[![Build Status](https://github.com/dldevinc/django-flatly/actions/workflows/tests.yml/badge.svg)](https://github.com/dldevinc/django-flatly)\n[![Software license](https://img.shields.io/pypi/l/django-flatly.svg)](https://pypi.org/project/django-flatly/)\n\n## Compatibility\n\n-   `django` >= 2.0\n-   `python` >= 3.6\n\n## Installation\n\nInstall the latest release with pip:\n\n`pip install django-flatly`\n\nThan add a URL to urlpatterns:\n\n```python\n# urls.py\nurlpatterns = [\n    ...,\n    # all others urls above - flatly.urls last one to try!\n    path('', include('flatly.urls')),\n]\n```\n\n## Quick start\n\n1. In your root template directory create `flatly` folder.\n\n2. Define `FLATLY_TEMPLATE_ROOT` setting:\n\n    ```python\n    FLATLY_TEMPLATE_ROOT = 'flatly'\n    ```\n\n3. Any `.html` files you create in your `flatly` directory\n   will be automatically served. So if you create a new file\n   `flatly/about_us/overview.html` then it will be visible at\n   `/about-us/overview/`.\n\nNote that `django-flatly` automatically replaces underscores (\\_)\nwith dashes (-).\n\n## Search path\n\nSuppose you are requesting the page `/account/user-profile/`,\n`django-flatly` will render the first template that exists:\n\n1. `${FLATLY_TEMPLATE_ROOT}/account/user_profile`\n2. `${FLATLY_TEMPLATE_ROOT}/account/user_profile.html`\n3. `${FLATLY_TEMPLATE_ROOT}/account/user_profile/index.html`\n\n## Settings\n\n### Template root\n\n`django-flatly` based on Django's `get_template` function.\nSo, user can access any template on your website. You can\nrestrict access to certain templates by adding the path prefix\nto the template name before search:\n\n```python\nFLATLY_TEMPLATE_ROOT = 'flatly'\n```\n\nNote that `flatly` folder can be located in both root and\napplication template directories.\n\nDefaults to `flatly`.\n\n### Template engine\n\nYou can restrict the template search to a particular template engine.\n\n```python\nFLATLY_ENGINE = 'jinja2'\n```\n\nDefaults to `None`.\n\n### Template caching\n\nBy default (when `DEBUG` is `True`), the template system\nsearches, reads and compiles your templates every time\nthey\u2019re rendered. It's convenient for local development,\nbecause no need to restart the server after adding/removing\ntemplates.\n\nYou can enforce template caching:\n\n```python\nFLATLY_CACHE_ENABLED = True\n```\n\nThe cached `Template` instance is returned for subsequent\nrequests to load the same template.\n\nDefaults to `True` is `settings.DEBUG` is `False`.\n\n### Extensions\n\nList of file extensions to iterate over all matching files.\n\n```python\nFLATLY_EXTENSIONS = ['html', 'jinja2']\n```\n\nDefaults to `['html']`.\n",
    "bugtrack_url": null,
    "license": "BSD",
    "summary": "Serving flat pages with Django without views and database.",
    "version": "0.3.1",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "74b42da207ab80757e4d038082e3a87756136c1a36f8164b51f6aa1542684855",
                "md5": "7d4b328afecc01b4dc24702942555ecc",
                "sha256": "72de0a8f27e2a387e3d135e1dbcbc8ae37cffcff834a3ef37c7a44dd99763ec1"
            },
            "downloads": -1,
            "filename": "django_flatly-0.3.1-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7d4b328afecc01b4dc24702942555ecc",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.6",
            "size": 6458,
            "upload_time": "2023-01-09T07:34:00",
            "upload_time_iso_8601": "2023-01-09T07:34:00.233598Z",
            "url": "https://files.pythonhosted.org/packages/74/b4/2da207ab80757e4d038082e3a87756136c1a36f8164b51f6aa1542684855/django_flatly-0.3.1-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "104a6d56bb6df397c84e1f6d9068aeb35eaeefc93d41f90d0246f63e37ec463a",
                "md5": "f42754f583dab2acbaff2450b47ddae1",
                "sha256": "a1635de525813c162ff5e6e52a471865fb8191d4bafb6d2462dd462e1e51ece9"
            },
            "downloads": -1,
            "filename": "django-flatly-0.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "f42754f583dab2acbaff2450b47ddae1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 6813,
            "upload_time": "2023-01-09T07:34:01",
            "upload_time_iso_8601": "2023-01-09T07:34:01.575879Z",
            "url": "https://files.pythonhosted.org/packages/10/4a/6d56bb6df397c84e1f6d9068aeb35eaeefc93d41f90d0246f63e37ec463a/django-flatly-0.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-09 07:34:01",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "dldevinc",
    "github_project": "django-flatly",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "tox": true,
    "lcname": "django-flatly"
}
        
Elapsed time: 0.04848s