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?
Here you have explanation how to deploy bottle app in apache with the use of WSGI: http://bottlepy.org/docs/dev/deployment.html#apache-mod-wsgi
As far as application is concerned you need to best REST compliant so learn about REST and bottle, here is a good tutorial which I used: http://myadventuresincoding.wordpress.com/2011/01/02/creating-a-rest-api-in-python-using-bottle-and-mongodb/