If you are running OS X or some other nix like OS you can use the GUI
in which case you need to type your administrative password or you can
go without the GUI in which case you need to manually point your
browser to the correct location.

You can have both with these two collections of commands run at the
command line. The first is to start up, the second to shut down.

# STARTUP
# First we launch web2py, assign password "test" and run on port 8000
# Then we save our PID (process ID) to a text file to use later when
we want to shut down
# Next we take a short snooze for dramatic effect and to make sure
Web2py is up and running (2 seconds, not bad my friends....)
# Finally we launch a new tab in Firefox with our website. The example
here works for OS X, you can figure out what it is for your OS

python web2py.py -a test -p 8000&   # launch web2py as process in
background
echo $! > PID.TXT&                  # use $! var to get last PID
started, save to file PID.TXT
sleep 2                             # take a short nap ...zzzzz
open -a /Applications/Firefox.app/Contents/MacOS/firefox-bin
http://127.0.0.1:8000/&;                    # open firefox tab


# SHUTDOWN
# first we cat the contents of our PID.TXT file and send the output
the the variable called "pid"
# Next we run the kill command using the var containing our PID

pid=`cat PID.TXT`                   # grab our web2py PID
kill -KILL $pid                          # kill the PID


Reply via email to