creating a small test server on my local computer

Discussion in 'Python' started by John Salerno, Sep 29, 2006.

  1. John Salerno

    John Salerno Guest

    Ok, this is completely unnecessary so I don't intend to get into stuff
    that's beyond my skill, but I'm wondering how simple it would be to use
    Python to create a server that runs on my computer so I can test my
    webpages (because otherwise I have to keep sending them to our IT person
    so he can upload them to the server).

    The catch is that I need a server that supports SSI and I have no clue
    how to write something like this. If it's already been included in the
    standard library, then that would be great, otherwise I won't really
    mess with it.

    Thanks.
    John Salerno, Sep 29, 2006
    #1
    1. Advertising

  2. John Salerno wrote:
    > Ok, this is completely unnecessary so I don't intend to get into stuff
    > that's beyond my skill, but I'm wondering how simple it would be to use
    > Python to create a server that runs on my computer so I can test my
    > webpages (because otherwise I have to keep sending them to our IT person
    > so he can upload them to the server).


    Why do you need to use Python for the server?

    > The catch is that I need a server that supports SSI and I have no clue
    > how to write something like this. If it's already been included in the
    > standard library, then that would be great, otherwise I won't really
    > mess with it.


    Apache supports server side includes. And is fairly straightforward
    to install (or even already installed on most linux systems that I know
    of) Configuring can be a bit troublesome depending on your demands,
    but there is lots and lots of information available.

    --Irmen
    Irmen de Jong, Sep 29, 2006
    #2
    1. Advertising

  3. John Salerno

    John Salerno Guest

    Irmen de Jong wrote:
    > John Salerno wrote:
    >> Ok, this is completely unnecessary so I don't intend to get into stuff
    >> that's beyond my skill, but I'm wondering how simple it would be to
    >> use Python to create a server that runs on my computer so I can test
    >> my webpages (because otherwise I have to keep sending them to our IT
    >> person so he can upload them to the server).

    >
    > Why do you need to use Python for the server?


    Well, perhaps I don't know what I'm talking about. I'm on an XP machine
    and I just needed a way to test my web pages, and I thought Python could
    be used to create a server to do this. But I know nothing about network
    programming...
    John Salerno, Sep 29, 2006
    #3
  4. John Salerno

    Mirco Wahab Guest

    Thus spoke John Salerno (on 2006-09-29 21:13):
    > Irmen de Jong wrote:
    >> John Salerno wrote:
    >>> Ok, this is completely unnecessary so I don't intend to get into stuff
    >>> that's beyond my skill, but I'm wondering how simple it would be to
    >>> use Python to create a server that runs on my computer

    >> Why do you need to use Python for the server?

    > Well, perhaps I don't know what I'm talking about. I'm on an XP machine
    > and I just needed a way to test my web pages, and I thought Python could
    > be used to create a server to do this. But I know nothing about network
    > programming...


    My advice would be (because Apache installations on
    WinXP don't usually support Python (except pulling
    the whole thing into each CGI invocation) - download
    and install a VMWare Player
    ( http://www.vmware.com/products/player/ ),
    download a pre-built virtual machine w/Apache and
    Python preinstalled and configured (=> 190MB):
    ( http://www.rpath.org/rbuilder/project/lamp/build?id=4912 )
    and give the virtual machine a shared ip number
    on your own network card (mostly trivial) - thats it.

    Then - you can use the virtual machine as your own full
    blown web server, put your Python stuff on it (e.g. via
    Samba or SSH/SFTP, => http://winscp.net/eng/download.php -)
    and therefore don't bother w/setting up the whole thing
    yourself.


    Regards

    Mirco
    Mirco Wahab, Sep 29, 2006
    #4
  5. John Salerno

    Tim Chase Guest

    >> Why do you need to use Python for the server?
    >
    > Well, perhaps I don't know what I'm talking about. I'm on an XP machine
    > and I just needed a way to test my web pages, and I thought Python could
    > be used to create a server to do this. But I know nothing about network
    > programming...


    Well, you could investigate WebStack:

    http://www.boddie.org.uk/python/WebStack.html
    http://cheeseshop.python.org/pypi/WebStack/1.1.2

    which allows you to develop for a variety of deployment targets,
    inter alia CGI, mod_python, and BaseHTTPServer. The last is nice
    as you can run it on your local machine for testing. Then, to
    deploy to another environment, you just tweak one file (your
    adaptor file) to change from, say, BaseHTTPServer to mod_python.

    The documentation is a bit terse, and lacking in some areas, but
    a little debugging output goes a long way toward diagnosing
    problems with your code.

    In my experience, it takes targeting WebStack's abstraction
    framework rather than any of the particular platforms, but the
    portability is unbeatable.

    Just a satisfied customer of Boddie's work,

    -tkc
    Tim Chase, Sep 29, 2006
    #5
  6. John Salerno

    Mirco Wahab Guest

    Addendum (was: creating a small test server on my local computer)

    Thus spoke Mirco Wahab (on 2006-09-29 21:32):
    > Thus spoke John Salerno (on 2006-09-29 21:13):
    >> Irmen de Jong wrote:
    >>> John Salerno wrote:
    >>>> Ok, this is completely unnecessary so I don't intend to get into stuff
    >>> Why do you need to use Python for the server?

    >> Well, perhaps I don't know what I'm talking about. I'm on an XP machine

    > My advice would be (because Apache installations on
    > ...


    > download a pre-built virtual machine w/Apache and
    > Python preinstalled and configured (=> 190MB):
    > ( http://www.rpath.org/rbuilder/project/lamp/build?id=4912 )
    > and give the virtual machine a shared ip number
    > on your own network card (mostly trivial) - thats it.
    > ...


    forget this virtual appliance (above), better use
    this one:

    http://www.vmware.com/vmtn/appliances/directory/289
    [Python Web Developer Appliance]
    ...
    includes a complete set of tools for developing and
    deploying web applications using Python
    ...

    The only problem here - it's OpenBSD based ;-))

    But they have a nice documentation somewhere:
    http://www.mcguru.net/download/pyweb/pyweb-ug/index.html

    M.
    Mirco Wahab, Sep 29, 2006
    #6
  7. John Salerno

    Roger Upole Guest

    "John Salerno" <> wrote in message news:efeTg.56$...
    > Irmen de Jong wrote:
    >> John Salerno wrote:
    >>> Ok, this is completely unnecessary so I don't intend to get into stuff that's beyond my skill, but I'm wondering how simple
    >>> it would be to use Python to create a server that runs on my computer so I can test my webpages (because otherwise I have to
    >>> keep sending them to our IT person so he can upload them to the server).

    >>
    >> Why do you need to use Python for the server?

    >
    > Well, perhaps I don't know what I'm talking about. I'm on an XP machine and I just needed a way to test my web pages, and I
    > thought Python could be used to create a server to do this. But I know nothing about network programming...


    WinXP Pro has a web server that you can install from Add/Remove
    Programs in the control panel. You can use it to do Python CGI or
    ASP.

    Roger




    ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
    http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
    ----= East and West-Coast Server Farms - Total Privacy via Encryption =----
    Roger Upole, Sep 29, 2006
    #7
  8. John Salerno

    Paul Boddie Guest

    Tim Chase wrote:
    >
    > Well, you could investigate WebStack:


    [...]

    > The documentation is a bit terse, and lacking in some areas, but
    > a little debugging output goes a long way toward diagnosing
    > problems with your code.


    Suggestions for improvement are very welcome! And I do value the
    expertise of WebStack users in improving the experience of developing
    with WebStack. Right now, it seems like I have total control over the
    framework, but if people want to contribute things on a more democratic
    footing, I'd be happy to look for project hosting somewhere:
    recommendations on that topic would be welcome, of course.

    > In my experience, it takes targeting WebStack's abstraction
    > framework rather than any of the particular platforms, but the
    > portability is unbeatable.
    >
    > Just a satisfied customer of Boddie's work,


    I'm *very* pleased to hear it! :)

    I suppose I should get on with finishing off the next release, which is
    just a bunch of fixes and possibly some Django support.

    Paul
    Paul Boddie, Sep 29, 2006
    #8
  9. John Salerno

    Ant Guest

    Mirco Wahab wrote:
    > Thus spoke John Salerno (on 2006-09-29 21:13):

    ....
    > My advice would be (because Apache installations on
    > WinXP don't usually support Python (except pulling
    > the whole thing into each CGI invocation) - download
    > and install a VMWare Player


    This sounds a horribly complicated way of doing things. If you read the
    OP's post, it seems he is simply trying to serve straight HTML pages
    (but with Server Side Includes) locally for testing, rather than having
    to pester his operations guys to put them up on the company servers.

    If it's just HTML and SSI, then Apache is the easy answer on XP. The
    download is a simple .msi installer, and you'll just be able to drop
    the html files in the htdocs directory to start serving them.
    (http://httpd.apache.org/download.cgi)

    If you look at the docs for a majority of the Python webservers, they
    recommend putting them behind Apache for production use, and for good
    reason, Apache httpd is probably the most mature, stable and feature
    rich web server out there.

    (Incidentally, adding python support with mod_python is a breeze on XP
    - just another installer and uncommenting a couple of lines in the
    httpd.conf file. But then for actual python development it may be
    simpler to get started using a framework such as TurboGears or Django,
    which both have very good introductory tutorials.)
    Ant, Sep 30, 2006
    #9
  10. John Salerno

    John Salerno Guest

    Ant wrote:
    > Mirco Wahab wrote:
    >> Thus spoke John Salerno (on 2006-09-29 21:13):

    > ...
    >> My advice would be (because Apache installations on
    >> WinXP don't usually support Python (except pulling
    >> the whole thing into each CGI invocation) - download
    >> and install a VMWare Player

    >
    > This sounds a horribly complicated way of doing things. If you read the
    > OP's post, it seems he is simply trying to serve straight HTML pages
    > (but with Server Side Includes) locally for testing, rather than having
    > to pester his operations guys to put them up on the company servers.
    >
    > If it's just HTML and SSI, then Apache is the easy answer on XP. The
    > download is a simple .msi installer, and you'll just be able to drop
    > the html files in the htdocs directory to start serving them.
    > (http://httpd.apache.org/download.cgi)


    Thanks! I'll look into this.
    John Salerno, Sep 30, 2006
    #10
  11. John Salerno

    Steve Holden Guest

    John Salerno wrote:
    > Ant wrote:
    >
    >>Mirco Wahab wrote:
    >>
    >>>Thus spoke John Salerno (on 2006-09-29 21:13):

    >>
    >>...
    >>
    >>>My advice would be (because Apache installations on
    >>>WinXP don't usually support Python (except pulling
    >>>the whole thing into each CGI invocation) - download
    >>>and install a VMWare Player

    >>
    >>This sounds a horribly complicated way of doing things. If you read the
    >>OP's post, it seems he is simply trying to serve straight HTML pages
    >>(but with Server Side Includes) locally for testing, rather than having
    >>to pester his operations guys to put them up on the company servers.
    >>
    >>If it's just HTML and SSI, then Apache is the easy answer on XP. The
    >>download is a simple .msi installer, and you'll just be able to drop
    >>the html files in the htdocs directory to start serving them.
    >>(http://httpd.apache.org/download.cgi)

    >
    >
    > Thanks! I'll look into this.


    Yup, I'd second that as an approach. I have Apache on my XP system, with
    mod_python and all the trimmings.

    regards
    Steve
    --
    Steve Holden +44 150 684 7255 +1 800 494 3119
    Holden Web LLC/Ltd http://www.holdenweb.com
    Skype: holdenweb http://holdenweb.blogspot.com
    Recent Ramblings http://del.icio.us/steve.holden
    Steve Holden, Sep 30, 2006
    #11
    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. Rafael Leonhardt
    Replies:
    1
    Views:
    333
    szeying.tan
    Mar 2, 2005
  2. Replies:
    8
    Views:
    2,516
    Tom Anderson
    Nov 24, 2008
  3. Skybuck Flying

    Call oddities: &Test() vs &Test vs Test

    Skybuck Flying, Oct 4, 2009, in forum: C Programming
    Replies:
    1
    Views:
    683
    Skybuck Flying
    Oct 4, 2009
  4. Lionel Neo

    Display html on another computer instead of local computer

    Lionel Neo, Oct 11, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    222
    Robert Koritnik
    Oct 11, 2004
  5. delu
    Replies:
    1
    Views:
    104
    Ray Costanzo [MVP]
    Oct 1, 2004
Loading...

Share This Page