Package: django-redis-views
Simple Redis-based generic views for serving your Django-backed Ember CLI apps.DocumentationThe full documentation is athttps://django-redis-views.readthedocs.org.FeaturesServes your single page javascript apps easily through Django views.Works out-of-the-box withember-cli-deployandember-deploy-redis.BackgroundEmber CLI and other single-page javascript apps can be challenging to deploy.Luke Melia presented a talk calledLightning Fast Deployment of Your Rails-backed JavaScript app,
which eventually led to the creation ofember-cli-deploy.This project acts as the glue betweenember-cli-deployand Django by
providing generic views to serveRedis-backed index pages for single
page javascript applications.QuickstartLet’s assume we already have an Ember CLI app that we’re ready to deploy.
We’re using theember-deploy-redisadapter and we
ranember deployto push theindex.htmlfile into Redis.
In this case, we’ll pretend that the
Ember CLI project’s name isember-cli-my-great-app.First, install django-redis-views:pip install django-redis-viewsIn your Django settings file, set the Redis url. For example, you may want
to access Redis on the localhost running on the default port. In which case,
you would add something like this to the yoursettings.pyfile:REDIS_URL = 'redis://localhost:6379/0'Then, to use it in your Django project, first add a new view to aviews.pyfile:from redis_views import RedisView


class EmberAppIndex(RedisView):
    app_name = 'ember-cli-my-great-app'And then set it a route for it in yoururls.pyfile:from django.conf.urls import patterns
from myapp.views import EmberAppIndex


urlpatterns = patterns('',
    url(r'^$', EmberAppIndex.as_view()),
)At this point, you should be able to go to your root url and see your index
page!TODO: Walk through a full example project.Injecting Context to your TemplateIf you want to use Django’s template engine to replace values in your Ember
index file, you can do that by injecting the context. Let’s pretend that we
have this very simple Ember index page:<p>Hello {{ name }}!</p>In order to inject{{ name }}from Django into the Ember index page,
you’ll want to add to the context. This package is built upon the generic views
in Django, so we inject context the same way that they do. In yourviews.pyfile (using the same conventions as above):from redis_views import RedisView

class EmberAppIndex(RedisView):

    . . .

    def get_context_data(self, **kwargs):
        # Call the base implementation first to get a context
        context = super(EmberAppIndex, self).get_context_data(**kwargs)
        # Add in the name value (you could also use a dynamic value from a database object)
        context['name'] = 'Joe'
        return contextThen, in the template, it will fill in the value with your supplied value.
As mentioned in the comment, you can inject pretty much anything that could
normally be handled by Django templates, such as a CSRF token.Running the TestsTo run the tests, please do the following in your terminal:# Install the testing requirements
pip install -r requirements-test.txt

# Run the tests
py.testCookiecutter Tools Used in Making This Packagecookiecuttercookiecutter-djangopackageHistory0.2.2 (2015-10-20)Fixed bug with setting the socket timeout without a kwarg.0.2.1 (2015-10-20)Added a socket timeout and server pinging when connecting to the server to raise a
ConnectionError if there are any connection issues.Added error logging of missing template keys.0.2.0 (2015-09-21)Changed the GET parameter value fromversiontoindex_keyto match
the convention established by ember-cli-deploy.0.1.0 (2015-08-22)First release on PyPI.