I have a remote database (at the moment sqlite, but eventually mysql) that I want to be able to call from a webpage dynamically. Basically to query for data that will populate goog viz charts etc on the page (and possibly images).
I have a small, slow server that i can basically run anything on. I've also located the python lib that lets me painlessly generate the data in a format that is friendly for goog viz (http://code.google.com/apis/visualization/documentation/dev/gviz_api_lib.html)
but, what i cant understand is how do i go from there to the point where i have a url, to which i can pass arguments and get the data back? googling suggests django (or pylons), but isnt that a bit OTT (i dont have experiance with either). I'm opening to learning how to use them, but atm im very confus开发者_C百科ed as to what exactly i need to be able to run this webservice.
help greatly appreciated.
thanks!
The first thing you'll need to do is deploy a web server (apache is a common choice). Once your server is running, you can test it by pushing simple HTML files to it and make sure they are accessible to you from a browser.
Once your server is properly configured, you have a number of options available for interfacing your web-server with Python:
- The easiest is probably to follow the deployment guide of a popular web framework, as you mentioned.
- Pylons Deployment Guide
- Django Installation Guide
- You can use mod_python directly, which requires adding boilerplate code around your code to work inside a mod_python instance.
- mod_python documentation
- You can use CGI, which does not scale very well but makes it fairly easy to interact with the web-server:
- Python's built-in CGI module
精彩评论