Sounds like you just need some sort of never ending loop (obviously you can
put checks in the loop for stop requests and whatever other complexity you
like / need).
You can pass arguments on the python command line. So for example you could
do something like:
python web2py.py -S your_app -M -A 1 run_my_loop
In the example, 1 is the user record to use and then:
if sys.argv[2] == 'run_my_loop':
this_user = db_auth.auth_user[sys.argv[1]]
if not this_user:
raise Exception('...')
auth.login_bare(this_user.email, this_user.password)
run_my_loop()
On Monday, 29 February 2016 10:36:23 UTC+1, Paul Gerrard wrote:
>
> I have written some Python code to act as a chatbot working with Slack.
> All looks good so far. I could add it as a service to /etc/init.d etc and
> make it work at startup. However...
>
> I want to enhance the service to access my MySQL database using the Web2py
> DAL. Now, I created a webservice to do this - but of course when run the
> Apache server eventually times out and I get a 500 error. Is there a simple
> way of creating a permanently running service that can access models, the
> DAL etc?
>
> Now, in the web2py directory, I guess I could run:
>
> python -M -S myapp/controller/function
>
> But I need to add credentials to the command too? How do I do this?
>
> Assuming there's a way to provide credentials through the shell, would a
> permanently running service created this way cause any other issues?
>
> thanks, Paul.
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.