How to create REST API application using python Bottle framework and how to deploy it on apache server?
Question: I want to create one sample application for api's using python Bottle
framework, I want to deploy that application on apache server as well, I use
following sample code,

    
    
    from bottle import route, run, template
    
    @route('/hello/:name')
    def index(name='World'):
        return template('<b>Hello {{name}}</b>!', name=name)
    
    @route('/events/:id', method='GET')
    def get_event(id):
        return dict(name = 'Event ' + str(id))
    run(host='localhost', port=8082)
    

by using above code, How I can create sample application and how I can deploy
that sample application on server. How can achieve this?


Answer: [**@phihag**](http://stackoverflow.com/users/35070/phihag), go through these
articles by Miguel Grinberg,
[@miguelgrinberg](http://twitter.com/miguelgrinberg) ~
<http://blog.miguelgrinberg.com/category/REST>

Start with this article, "**[Designing a RESTful API with Python and
Flask](http://blog.miguelgrinberg.com/post/designing-a-restful-api-with-
python-and-flask)** " ~ and if need be install Flask, go through the steps.

Then re-write the application in Bottle. Bottle is a simple framework to use
and is so close to Flask I re-wrote the code reading through the example in
Bottle. There is a more [detailed
tutorial](http://blog.miguelgrinberg.com/post/designing-a-restful-api-using-
flask-restful) that you can look at once you have the basics.

It's worth the effort.

