Newbie CGI Question

D

davedo2

I'm having a problem when writing a cgi script that outputs content
type: text/html. I can control the color of the screen with print
'<back bgcolor="some color">' but I can't tile the screen with print
'<back background="foo.gif">'. Is tiling not an option with Python
CGI? A push in the right direction would be appreciated.

I'm using Python 2.2.1 on Windows XP Pro running Apache 2.0.47 as
localhost for debug purposes. Thanks for any help provided.
 
M

Michael Geary

I'm having a problem when writing a cgi script that outputs content
type: text/html. I can control the color of the screen with print
'<back bgcolor="some color">' but I can't tile the screen with print
'<back background="foo.gif">'. Is tiling not an option with Python
CGI? A push in the right direction would be appreciated.

I'm using Python 2.2.1 on Windows XP Pro running Apache 2.0.47 as
localhost for debug purposes. Thanks for any help provided.

CGI is just a way to generate an HTML page (and the HTTP headers that go
with it). You're dealing with an HTML issue, not a Python issue.

So, you should start by forgetting about CGI completely. Use a text editor
to create a .html file by hand, and load the file in your browser to test
it. You can use any text editor and your favorite web browser and put them
side by side on the screen. Each time you edit and save the file, hit the
Refresh button in the browser to see how it's working.

Once you've got a working HTML page, then you can write the Python CGI code
to generate that same page.

Of course, you'll want to test your HTML in various browsers, but this will
get you started.

-Mike
 
P

Peter Hansen

Michael said:
CGI is just a way to generate an HTML page (and the HTTP headers that go
with it). You're dealing with an HTML issue, not a Python issue.

So, you should start by forgetting about CGI completely. Use a text editor
to create a .html file by hand, and load the file in your browser to test
it. You can use any text editor and your favorite web browser and put them
side by side on the screen. Each time you edit and save the file, hit the
Refresh button in the browser to see how it's working.

As you say, it's entirely an HTML (or web server path issue) and nothing
to do with Python, but the last suggestion can get a newbie into trouble
when Windows is involved (as, of course, would almost any suggestion you
might happen to make ;-).

Internet Explorer by default uses an "automatic" setting for its cache
control, which means it tries and generally fails in situations like
the above to figure out when it should reload a page and when it should
just regenerate from the cache.

In spite of the docs noting that "just hitting Refresh" will bypass the
cache, it seems that with a setting of "Automatically" IE will skip that
step from time to time when it thinks the page isn't changing often
enough for its tastes. Use "Every visit to the page" instead, and
life will be easier (but you'll get no caching performance boost).

The relevant setting is under Internet Options->Temporary Files->Settings.

This is all also totally not Python-related... :)

-Peter
 

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

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,282
Latest member
RoseannaBa

Latest Threads

Top