A RedBarrel-based application is composed of:
To create the initial structure, create an empty directory and run the rbr-quickstart command. It will create for you an example sample RBR file and a Python package containing the code used by the example – a simple hello world.
The script will ask you a few questions
$ rbr-quickstart Name of the project: Hello World ! Description: A simple app Version [1.0]: Home page of the project: http://example.com Author: Tarek Author e-mail: firstname.lastname@example.org App generated. Run your app with "rbr-run shortme.rbr"
Once the files are generated, run your application using rbr-run:
$ bin/rbr-run hello-wo.rbr Generating the Web App... => 'hello' hooked for '/' ...ready Serving on port 8000...
Then, visit http://localhost:8000/__doc__. You should see the documentation page of your application.
Adding a web service consists of describing it in the RBR file (see RBR specification), then adding the required code for every pre- or post- step, or for the service itself.
A possible convention is to add one Python module per service, and eventually group all pre- and post- functions in an util.py module.
Check out a full example at Full example: an URL shortener .