Can't get dumb webcounter working

Discussion in 'Python' started by J. W. McCall, Aug 3, 2003.

  1. J. W. McCall

    J. W. McCall Guest

    Sorry if this is OT, but here's my question:

    I wrote a simple python script to increment a counter in a text file,
    and I wanted this script to be accessed whenever an HTML file is
    accessed. The HTML files and python script are on a shell account on
    UNIX a machine that has support for CGI, Python, etc. I unfortunately
    don't know much about CGI, since I assume this is what I need to get
    this to work. All I want to do is to get script to be called when the
    web site is accessed and hopefully insert some output (a number) into
    the HTML.

    Any advice, specific instructions, pointers to helpful web resources, or
    recommendations to better newsgroups, if this is too OT here, would be
    greatly appreciated.

    Thanks,

    J. W. McCall
     
    J. W. McCall, Aug 3, 2003
    #1
    1. Advertising

  2. J. W. McCall

    Tyler Eaves Guest

    On Sun, 03 Aug 2003 04:08:18 +0000, J. W. McCall wrote:

    > Sorry if this is OT, but here's my question:
    >
    > I wrote a simple python script to increment a counter in a text file,
    > and I wanted this script to be accessed whenever an HTML file is
    > accessed. The HTML files and python script are on a shell account on
    > UNIX a machine that has support for CGI, Python, etc. I unfortunately
    > don't know much about CGI, since I assume this is what I need to get
    > this to work. All I want to do is to get script to be called when the
    > web site is accessed and hopefully insert some output (a number) into
    > the HTML.
    >
    > Any advice, specific instructions, pointers to helpful web resources, or
    > recommendations to better newsgroups, if this is too OT here, would be
    > greatly appreciated.
    >
    > Thanks,
    >
    > J. W. McCall


    Server side includes?




    --
    Visit my blog - http://blog.scalegen.com
    Music, Programming, and More.
     
    Tyler Eaves, Aug 3, 2003
    #2
    1. Advertising

  3. J. W. McCall

    Barry Sprajc Guest

    Tyler's correct.

    You'll want to check with those hosting your web site, they usually have
    particular directories in your home directory where you'll put your scripts,
    etc...

    Then, you just need to put the correct HTML code in your document.

    /barry sprajc

    "J. W. McCall" <> wrote in message
    news:SU%Wa.148398$...
    > Sorry if this is OT, but here's my question:
    >
    > I wrote a simple python script to increment a counter in a text file,
    > and I wanted this script to be accessed whenever an HTML file is
    > accessed. The HTML files and python script are on a shell account on
    > UNIX a machine that has support for CGI, Python, etc. I unfortunately
    > don't know much about CGI, since I assume this is what I need to get
    > this to work. All I want to do is to get script to be called when the
    > web site is accessed and hopefully insert some output (a number) into
    > the HTML.
    >
    > Any advice, specific instructions, pointers to helpful web resources, or
    > recommendations to better newsgroups, if this is too OT here, would be
    > greatly appreciated.
    >
    > Thanks,
    >
    > J. W. McCall
    >
     
    Barry Sprajc, Aug 3, 2003
    #3
  4. J. W. McCall

    J. W. McCall Guest

    Barry Sprajc wrote:

    > Tyler's correct.
    >
    > You'll want to check with those hosting your web site, they usually have
    > particular directories in your home directory where you'll put your scripts,
    > etc...
    >
    > Then, you just need to put the correct HTML code in your document.


    From the FAQs and help at my shell account (freeshell.org) it says I
    don't need a "cgi-bin" directory or anything like that; I can run
    scripts from anywhere.

    As far as the correct HTML code...sorry if this is a dumb question, but
    what exactly would that HTML code be? I saw something about "<!--
    exec"command here" -->" but that didn't seem to work. I've never called
    a script from an HTML document. I guess that's what I'm trying to
    figure out.

    Thanks,

    J. W. McCall
     
    J. W. McCall, Aug 3, 2003
    #4
  5. J. W. McCall

    Brian Victor Guest

    J. W. McCall wrote:
    > As far as the correct HTML code...sorry if this is a dumb question, but
    > what exactly would that HTML code be? I saw something about "<!--
    > exec"command here" -->" but that didn't seem to work. I've never called
    > a script from an HTML document. I guess that's what I'm trying to
    > figure out.


    You're close, but you're missing a few characters:
    http://httpd.apache.org/docs-2.0/mod/mod_include.html#element.exec

    <!--#exec cgi="yourscript.py"-->

    Or similarly the "include virtual" alternative mentioned at the link
    above.

    --
    Brian
     
    Brian Victor, Aug 3, 2003
    #5
  6. J. W. McCall

    Jane Doe Guest

    On Sun, 03 Aug 2003 04:08:18 GMT, "J. W. McCall" <> wrote:
    >Any advice, specific instructions, pointers to helpful web resources, or
    >recommendations to better newsgroups, if this is too OT here, would be
    >greatly appreciated.


    More infos on calling a Python script through a URL (CGI call) here:

    http://www.devshed.com/Server_Side/Python/CGI/print_html

    JD.
     
    Jane Doe, Aug 4, 2003
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. El Guerrero del Interfaz

    Dumb question: How do I get an object's parent?

    El Guerrero del Interfaz, Jun 9, 2005, in forum: Java
    Replies:
    2
    Views:
    320
    Steve Horsley
    Jun 9, 2005
  2. J. W. McCall
    Replies:
    3
    Views:
    377
    Bengt Richter
    Aug 6, 2003
  3. LB
    Replies:
    5
    Views:
    591
  4. JJ
    Replies:
    0
    Views:
    130
  5. Jerry C.
    Replies:
    8
    Views:
    263
    Uri Guttman
    Nov 23, 2003
Loading...

Share This Page