In our previous tutorial we have explained, why we have started building MoCherry and how it will help developers to build REST webservices seamlessly with CherryPy with MongoDB support. Here we will demonstrate a step by step guide to build REST based CRUD operations using MoCherry framework.

Installation:

Currently, MoCherry is not available from python pip repository directly. So we can use direct github link to install MoCherry and all it’s required dependencies to our system or virtualenv.

$ python -m venv testenv         # create virtualenv
$ source testenv/bin/activate    # activate virtual environment
$ pip install git+https://github.com/techunits/mocherry.git    # install mocherry and all it's dependencies

Initialize Application:

We will create our first application using MoCherry official sample application as provided on github: https://github.com/techunits/mocherry-sample-app

$ git clone https://github.com/techunits/mocherry-sample-app.git
$ cd mocherry-sample-app
$ python manage.py runserver  # start MoCherry WSGI server 
MoCherry running on port 9090

Once the server is running it should be accessible from the browser with the following URL: http://localhost:9090/