Running a Python script when a page is loaded

A

Andrew Chalk

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
 
M

Michael Geary

Andrew said:
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?

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?querystring cruft. For example, at my Geary Central site:

http://www.geary.com/

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top