pythonapachecgimod-python

Calling a Python script from a webpage


I've searched around for a while but I can't find a concise explanation of how to do what I want.

I have a fairly complex program which I'd like to make a simple web interface for.

Ideally there'll be a couple of text fields, "foo" and "bar" on a webpage.

When the user clicks submit, a python script "src/script.py" is run, which has access to the contents of these fields somehow.

I have apache2 and mod_python.


Solution

  • If it is a "fairly complex program" you may want to use a small framework that takes care of grouping the parts in a "standard", i.e. supported and documented, manner. I would look into lightweight Python Web frameworks as Flask and WebApp2. Lightweight in terms of both performance and learning curve.

    Here you get a full overview of Python web frameworks.