How to run web2py as a windows service

534 views
Skip to first unread message

Chris Leonello

unread,
Mar 25, 2008, 4:13:52 PM3/25/08
to web2py Web Framework
Has anyone been able to set up a service on windows to automatically
start/stop web2py? I have tried two approaches but have not had
success. I've tried using srvany.exe and the method described here:

http://agiletesting.blogspot.com/2005/09/running-python-script-as-windows.html

and using the pywin32 extensions along with methods described here:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/551780 and
http://docs.turbogears.org/1.0/WindowsService

To use web2py in any any type of Windows dominant Enterprise
environment, this is a must have. I can post some of my code and
issues I encountered if desired. I currently run TurboGears as a
service using the above linked recipe without any issues.

Massimo Di Pierro

unread,
Mar 25, 2008, 6:51:59 PM3/25/08
to web...@googlegroups.com
I do not know how to do this. If anybody finds out please let us know.

Massimo

limodou

unread,
Mar 25, 2008, 9:44:01 PM3/25/08
to web...@googlegroups.com
On Wed, Mar 26, 2008 at 6:51 AM, Massimo Di Pierro
<mdip...@cs.depaul.edu> wrote:
>
> I do not know how to do this. If anybody finds out please let us know.
>
> Massimo
>
For a windows service(I didn't touch it before), it has its own
command line options, and how to deal them with web2py command line
options? For example, a service can receive:

Usage: 'service.py [options] install|update|remove|start
[...]|stop|restart [...]|debug [...]'
Options for 'install' and 'update' commands only:
--username domain\username : The Username the service is to run under
--password password : The password for the username
--startup [manual|auto|disabled] : How the service starts, default = manual
--interactive : Allow the service to interact with the desktop.
--perfmonini file: .ini file to use for registering performance monitor data
--perfmondll file: .dll file to use when querying the service for
performance data, default = perfmondata.dll
Options for 'start' and 'stop' commands only:
--wait seconds: Wait for the service to actually start or stop.
If you specify --wait with the 'stop' option, the service
and all dependent services will be stopped, each waiting
the specified period.

So I suggest that the startup parameters of web2py can be saved in an
ini file, so we can write a wrap of service and invoke web2py server.
So this ini file can be read by this wrap program or web2py itself.
Which one is better? I would like the later. And we will have two ways
to get the startup arguments: 1) from ini 2)from command line

And we can read ini first, then if there are command line options, we
can use them to overwrite the ini options.

But for now, we may found that there are different action according the options:

1) command line mode
2) GUI mode
3) Shell mode
4) execute program in an app environment
5) service mode

So if we need an action parameter in the command line? Just like:

web2py [options] start
web2py [options] gui
web2py [options] shell
web2py [options] execute
web2py [options] service

I didn't think very clearly, how about others opinions?

--
I like python!
UliPad <<The Python Editor>>: http://code.google.com/p/ulipad/
meide <<wxPython UI module>>: http://code.google.com/p/meide/
My Blog: http://www.donews.net/limodou

Massimo Di Pierro

unread,
Mar 25, 2008, 9:53:15 PM3/25/08
to web...@googlegroups.com
I need to sleep on this. Seems too much windows specific .

Massimo

carlo

unread,
Mar 26, 2008, 10:12:17 AM3/26/08
to web2py Web Framework
at the moment I am using FireDaemon to set web2py as a service for a
win2003 server with no problem.

carlo

Chris Leonello

unread,
Mar 26, 2008, 10:39:03 AM3/26/08
to web2py Web Framework
I also prefer the latter approach. The former approach, wrapping the
web2py command line executable, would be similar to the approach using
srvany.exe. srvany.exe allows Windows, theoretically, to run any
command line application as a service. So, you wrap your command line
program in a batch file that would look like:

C:\Python25\python.exe C:\proj\web2py-trunk\web2py.py -a "password" -p
8001

And configure your service to run srvany.exe with parameters to launch
your batch file.

In general I don't think this approach offers the reliability and
scalability of the latter approach. The latter approach is more like
"native" service support which any web framework should have (If only
because, in the end, everything has to run on Windows at some point).
Also, srvany.exe in particular doesn't look to be completely supported
on XP SP2 and Vista and gave me some problems.

I tried implementing something similar to a native web2py service. I
didn't use an ini file, although an ini file is the way to go. I
hacked the start() method of widget.py to allow an options object to
be passed in. Then, instead of starting web2py directly, I created a
service object which inherits from win32serviceutil.ServiceFramework
and that object starts and stops web2py. I borrowed heavily from the
turbogears service code and it looked like this:

===========================
# File name: service.py

import sys
import os
from os.path import *
import socket

import win32serviceutil
import win32service
import win32api
from win32com.client import constants

class Web2pyWindowsService(win32serviceutil.ServiceFramework):
"""Windows Service helper class."""

current_dir = os.path.split(__file__)[0]


_svc_name_ = 'Web2pyServer' # The name of the service.
_svc_display_name_ = 'Web2pyServer' # The Service Manager
display name.
code_dir = current_dir # The base directory of the
TG app code.
stdErrOutDir = r'' # The log directory for
the stderr and
# stdout logs. Default =
code_dir.

class opts(object):
password = 'password'
ip = '127.0.0.1'
port = '7111'
pid_filename = '7111htttpserver.pid'
log_filename = '7111httpserver.log'
ssl_certificate = ''
ssl_private_key = ''
folder = 'C:\\proj\\web2py-trunk\\'
server_name = 'myserver'

# -- END USER EDIT SECTION

options = opts()

def SvcDoRun(self):
""" Called when the Windows Service runs. """

self.ReportServiceStatus(win32service.SERVICE_START_PENDING)
self.web2py_init()
self.web2pyStart(Web2pyWindowsService.options)
self.ReportServiceStatus(win32service.SERVICE_RUNNING)

win32event.WaitForSingleObject(Web2pyWindowsService.stop_event,
win32event.INFINITE)


def SvcStop(self):
"""Called when Windows receives a service stop request."""

self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
f = open(join(Web2pyWindowsService.options.folder,
Web2pyWindowsService.options.pid_filename), 'r')
pid = int(f.readline().strip())
win32api.TerminateProcess(pid,0)
self.ReportServiceStatus(win32service.SERVICE_STOPPED)

def web2py_init(self):
""" Checks for the required data and initializes the
application. """

if not Web2pyWindowsService.stdErrOutDir:
Web2pyWindowsService.stdErrOutDir = '.'

if Web2pyWindowsService.code_dir:
os.chdir(Web2pyWindowsService.code_dir)
sys.path.append(Web2pyWindowsService.code_dir)
# Redirect stdout and stderr to avoid buffer
crashes.
sys.stdout = open(join(Web2pyWindowsService.stdErrOutDir,
'stdout.log'),'a')
sys.stderr = open(join(Web2pyWindowsService.stdErrOutDir,
'stderr.log'),'a')

import gluon.import_all
from gluon.widget import start

self.web2pyStart = start

else:
raise ValueError("""The code directory setting is missing.
The Windows Service will not run
without this setting.""")

if __name__ == '__main__':
# The following are the most common command-line arguments that
are used
# with this module:
# service.py install (Installs the service with manual startup)
# service.py --startup auto install (Installs the service with
auto startup)
# service.py start (Starts the service)
# service.py stop (Stops the service)
# service.py remove (Removes the service)
#
# For a full list of arguments, simply type "service.py".
win32serviceutil.HandleCommandLine(Web2pyWindowsService)
======================================================

However, this doesn't completely work. The windows service manager
would give an error during start up. Although the service was running,
I could only connect from the local machine. Obviously, this isn't my
forte and I didn't have time to do it right from the ground up. I
hope it helps in some way.

Also, I had to comment out the forced check for new versions in the
index() function of admin/controllers/default.py. This really isn't
appropriate in a corporate server environment and it hangs for a
looooonnnnngggg time if your behind a proxy which requires
authentication.

On Mar 25, 9:44 pm, limodou <limo...@gmail.com> wrote:

Chris Leonello

unread,
Mar 26, 2008, 10:46:57 AM3/26/08
to web2py Web Framework
I had not seen FireDaemon before, thanks for the tip!

It is commercial software, though.

limodou

unread,
Mar 26, 2008, 11:12:26 AM3/26/08
to web...@googlegroups.com
On Wed, Mar 26, 2008 at 10:46 PM, Chris Leonello
<chris.l...@gmail.com> wrote:
>
> I had not seen FireDaemon before, thanks for the tip!
>
> It is commercial software, though.
>
I also tried to write a service, the most work is almost complete, but I found:

1. Working path is not correct, when I start the server, the path is
in lib/site-package/win32, so I had to get the real web2py path from
register.
2. I'm working on python 2.4, and if I use http://localhost:8000 I'll
get an error, it'll say that Admin is disabled because unsecure
channel, and I check the code:

if remote_addr not in (http_host, socket.gethostname()):
raise HTTP(200,'Admin is disabled because unsecure channel')

and I found 127.0.0.1 is not be treated the same as localhost

and before I found this problem, I also found that:

except BaseException, exception:

because I'm using python 2.4 version, so there is no BaseException
defined(main.py 260), so the admin will raise an ticket, and when I
click it, it'll raise a new one, so the ticket will fall into infinite
loop, and also BaseException in restricted.py 63. And If I removed
BaseException, so I found exception is not right at all, maybe it's a
typo?

ygao

unread,
Mar 26, 2008, 11:17:17 AM3/26/08
to web...@googlegroups.com
web2py must use python 2.5 at least.
some code syntax for python 2.5 like:
1 if x else 2.will also have in it.
--
※※※※※※※※※※※※※※※※※※※※※※※※
My blog:  http://blog.donews.com/ygao
Forum    http://groups.google.com/group/python_study
※※※※※※※※※※※※※※※※※※※※※※※※

Massimo Di Pierro

unread,
Mar 26, 2008, 11:25:41 AM3/26/08
to web...@googlegroups.com
Hope the following code is of  any help. It needs some work. Run it with:

python WindowsService.py install

python WindowsService.py start

Options should be read from ini file but they are not. Read commented lines.

BaseException is defined in 2.5 and I assumed it was defined in 2.4 too but I was wrong. If you use 2.4 just replace it with Exception.

Massimo


-------- WindowsService.py ------------
import win32serviceutil
import win32service
import win32event
import os
from gluon.main import HttpServer

class Web2pyService(win32serviceutil.ServiceFramework):
    """NT Service."""

    _svc_name_ = "web2pyService"
    _svc_display_name_ = "web2py Service"

    def __init__(self, args):
        win32serviceutil.ServiceFramework.__init__(self, args)
        self.stop_event = win32event.CreateEvent(None, 0, 0, None)

    def SvcDoRun(self):
        working_folder='c:/web2py/'  ### edit this
        os.chdir(working_folder)
        options=dict(ip="127.0.0.1",port=8000) ### should read from file!
        self.server=HttpServer(**options)
        self.server.start()
        win32event.WaitForSingleObject(self.stop_event, win32event.INFINITE)

    def SvcStop(self):
        self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
        self.server.stop()
        win32event.SetEvent(self.stop_event)

if __name__ == '__main__':
    win32serviceutil.HandleCommandLine(Web2pyService)
--------

Massimo Di Pierro

unread,
Mar 26, 2008, 11:28:32 AM3/26/08
to web...@googlegroups.com
Except for the use of BaseException I have tried to make web2py compatible with 2.4 since version 1.22.
I do not say that publicly because users may use python 2.5 syntax in apps.
The syntax you refer too is gone from the source code.

Massimo

Chris Leonello

unread,
Mar 26, 2008, 11:31:19 AM3/26/08
to web2py Web Framework
Will try. Thanks Massimo & limodou! Your prompt response is always
appreciated.

On Mar 26, 11:25 am, Massimo Di Pierro <mdipie...@cs.depaul.edu>
wrote:
> > 2. I'm working on python 2.4, and if I usehttp://localhost:8000I'll

Massimo Di Pierro

unread,
Mar 26, 2008, 11:33:56 AM3/26/08
to web...@googlegroups.com
The great thing is we have enough expert users to cover every time-zone!

Massimo

Chris Leonello

unread,
Mar 26, 2008, 1:31:34 PM3/26/08
to web2py Web Framework
With WindowsService.py, the service starts normally, but no pages are
served. All I get are "Invalid Request" messages in the browser and
the httpserver.log shows 400 error codes.

On Mar 26, 11:33 am, Massimo Di Pierro <mdipie...@cs.depaul.edu>

Massimo Di Pierro

unread,
Mar 26, 2008, 1:49:41 PM3/26/08
to web...@googlegroups.com
did you edit the path line?

Chris Leonello

unread,
Mar 26, 2008, 2:24:04 PM3/26/08
to web2py Web Framework
Yes, I did.

Chris Leonello

unread,
Mar 26, 2008, 3:22:09 PM3/26/08
to web2py Web Framework
There is one modification to WindowsService.py to make it work:

options=dict(ip="127.0.0.1",port=8000)

needs to also have the path option set:

options=dict(ip="127.0.0.1",port=8001, path=working_folder)

With this change it worked!

Massimo Di Pierro

unread,
Mar 26, 2008, 5:48:05 PM3/26/08
to web...@googlegroups.com
Thanks!

We need a more general strategy (interface) to configure and setup
web2py as service cross-platform, including HTTPS.

Does anybody has a script to setup a service under OSX and/or Linux?

Massimo

limodou

unread,
Mar 26, 2008, 8:45:57 PM3/26/08
to web...@googlegroups.com
On Wed, Mar 26, 2008 at 11:17 PM, ygao <ygao...@gmail.com> wrote:
> web2py must use python 2.5 at least.
> some code syntax for python 2.5 like:
> 1 if x else 2.will also have in it.
>
I know that but massimo has change some core code in order to be
compatible with 2.4 version, except for some appliances.

limodou

unread,
Mar 26, 2008, 9:26:23 PM3/26/08
to web...@googlegroups.com
On Thu, Mar 27, 2008 at 3:22 AM, Chris Leonello
<chris.l...@gmail.com> wrote:
>
> There is one modification to WindowsService.py to make it work:
>
>
> options=dict(ip="127.0.0.1",port=8000)
>
> needs to also have the path option set:
>
> options=dict(ip="127.0.0.1",port=8001, path=working_folder)
>
> With this change it worked!
>
here is my patch.

1. Modifed main.py and restricted.py, change BaseException, exception
to Exception
2. Add service.py, so you can :

python service.py install
python service.py start
python service.py stop

3. add options.py, and save command line options in the model, it's
very easy to change
4. try to find working path in register with:

try:
import _winreg
h = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,
r'SYSTEM\CurrentControlSet\Services\web2py')
cls = _winreg.QueryValue(h, 'PythonClass')
dir = os.path.dirname(cls)
os.chdir(dir)
except:
self.log("Cann't change to web2py working path, server is stopped")
return

and here "web2py" is define in _svc_name_ of Web2pyService class.

And another question:

in admin/default.py controller:

http_host = request.env.http_host.split(':')[0]
remote_addr = request.env.remote_addr


if remote_addr not in (http_host, socket.gethostname()):
raise HTTP(200,'Admin is disabled because unsecure channel')

and If I use "localhost" it'll raise the exception. So how to support localhost?

service.diff

niccolo

unread,
Mar 26, 2008, 10:45:05 PM3/26/08
to web2py Web Framework
I think the old but tested edna code might come in handy. It is
simple and with scripts that work in both win32 and linux. I've been
using it for years without problem.

http://downloads.sourceforge.net/edna/edna-0.6.tar.gz?modtime=1142088701&big_mirror=0

Massimo Di Pierro

unread,
Mar 26, 2008, 11:03:43 PM3/26/08
to web...@googlegroups.com
Limodou,

check in trunk. I renamed your service to gluon/winservice.py and now
you can use it as

python web2py.py -W install/start/stop

and once compiled

web2py.exe -W install/start/stop

Could you please try? I do not have windows today.

I would like a way to specify the name of the options file so that it
is used by widget if not running as service.

web2py.py -L options.py

would you be able to add that? Do not use import, use exec('import')
as in winservice otherwise it messes up py2exe and py2app.

No idea about the localhost issue.

Massimo

> <service.diff>

Massimo Di Pierro

unread,
Mar 26, 2008, 11:08:12 PM3/26/08
to web...@googlegroups.com
I think for windows we are set. This is the edna script for Linux
edna
edna

limodou

unread,
Mar 27, 2008, 2:31:13 AM3/27/08
to web...@googlegroups.com
On Thu, Mar 27, 2008 at 11:03 AM, Massimo Di Pierro
<mdip...@cs.depaul.edu> wrote:
>
> Limodou,
>
> check in trunk. I renamed your service to gluon/winservice.py and now
> you can use it as
>
> python web2py.py -W install/start/stop
>
> and once compiled
>
> web2py.exe -W install/start/stop
>
> Could you please try? I do not have windows today.
>
> I would like a way to specify the name of the options file so that it
> is used by widget if not running as service.
>
> web2py.py -L options.py
>
> would you be able to add that? Do not use import, use exec('import')
> as in winservice otherwise it messes up py2exe and py2app.
>
> No idea about the localhost issue.
>
> Massimo
>
1. Fix bugs on windows
2. Add -L --config option
3. Usage:

python web2py.py -W install [-L options]
python web2py.py -W start [-L options]
python web2py.py -W stop

You can specify -L when install or start windows service, and if you
start service with -L option, it'll install the service again, then
start the service.

Default config file is options.py

4. Add option_std.py as a template

service.diff

Massimo Di Pierro

unread,
Mar 27, 2008, 3:21:36 AM3/27/08
to web...@googlegroups.com
Thank you Limodou.

your corrections are in trunk but:

this has to stay because without try... except it may break on linux/osx

-try:
- from gluon.winservice import web2py_windows_service_handler
-except: pass

"web2py" should not be capitalized. The name is always lower case.

I am not sure what this does

path = os.path.dirname(__file__)

when running the binary versions. We need to try it. What is
classtring for? Does it need to be path dependent?

Does winservice.py makes any sense without an installer? I think we
need a windows installer that installs web2py, ulipad, a hook to the
shell, two services (80, 443) and packages a nice windows menu to
run this all.

Massimo

> <service.diff>

limodou

unread,
Mar 27, 2008, 6:25:03 AM3/27/08
to web...@googlegroups.com
On Thu, Mar 27, 2008 at 3:21 PM, Massimo Di Pierro
<mdip...@cs.depaul.edu> wrote:
>
> Thank you Limodou.
>
> your corrections are in trunk but:
>
> this has to stay because without try... except it may break on linux/osx
>
> -try:
> - from gluon.winservice import web2py_windows_service_handler
> -except: pass

Just for testing.


>
> "web2py" should not be capitalized. The name is always lower case.
>
> I am not sure what this does
>
> path = os.path.dirname(__file__)
>
> when running the binary versions. We need to try it. What is
> classtring for? Does it need to be path dependent?

I don't know if the binary can be used. Because PythonService.exe will
register python class, so if you use binary, I don't know how to let
PythonService.exe to get the python class. And for __file__, I just
want to know the service class's file path, so I can set the right
serviceClassString. Because if you invoke
win32serviceutil.HandleCommandLine via importing the module, the class
path will be like:

gluon.winservice.Web2pyService

So you can see it's not a absolute path, and PythonService.exe will
not get the right class because the directory is not right, it'll be
lib/site-packages/win32, so I process __file__ just want to ensure the
serviceClassString can be absolute path.

> Does it need to be path dependent?

I think so. Of cause just according my testing.

>
> Does winservice.py makes any sense without an installer? I think we
> need a windows installer that installs web2py, ulipad, a hook to the
> shell, two services (80, 443) and packages a nice windows menu to
> run this all.
>

I have no idea about it know. Because I often use source version, and
it'll be easy to implement what you want.

ygao

unread,
Mar 27, 2008, 6:55:04 AM3/27/08
to web...@googlegroups.com
On Thu, Mar 27, 2008 at 3:21 PM, Massimo Di Pierro <mdip...@cs.depaul.edu> wrote:

Thank you Limodou.

your corrections are in trunk but:

this has to stay because without try... except it may break on linux/osx

   -try:
   -    from gluon.winservice import web2py_windows_service_handler
   -except: pass

"web2py" should not be capitalized. The name is always lower case.

I am not sure what this does

   path = os.path.dirname(__file__)

when running the binary versions. We need to try it. What is
classtring for? Does it need to be path dependent?

Does winservice.py makes any sense without an installer? I think we
need a windows installer that installs web2py, ulipad, a hook to the
shell,  two services (80, 443) and packages a nice windows menu to
run this all.
this function like debuging web2py app,it's too complex to implement.
web2py and ulipad every need  create  a thread,so doing this may not block themselves...


Forum http://groups.google.com/group/python_study
※※※※※※※※※※※※※※※※※※※※※※※※

ygao

unread,
Mar 27, 2008, 7:05:33 AM3/27/08
to web...@googlegroups.com
Massimo,
if you don't care about web2py blocking itself when using shell
see my blog,you can see two picture ,and that is what's you mean?.


--
※※※※※※※※※※※※※※※※※※※※※※※※
My blog: http://blog.donews.com/ygao
Forum http://groups.google.com/group/python_study
※※※※※※※※※※※※※※※※※※※※※※※※

Chris Leonello

unread,
Mar 27, 2008, 9:46:15 AM3/27/08
to web2py Web Framework
On Mar 27, 3:21 am, Massimo Di Pierro <mdipie...@cs.depaul.edu> wrote:

> Does winservice.py makes any sense without an installer? I think we
> need a windows installer that installs web2py, ulipad, a hook to the
> shell, two services (80, 443) and packages a nice windows menu to
> run this all.

FWIW, when I deploy on a Windows server, I actually prefer the level
of no-frills control offered by a basic script like
WindowsService.py. For deployment, easy customization is key. I
don't need ulipad (this is a server, not a user machine), a nice
windows menu (no users are going to see a menu), and default services
running under ports 80 and 443 (everything runs behind apache). You
hit the nail on the head with a Windows installer and all the goodies
for a development machine. Just don't overlook deployment where the
needs are different.

BTW, great job coming up with a windows service solution so quickly!



Massimo Di Pierro

unread,
Mar 27, 2008, 10:55:47 AM3/27/08
to web...@googlegroups.com
Just want to reassure you.
The main target is and remains unix servers and my main interest is
large projects. Anyway, if we can make it easier for windows users at
no cost, we'll try.
There will not be any compromise on scalability and portability
because of windows.

Massimo

Massimo Di Pierro

unread,
Mar 27, 2008, 11:19:30 AM3/27/08
to web...@googlegroups.com
sorry, I do not understand.

Massimo

Massimo Di Pierro

unread,
Mar 27, 2008, 1:21:46 PM3/27/08
to web...@googlegroups.com
At least the service name has to include the port number so that
people can run HTTP and HTTPS concurrently.

Massimo

niccolo

unread,
Mar 27, 2008, 1:36:23 PM3/27/08
to web2py Web Framework
I share the concerns of Chris too. What makes web2py unique is its
elegance, portability, small size, and lack of never ending
dependency. Kind of the little guy that could.

I develop on Window and Linux, but only deploy on Linux. Window
installer always scares the hell out of me.

Niccolo

Massimo Di Pierro

unread,
Mar 27, 2008, 2:41:23 PM3/27/08
to web...@googlegroups.com
This is a misunderstanding. The "no installation required" is a
selling feature of web2py an it will never go away. I hate installers
myself and I do not use windows if am not forced to.

Rest assured the windows version will continue to be without an
installer.

I am just suggesting that perhaps there should be a second windows
distribution that packages more stuff, including third party stuff,
which may require installation.
I am not going to maintain this but if windows users think it is
valuable and somebody is willing to work on it, I do not mind posting
it.

Massimo

Chris Leonello

unread,
Mar 27, 2008, 4:47:02 PM3/27/08
to web2py Web Framework


On Mar 27, 2:41 pm, Massimo Di Pierro <mdipie...@cs.depaul.edu>
wrote:
> ...I hate installers
> myself and I do not use windows if am not forced to.

Me too ;-) Unfortunately, I have to deploy to Windows.


>
> Rest assured the windows version will continue to be without an
> installer.
>
> I am just suggesting that perhaps there should be a second windows
> distribution that packages more stuff, including third party stuff,
> which may require installation.
> I am not going to maintain this but if windows users think it is
> valuable and somebody is willing to work on it, I do not mind posting
> it.

Sound like a good approach. I like the ability to download a release
of web2py from svn, edit some settings in a script or configuration
file, install the service and let it go on autopilot. The windows exe
file with a gui requiring a port, password, etc. is great for the
person developing on Windows (I don't develop on Windows), but serve
no purpose to the person who has to deploy on Windows. Anyway, I
think I misunderstood what you were suggesting. Sorry for the
confusion.

In any case, don't underestimate the prevalence of Windows machines
that would serve web2py apps. Windows is HUGE in the U.S. corporate
market.

Massimo Di Pierro

unread,
Mar 27, 2008, 5:27:46 PM3/27/08
to web...@googlegroups.com
I agree. In fact even if web2py is not going to change we still want to compete with ASP and some ASP users tend to confuse the development environment with the framework itself. I see this in my classes all the time. That is why there is a value in providing an alternative (corporate) packaging for web2py.

We should do the same with linux and provide a VMWare appliance with everything you need pre-configured and accessible via the posted sysamdin appliance. I had a student working on this, perhaps he can comment on it.

Massimo

carlo

unread,
Mar 28, 2008, 7:00:10 AM3/28/08
to web2py Web Framework
Windows server is HUGE in Italy too and I just deployed a small web2py
app in a company.
At the moment it is not that easy. My two cents:

- install web2py as a service ( I have still to test your latest
solution)
- options in an easy way
- no welcome app launch by default
- no initial GUI (maybe differentiating a development source and a
deployment package)

carlo

limodou

unread,
Mar 28, 2008, 8:23:17 AM3/28/08
to web...@googlegroups.com
On Fri, Mar 28, 2008 at 7:00 PM, carlo <syse...@gmail.com> wrote:
>
> Windows server is HUGE in Italy too and I just deployed a small web2py
> app in a company.
> At the moment it is not that easy. My two cents:
>
> - install web2py as a service ( I have still to test your latest
> solution)

python web2py.py -W install
python web2py.py -W start

And you need copy options_std.py to options.py, and change some option
values before you start the service.

> - options in an easy way

just like what I've written above, and you can still use command line
options and save it as a bat file.

python web2py.py -a password

> - no welcome app launch by default

See this thread:
http://groups.google.com/group/web2py/browse_thread/thread/7854353eb6d6bab9/f0071bf800c1fdde#f0071bf800c1fdde

> - no initial GUI (maybe differentiating a development source and a

use command line option -a password.

> deployment package)
>
Don't understand very much.

Chris Leonello

unread,
Mar 28, 2008, 9:58:23 AM3/28/08
to web2py Web Framework
On Mar 27, 5:27 pm, Massimo Di Pierro <mdipie...@cs.depaul.edu> wrote:
> I agree. In fact even if web2py is not going to change we still want
> to compete with ASP...

Great! In the last 6 years or so I've been through Zope, Django,
TurboGears, Ruby on Rails, TomCat/JSP, Pylons and now picking up
web2py. My comments are because I want to see it succeed and grow.
To do so, you won't be able to overlook the guys in the field who have
to deploy on Windows. When you put together the "WindowsService.py"
script, that was all I needed. I'm a happy camper!

> ... and some ASP users tend to confuse the
> development environment with the framework itself. I see this in my
> classes all the time. That is why there is a value in providing an
> alternative (corporate) packaging for web2py.

Just to clarify, by deployment I mean deploying a specific web
application, not the deployment of web2py for developers to use to
develop applications. My users are end users and don't know or care
if it is web2py, ASP, or whatever.

When I speak of development, I mean a small group of developers who
use their own editors, database tools, etc. to develop applications on
top of the framework.

Keep up the excellent work! I've prototyped and will be launching an
important web based app in a large corporate environment (on Windows)
with web2py, so your help is greatly appreciated!

carlo

unread,
Mar 28, 2008, 10:18:10 AM3/28/08
to web2py Web Framework
On 28 Mar, 13:23, limodou <limo...@gmail.com> wrote:

> python web2py.py -W install
> python web2py.py -W start

just tried this, it is a great improvement.

> And you need copy options_std.py to options.py, and change some option
> values before you start the service.
>
> > - options in an easy way

yes I tested ok.

> just like what I've written above, and you can still use command line
> options and save it as a bat file.

bat file it is not a brilliant solution in a windows environment

> python web2py.py -a password

not for deployment

>
> > - no welcome app launch by default
>
> See this thread:http://groups.google.com/group/web2py/browse_thread/thread/7854353eb6...

I'll check it up

> > - no initial GUI (maybe differentiating a development source and a
>
> use command line option -a password.

of course but not for deployment

> > deployment package)
>
> Don't understand very much.

what I meant is that I see little use of having a windows/osx package
and a GUI start up: a developer will use the source distro and set a
bat file to bypass the initial window and the automatic launch of the
browser to the welcome page.
To deploy, the windows service is perfect, not other needs in a small
environment.
I do not know if the web2py.exe can also be installed as a windows
service+options because in this case you could deploy without
installing Pyhton sources which could be fine in some environments.

carlo

carlo

unread,
Mar 28, 2008, 10:24:30 AM3/28/08
to web2py Web Framework
totally with you.

carlo

On 28 Mar, 14:58, Chris Leonello <chris.leone...@gmail.com> wrote:
> On Mar 27, 5:27 pm, Massimo Di Pierro <mdipie...@cs.depaul.edu> wrote:
>
> > I agree. In fact even if web2py is not going to change we still want
> > to compete with ASP...
>
> Great! In the last 6 years or so I've been through Zope, Django,
> TurboGears, Ruby on Rails, TomCat/JSP, Pylons and now picking up
> web2py. My comments are because I want to see it succeed and grow.
> To do so, you won't be able to overlook the guys in the field who have
> todeployon Windows. When you put together the "WindowsService.py"

carlo

unread,
Mar 28, 2008, 10:30:04 AM3/28/08
to web2py Web Framework
> Sound like a good approach. I like the ability to download a release
> of web2py from svn, edit some settings in a script or configuration
> file, install the service and let it go on autopilot. The windows exe
> file with a gui requiring a port, password, etc. is great for the
> person developing on Windows (I don't develop on Windows), but serve
> no purpose to the person who has todeployon Windows.

I agree, I would just say that even for a developer on Windows I do
not see much value in having the web2py exe file and a gui etc because
you certainly have Python sources installed.

carlo









.

Massimo Di Pierro

unread,
Mar 28, 2008, 12:06:59 PM3/28/08
to web...@googlegroups.com
Congratulations!
You can do all you say by using command line options

python web2py.py -h

and removing the applications/welcome folder.
Perhaps I misunderstood your suggestion.

Massimo

Massimo Di Pierro

unread,
Mar 28, 2008, 12:10:54 PM3/28/08
to web...@googlegroups.com
Notice that

-a '<recycle>'

or on windows

-a "<recycle>"

will reuse the previous password

Massimo

Massimo Di Pierro

unread,
Mar 28, 2008, 12:12:30 PM3/28/08
to web...@googlegroups.com
Thanks you Chris.
If you make your app public let us know. We all look forward to see it.

Massimo

carlo

unread,
Mar 28, 2008, 2:06:25 PM3/28/08
to web2py Web Framework
yes Massimo maybe you misunderstood.

As Chris pointed out better than I will, we have to separate deploy
and developing: when you deploy your app you can not ask end users to
type "python web2py.py -h" nor you can leave them with a bat file.
What they want is just typing an address in the browser and start
using the app they need (and they payed for): in this respect the new
Windows Service script with -L options is simply perfect and I am not
complaining here :-); before this script I used FireDaemon which is
commercial software. I think that the deploy on windows needs nothing
else, no installer etc. Just one thing maybe: if the WindowsService
script were functional with web2py.exe you could even escaping from
installing Python sources and that could be a benefit in some cases.

carlo

Massimo Di Pierro

unread,
Mar 28, 2008, 4:31:50 PM3/28/08
to web...@googlegroups.com
It will work with web2py.exe in version 1.28.

Massimo

yarko

unread,
Mar 28, 2008, 4:39:46 PM3/28/08
to web2py Web Framework
I would just chime in for uniform support of servers...

In my corp. environ, there are supported servers. It took me >
7months to get a server containing "business critical data" approved
& deployed... painful, so I tend to stick with whatever servers there
already are in place.

The benefit of Python: I shouldn't care what the server platform is
(a little harder - considering mobile devices - to completely not care
what the target client is). In either case, the more I can focus on
the solution, and it's creation, and the less on what I have to
deliver it on (and to some extent to), .... well, the more the results
will reflect that ;-)

I've still not invested much into learning about creating with web2py
- I must make a decision in days ahead.

Even so, glad to see deployment on windows taken seriously, and I echo
& mirror the comments about development not needing an executable
(useful for learning, yes - easy, like "InstantRails"; but rails is...
more... well, doesn't seem as useful for web2py development). I
instinctively can see the benefits of deploying an executable in a
windows server environment too.

yarko.

carlo

unread,
Mar 29, 2008, 4:17:42 AM3/29/08
to web2py Web Framework

carlo

unread,
Mar 29, 2008, 4:30:13 AM3/29/08
to web2py Web Framework
agree particularly with:

> & mirror the comments about development not needing an executable
> (useful for learning, yes - easy, like "InstantRails"; but rails is...
> more... well, doesn't seem as useful for web2py development).

suppose that the "better than InstantRails" slogan lead to some
choices good for the marketing and this is good if this can contribute
to web2py success.
It is also interesting that the web2py exe will outcome to be a great
utility in a server environment more than in the developer ground: I
do not remind of any python framework which can be deployed in a
windows server without installing Python sources and probably web2py
will be the first.Hope this can be another key for web2py success.

On 28 Mar, 21:39, yarko <yark...@gmail.com> wrote:

Massimo Di Pierro

unread,
Apr 1, 2008, 9:12:35 PM4/1/08
to web...@googlegroups.com
Hi Limodou,

If you have time, could you please check and eventually correct/
extend this:

http://mdp.cti.depaul.edu/AlterEgo/default/show/77

Massimo

limodou

unread,
Apr 1, 2008, 11:42:55 PM4/1/08
to web...@googlegroups.com
On Wed, Apr 2, 2008 at 9:12 AM, Massimo Di Pierro
<mdip...@cs.depaul.edu> wrote:
>
> Hi Limodou,
>
> If you have time, could you please check and eventually correct/
> extend this:
>
> http://mdp.cti.depaul.edu/AlterEgo/default/show/77
>
> Massimo
>
Ok, I'll check it. you are welcome.

limodou

unread,
Apr 2, 2008, 1:07:52 AM4/2/08
to web...@googlegroups.com
On Wed, Apr 2, 2008 at 11:42 AM, limodou <lim...@gmail.com> wrote:
> On Wed, Apr 2, 2008 at 9:12 AM, Massimo Di Pierro
>
> <mdip...@cs.depaul.edu> wrote:
> >
>
> > Hi Limodou,
> >
> > If you have time, could you please check and eventually correct/
> > extend this:
> >
> > http://mdp.cti.depaul.edu/AlterEgo/default/show/77
> >
> > Massimo
> >
> Ok, I'll check it. you are welcome.
>

I changed some words, and you can review them.

Massimo Di Pierro

unread,
Apr 2, 2008, 1:21:38 AM4/2/08
to web...@googlegroups.com
Thank you.

Massimo

Reply all
Reply to author
Forward
0 new messages