Skip to content
This repository has been archived by the owner on Mar 21, 2021. It is now read-only.
/ wormhole Public archive
forked from ithayer/wormhole

jquery and django library that makes it simple to call python from javascript

Notifications You must be signed in to change notification settings

bunchesofdonald/wormhole

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Wormhole

A Django/jQuery app that makes it dead simple to make calls to python through javascript.

Installation

git clone git://github.com/bunchesofdonald/wormhole.git
ln -s wormhole/wormhole /path/to/my/project/wormhole

Add 'wormhole' to your settings.INSTALLED_APPS

Quick Start

python manage startapp myapp

Edit myapp/ajax.py to:

from wormhole import wormhole

@wormhole.register
def say_my_name(request, name):
    return 'Hello %s' % name

In your view html, include the wormhole.js: <script src="{{ STATIC_URL }}wormhole.js?csrf_token={{ csrf_token }}"></script>

Notice that is {{ csrf_token }} (double brackets) NOT {% csrf_token %}. The latter creates an input element, the former is the value.

and then make a call to our say_my_name function:

$.wormhole.rpc('say_my_name', {'name':'Chris'}, function(data) { alert(data.result); })

About

jquery and django library that makes it simple to call python from javascript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 56.9%
  • Python 43.1%