Re: python web service or Apache?

Discussion in 'Python' started by Peng Yu, Oct 26, 2009.

  1. Peng Yu

    Peng Yu Guest

    On Sun, Oct 25, 2009 at 11:09 PM, Simon Forman <> wrote:
    > On Sun, Oct 25, 2009 at 4:47 PM, Peng Yu <> wrote:
    >> Although, python can be used to provide web service. The following
    >> webpage also mentioned, "Apache the best and most widely used web
    >> server on the Internet today, check it out. If you want to run your
    >> own web server this is the one to get, you can get binaries for both
    >> Windows and Unix. You can download the entire sourcecode if you want
    >> to check how it was made." Therefore, it would be better to use Apache
    >> rather than python to provide web service, right?
    >>
    >> http://fragments.turtlemeat.com/pythonwebserver.php

    >
    >
    > Both "best" and "better" (that website and you, respectively) omit
    > mention of the criteria used for the evaluation.
    >
    > To determine what is "best" you must first answer "for what?"
    >
    >
    > (Also, it is reasonable to use /both/ apache and python together, with
    > mod_python or mod_wsgi, etc...)


    I have never made a web server before. So I don't know what criterion
    I should use? If possible, would you please let me know what pros and
    cons you can think of?

    How to use apache and python together? Does each of them offer some
    functions that are not available in the other? Thank you!
     
    Peng Yu, Oct 26, 2009
    #1
    1. Advertising

  2. Peng Yu

    Guest

    On 10/26/2009 08:00 AM, Peng Yu wrote:
    > On Sun, Oct 25, 2009 at 11:09 PM, Simon Forman <> wrote:
    >> On Sun, Oct 25, 2009 at 4:47 PM, Peng Yu <> wrote:
    >>> Although, python can be used to provide web service. The following
    >>> webpage also mentioned, "Apache the best and most widely used web
    >>> server on the Internet today, check it out. If you want to run your
    >>> own web server this is the one to get, you can get binaries for both
    >>> Windows and Unix. You can download the entire sourcecode if you want
    >>> to check how it was made." Therefore, it would be better to use Apache
    >>> rather than python to provide web service, right?
    >>>
    >>> http://fragments.turtlemeat.com/pythonwebserver.php

    >>
    >>
    >> Both "best" and "better" (that website and you, respectively) omit
    >> mention of the criteria used for the evaluation.
    >>
    >> To determine what is "best" you must first answer "for what?"
    >>
    >>
    >> (Also, it is reasonable to use /both/ apache and python together, with
    >> mod_python or mod_wsgi, etc...)

    >
    > I have never made a web server before. So I don't know what criterion
    > I should use? If possible, would you please let me know what pros and
    > cons you can think of?


    Apache requires root access to the server machine, is quite complex
    and requires some learning and work to setup and use.
    On the other hand it is very powerful, will handle high traffic,
    and can handle the requirements of most any web site, so even if
    you start with a simple site you can be pretty sure it will handle
    your needs in the future as your web site grows. Because Apache
    is widely used, there an many places and people that can provide
    help and advice on how to run it.

    A small simple custom web server built with Python will likely
    only work well with a very small traffic volume and will have
    very limited capabilities but is very quick to get up and running.
    You can run it on a non-privileged port if you do not have
    root access to your server machine.

    > How to use apache and python together? Does each of them offer some
    > functions that are not available in the other? Thank you!


    Apache, like most general purpose web servers, supports the CGI
    protocol. You can setup Apache so that when a request is made
    for a file ending with ".py", it will run the python file and
    send the program's output to the client browser. This allows
    you to generate html output from the Python program. Python's
    standard lib contains the "cgi" module that will help in writing
    python code for this.

    There are other more efficient ways of using Python with
    a web server such as mod_python, or wsgi, but cgi is probably
    the simplest, and has the most "how-to" info available.

    HTH
     
    , Oct 26, 2009
    #2
    1. Advertising

  3. Peng Yu

    Paul Rubin Guest

    writes:
    > Apache requires root access to the server machine,


    Only to access the privileged ports.

    > A small simple custom web server built with Python will likely...
    > You can run it on a non-privileged port if you do not have
    > root access to your server machine.


    You can do that with apache as well. Which is more complicated is a
    little bit subjective. I use both, and for something simple I
    generally find it easier to throw together a custom server with
    SocketServer.py, but it takes some familiarity with Python networking
    to be able to do that.
     
    Paul Rubin, Oct 26, 2009
    #3
    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. Replies:
    0
    Views:
    940
  2. Replies:
    2
    Views:
    13,771
  3. Replies:
    4
    Views:
    590
    Joseph Kesselman
    Aug 10, 2006
  4. Peng Yu

    python web service or Apache?

    Peng Yu, Oct 25, 2009, in forum: Python
    Replies:
    0
    Views:
    392
    Peng Yu
    Oct 25, 2009
  5. Leo Violette
    Replies:
    0
    Views:
    1,055
    Leo Violette
    Apr 17, 2009
Loading...

Share This Page