Quote:
Originally Posted by Ownaginatios
Heh, I'm obviously not in 1D04, but I do have some questions about Python I think you may be able to answer.
How do I integrate python with a webpage (you know, like how PHP does)? Is there something you just drop into your apache server to make it work?
I'm thinking of creating an application for my WRT54GL in C to dump bandwidth usage to an SQL database, and Python's ability to easily make graphs and stuff for a webpage is rather intriguing.
|
Python (fortunately?) doesn't mix logic with the view, so you'll have to use templating and a framework.
So, I would suggest to use a lightweight framework, like Flask (
http://flask.pocoo.org/), which also has the best documentation of any software project I know. I highly recommend following the tutorial, then asking me again if you have any questions. You can then deploy with mod_wsgi for Apache,
http://flask.pocoo.org/docs/deploying/mod_wsgi/, a very trivial task. Again the documentation is really good.
To set up your Python, (assuming you're using Ubuntu), install setuptools and virtualenv.
Code:
sudo apt-get install python-setuptools python-virtualenv
setuptools provides the easy_install command to easily install Python modules.
virtualenv isolates your development environment to allow you to install modules for this project only, in a contained environment. It's great for decluttering your system Python modules folder.
More info on setting up is here:
http://flask.pocoo.org/docs/installation/
If you have any questions, feel free to ask. I've been using (and having fun with) Flask (and Pylons, it's big brother) for about a year or so.