Running a Python script when a page is loaded

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Andrew Chalk

    Running a Python script when a page is loaded

    I am developing a CGI app, When the user loads my page I want to populate an
    HTML 'select' box (drop down menu) with items from a database. What is the
    best way to get my Python procedure that does this called when the page is
    loaded?

    Many thanks


  • Michael Geary

    #2
    Re: Running a Python script when a page is loaded

    Andrew Chalk wrote:[color=blue]
    > I am developing a CGI app, When the user loads my page I want to
    > populate an HTML 'select' box (drop down menu) with items from
    > a database. What is the best way to get my Python procedure that
    > does this called when the page is loaded?[/color]

    Normally a CGI app generates the entire page, so you'd already be running
    Python code and would just call your function at the right place. Or is
    there more to the question that I missed?

    If you're running Apache, you can use mod_rewrite to get rid of all the
    cgi-bin/scriptname?quer ystring cruft. For example, at my Geary Central site:



    All of the pages including the home page are generated by Python scripts
    (the MoinMoin wiki software), but the URLs look like ordinary static URLs
    because mod_rewrite translates them.

    -Mike


    Comment

    Working...