Skip to main content

A bridge between Django and javascript.

Project description

Srvice is a library that aims to integrate a Python server with a Javascript client via remote calls. With Srvice, the client can transparently call functions defined in server. The server might also respond with instructions that execute arbitrary Javascript code in the client.

Let us define a function in the client:

from import srvice

def get_user_email(request, username):
    if can_read_email(request.user, username):
        return email_from_username(username)
        raise PermissionError

# This function must be associated with some url in your application
urlpatterns [
    '^get-user-email/$', get_user_email.as_view(),

In the client, we call the function defined in the some URL point using the srvice object:'get-user-email', 'paulmcartney').then(function (email) {
    var contact = currentContact(); = email;

Communication is done using JSON strings that pass function arguments and results from client to server and vice-versa.

This is only the very basic that Srvice can do. Please check the documentation for more information.

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

srvice-0.1.5.tar.gz (45.9 kB view hashes)

Uploaded Source

Supported by

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