Iceberg
unread,Mar 22, 2009, 9:50:01 PM3/22/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to web2py Web Framework
Hi Massimo,
At least in Windows platform, when one "web2py -i 0.0.0.0 -p 8000"
process in running, I noticed that local administrator can still start
another "web2py -i 0.0.0.0 -p 8000" process without any error message,
but of course the second web2py process can not accept any request. So
I suggest to add some detect code at the beginning of web2py
launching. Something like this:
def __main__():
# parse commandline and get the bindIP and bindPort, then
detectAddr = '127.0.0.1' if bindIP=='0.0.0.0' else bindIP
try: urllib.urlopen('http://%s:%s'% (detectAddr, bindPort)).read()
except IOError: pass # the bindAddr and bindPort is vacant
else: sys.exit('%s:%s is occupied'%(detectAddr,bindPort))
...... # Go on to start web2py main process
This code can let novice make fewer mistakes.
Regards,
Iceberg