Please do not use exec_environment. Can you tell us more what kind of
interface you need? What is the purpose?

There are various way to interface and which one you use depend on the
purpose:

1)
web2py.py -S app -M -N -R yourcode.py

2)
>From your code
db = DAL(...,path='/path/to/db',auto_import=True)

3)
expose a service, access the service (XML-RPC)

4)
queue tasks in db, access db and process tasks


On Jun 26, 12:08 pm, Arnon Marcus <a.m.mar...@gmail.com> wrote:
> Hi everybody,
>
> I'm searching for a way to interface into a web2py application, that
> does not use any of the built-in function-decorators.
> I want to write a service that would run locally, and interact with
> the web2py server, located on our company server, and serve as a
> common bridge for multiple local applications running on a user's
> machine.
> On the back-end sides of the service I got things covered.
> On it's front-side, the side that would talk to the web2py
> application, I was hoping to use something more flexible and open then
> xml-rpc or any of the rpc's...
> I was thinking on the lines of running an RPyC server along-side the
> web2py server, that would serve as a hub into the running process of
> the web2py application.
> I was also looking at Pyro, but the opinions about it where not great,
> compared to RPyC.
> I tried using the shell.py functionality, with no success.
> I couldn't even interface with the welcome application on a fresh code
> of web2py, via the web2py shell... It seems that something is broken
> there...
> I'm running from a command line, on the web2py folder:
>   "python web2py.py -S welcome -M -N"
> The console/shell appears (the ">>>" stuff...)
> Then I do:
>   "from gluon.shell import exec_environment"
> Then I tried:
>   "cas = exec_environment('applications/welcome/models/db.py')"
> and
>   "other = exec_environment('applications/welcome/controllers/
> other.py')"
> And they both throw me errors...
>
> And also, even if it did work, even though it should, theoretically,
> allow me to remotely use the DAL, it would be even more inefficient
> then using xml-rpc, as every user would have to remotely invoke an
> additional separate partial-web2py server process (if I understand the
> mechanism correctly...).
>
> Is there any efficient way to do what I need?

Reply via email to