Python web server

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

    #1

    Python web server

    When I run the script on server,only HTML part gets executed.
    But the python code appears as it is on the screen in the text format.
    How to run the CGI script on web server using Python2.4.3?

  • Bruno Desthuilliers

    #2
    Re: Python web server

    arvind wrote:[color=blue]
    > When I run the script[/color]

    Which one ? And how ?
    [color=blue]
    > on server,[/color]

    Which one ?
    [color=blue]
    > only HTML part gets executed.[/color]

    HTML executed ???
    [color=blue]
    > But the python code appears as it is on the screen in the text format.
    > How to run the CGI script on web server using Python2.4.3?[/color]

    Depends on your web server. But there's very probably all the needed
    documention somewhere, and I'm pretty confident google will find it.


    --
    bruno desthuilliers
    python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
    p in 'onurb@xiludom. gro'.split('@')])"

    Comment

    • Paul Boddie

      #3
      Re: Python web server

      arvind wrote:[color=blue]
      > When I run the script on server,only HTML part gets executed.
      > But the python code appears as it is on the screen in the text format.
      > How to run the CGI script on web server using Python2.4.3?[/color]

      We don't have much specific information from you here, but taking a few
      guesses, it sounds like you have put a Python program in some directory
      that your Web server knows about, but when you visit the address in
      your browser that should let you use that program, you just see the
      program text, not the output of the program when it is run.

      What you need to do is to tell your Web server that the file is a
      "script". With Apache, for example, instead of using configuration
      directives like "Alias", you use "ScriptAlia s" instead. Of course,
      Apache has lots of different ways to make files behave like scripts,
      and you may be using a completely different Web server, so a bit more
      information would be welcome.

      Still, one really simple method with Apache is to expose your program
      like this:

      ScriptAlias /myprogram "/home/me/programs/myprogram.py"

      Provided you set the permissions of myprogram.py to be readable and
      executable by the Web server user (if appropriate), and provided the
      Web server user can navigate to the /home/me/programs directory, you
      should at least get the program running. More configuration may be
      needed - why not let us know how far you get?

      Paul

      Comment

      Working...