Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.6 / 3....
  • Linux Kernel 3.0.82 LTS...
  • KDE Software Compilatio...
  • PulseAudio 4.0
  • Wireshark 1.10.0
  • NetworkManager 0.9.8.2
  • LibreOffice 3.6.6 / 4.0...
  • SystemRescueCd 3.7.0
  • Linux Kernel 3.10 RC6
  • Ubuntu Tweak 0.8.5
  • Home > Linux > Internet > Django Plugins

    django_slumber 0.7.2

    Download button

    No screenshots available
    Downloads: 227  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Kirit Saelensminde | More programs
    Boost Software Licen... / FREE
    July 18th, 2012, 09:51 GMT
    ROOT / Internet / Django Plugins

     Read user reviews (0)  Refer to a friend  Subscribe

    django_slumber description

    RESTful data connector for Django

    django_slumber is a RESTful data connector that can be used to make proper RESTful data services from Django systems.

    To install Slumber use:

        pip install django_slumber

    To install the current development version use:

        pip install  git+git://github.com/KayEss/django-slumber.git

    Using Slumber

    Slumber has two parts, the server and client side. A RESTful service can be used by just adding the server side to an existing Django system. The client side is useful where you want to connect to the data service from another Python system, or even if you just want to decouple the persistence from the user interface layers within Django.

    The Slumber server

    In order to start to use Slumber on the server side you simply need to include it in your `urls.py` with something like this:

        (r'^slumber/', include('slumber.urls'))

    The Slumber data client

    The data client is to be found at `slumber.client`. It must be configured to be told the location of the directory server.

        SLUMBER_DIRECTORY='http://localhost:8000/slumber/'

    You should also configure a URL prefix for local Slumber accesses. This is set as below in `settings.py`. The value shown below is the default.

        SLUMBER_LOCAL='http://localhost:8000/'

    In order to fetch objects from the remote end you should import the client and make use of it:

        from slumber import client

        def do_something():
            pizza = client.slumber_test.Pizza.get(pk=1)
            assert pizza


    Slumber services

    Services are used when there are multiple RESTful services that all need to communicate together in order to provide a full system. Services are known by name and a single Slumber client can talk to multiple services through the directory server.

    All models in a particular Django project can be put into the same service through the use of the SLUMBER_SERVICE setting:

        SLUMBER_SERVICE = 'takeaway'

    This will create a takeaway service that all of the models can be found within. Now to access a model from the client the service name also needs to be used:

        shopping_cart = slumber.client.takeaway.order.Cart.get(pk=1)

    At least one of the projects must now be designated a Slumber directory and it is configured with the locations of all of the services (i.e. the `takeaway` service running within the same project and the `pizzas` service running on another port on the same development machine):

        SLUMBER_DIRECTORY = {
            'takeaway': 'http://localhost:8000/slumber/takeaway/',
            'pizzas': 'http://localhost:8001/slumber/pizza/',
        }


    Note that the directory must list itself. Even more important is that this is an absolute URL!

    On the `pizza` service we can now either repeat the exact same directory configuration, or have it point to the directory on the `takeaway` service. I.e. one of the following configurations can be used:

        SLUMBER_DIRECTORY = {
            'takeaway': 'http://localhost:8000/slumber/takeaway/',
            'pizzas': 'http://localhost:8001/slumber/pizza/',
        }


    or

        SLUMBER_DIRECTORY = 'http://localhost:8000/slumber/'

    Using a non Slumber Django project for the directory

    The Slumber directory doesn't even need to be Django. All that is needed is that the url that the directory points at returns JSON that describes where to find the services. The JSON returned for the above example should look like:

        {
            "services": {
                "takeaway": "http://localhost:8000/slumber/takeaway/",
                "pizzas": "http://localhost:8001/slumber/pizza/"
            }
        }



    Product's homepage

    Requirements:

    · Python
    · Django

      


    TAGS:

    data connector | Django slumber | Django | data | connector

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM