Yes you can do this.  what you need to do is use either the scheduled task 
function or the another queuing system, such as celery.  The web2py 
scheduler works well for most scenarios.  The flow will go something like 
this:-

1. User access the front end app and request a scheduled action or long 
running action.
2. The controller of the front end app creates a scheduled task (this 
contains a function name and parameters to be passed to that function)
3. Scheduled task is created in the shared database.
4. A worker task on your back-end server see there is an action to be 
performed and picks up the task and executes it with the parameters stored.
5. Scheduled task is marked as complete or failed

With this approach you can have one code base deployed on all servers, the 
function will be denoted by whether you configure a web server to accept 
requests and send to web2py, or start a worker process to look for 
background jobs.  Also be aware you can run multiple worker processes on 
each server.

This is a pretty common pattern for async processing of tasks.  I would 
recommend you read the scheduled tasks section of the web2py book.

Thanks,
Stuart
  

On Thursday, July 27, 2017 at 12:00:22 PM UTC-7, bria...@gmail.com wrote:
>
> Can I run 2 instances of web2py of the same application, with 1 instance 
> process the Business Logic (controller) while the other instance doing the 
> User Interface (View)? What I'm trying to achieve here is to separate the 
> API and UI by hosting them on separate server, to allow me to scale them 
> separately, and may be add a bit more security as well. I understand that 
> the standard way to do this is to turn one instance into a full service 
> API, while the other instance handles the UI, but they must run as separate 
> application.
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to