Skip to main content

django-database-views

https://badge.fury.io/py/django-database-views.svg https://travis-ci.org/a7madnassar/django-database-views.svg?branch=master https://coveralls.io/repos/github/a7madnassar/django-database-views/badge.svg?branch=master

Serve your single page Javascript applications from Django.

Documentation

The full documentation is at https://django-database-views.readthedocs.io.

Requirements

  • Django > 1.8

  • A database engine such as MySQL

Quickstart

Install django-database-views using pip:

pip install django-database-views

Add it to your installed apps:

INSTALLED_APPS = (
    ...
    'database_views.apps.DatabaseViewsConfig',
    ...
)

Create a model to store versions for your index template in your app’s models.py:

from database_views.models import AbstractTemplate


class IndexTemplate(AbstractTemplate):

    class Meta:
        db_table = 'your_table_name' # For example 'index_template'.

Create a class-based view for your single page app in your app’s views.py and assign your model to its model property:

from database_views.views import DatabaseTemplateView
from database_views.views import CachedTemplateResponse
from myapp.models import IndexTemplate


class IndexView(DatabaseTemplateView):
    app_name = 'main'
    model = IndexTemplate
    response_class = CachedTemplateResponse

Add a route for your index page view in your project’s urls.py file:

from myapp.views import IndexView

urlpatterns = [
    ...
    url(r'^$', IndexView.as_view())
    ...
]

That’s it!! Go to your new route and you should see your single page app’s index template served. Please ensure that you configure the serving of your app’s static assets properly.

Features

  • Easily serve your single page javascript applications from Django.

  • Optionally cache your templates for a configurable amount of time.

  • Works with ember-cli-deploy and more specifically with ember-cli-deploy-mysql.

Running Tests

To run tests use the following commands from the root of this project:

source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install -r requirements_test.txt
(myenv) $ py.test

Credits

Tools used in rendering this package:

History

0.1.0 (2017-03-10)

  • First release on PyPI.

Metadata

Release files for django-database-views 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-database-views 0.1.2
File Size Uploaded Provenance Actions
django-database-views-0.1.2.tar.gz 7.4 kB Without provenance Details for django-database-views-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-database-views 0.1.2
File Interpreter ABI Platform Actions
django_database_views-0.1.2-py2.py3-none-any.whl Python 2, Python 3 none any Details for django_database_views-0.1.2-py2.py3-none-any.whl

Total release size: 15.2 kB

Release files / django-database-views-0.1.2.tar.gz

Download URL django-database-views-0.1.2.tar.gz
Size 7.4 kB
Tags Source
SHA-256 checksum
How to use checksums
26a8d2d988c98ec195b089d09d7c7fefaec65340961f614801b0b9d03b4b0935
BLAKE2b-256 checksum
How to use checksums
02fa480f3d5950661626affef8ab6818b2758ac7a47708fff3c8f56a48e601cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django_database_views-0.1.2-py2.py3-none-any.whl

Download URL django_database_views-0.1.2-py2.py3-none-any.whl
Size 7.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
1b3bffdfcb29b352d9a8f9e42cd8c6f066ea8541c224784ca20eaefdd9f45d7e
BLAKE2b-256 checksum
How to use checksums
0c63ee12709f6f233afc861bb0f4eb429cb0b53ae41eaaa0e360713809b513f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-database-views 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page