web2py -f option

112 views
Skip to first unread message

Niphlod

unread,
Nov 25, 2015, 5:12:32 PM11/25/15
to web2py-developers
Partly encouraged by this https://groups.google.com/d/msg/web2py/_OSbms5VXRs/DRsp0fJdBgAJ , I fixed widget.py code here and there to correctly pick up the -f option.
Yes, we have one, but was lagging behind.

Oddly enough, half an hour later I fixed most of it (I really thought I had to spend more time into it).

This enables a simple (enough) trick.

On windows, you can create a dir. Put a web2py.bat in it containing

python thepathto\web2py.py -f %~dp0 %*


AND a folder, named "applications", containing your apps.
You can then cd into that dir, and launch, e.g.
webp2y.bat -a mypassword
or
web2py.bat -K myappname
or
------ well, you got it.
dos makes it easy because %~dp0 is the dir where the bat lives, while %* are all arguments passed to it.

Unixy-like should create a web2py.sh containing something like (not tested)
MY_PATH="`dirname \"$0\"`"              # relative
MY_PATH
="`( cd \"$MY_PATH\" && pwd )`"  # absolutized and normalized
python web2py
.py -f "$MY_PATH" "$@"

Issues (so far):
- cron, oldcron, newcron untested. I'm not sure I'll ever be in a right state of mind either to test it or to fix the code 
- widget (grrr) updates the canvas at the bottom looking at a fixed httpserver.log. Fixed!
- latest releases don't do this step https://github.com/web2py/web2py/blob/master/gluon/widget.py#L1120 at all. Changing the correct pointer to logging.example.conf fixes the issues, but it creates another. In logging example, verbatim, a rotating log is created in a subdirectory, that can very well not exist. Either we fix logging.example to log to web2py.log instead of logs/web2py.log, or we need to create a "logs" directory in the current one
- widget can't correctly launch scheduler processes from the menu. A big ##FIXME later, if -f is found, no scheduler menu is created :-P


BTW: I remember someone talking about packaging web2py. Latest attempt resulted in copying over a tar(red) env here and there. Ugly to say the least, and unmaintained from day 2.

This would be the right occasion to chime in, because the fixed code should - at least - enable some kind of package "script", e.g. "web2py launcher" to, basically:
- determine the current absolute path
- launch web2py.py -f that_path
- pass along any other parameter
which is arguably EASIER to write in python than ask to drop weird stuff in your app's dir
 
What do you think ?

Massimo DiPierro

unread,
Dec 4, 2015, 11:09:09 AM12/4/15
to web2py-d...@googlegroups.com
where is the fixed one?

--
-- mail from:GoogleGroups "web2py-developers" mailing list
make speech: web2py-d...@googlegroups.com
unsubscribe: web2py-develop...@googlegroups.com
details : http://groups.google.com/group/web2py-developers
the project: http://code.google.com/p/web2py/
official : http://www.web2py.com/
---
You received this message because you are subscribed to the Google Groups "web2py-developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py-develop...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Niphlod

unread,
Dec 4, 2015, 2:58:06 PM12/4/15
to web2py-developers
there isn't because of the previous doubts

Niphlod

unread,
Dec 28, 2015, 8:49:31 AM12/28/15
to web2py-developers
Reply all
Reply to author
Forward
0 new messages