Hi, and thanks for the example.

On Mon, Jan 13, 2014 at 10:07 PM, Roberto De Ioris <[email protected]> wrote:
[snip]

> An example:
>
> #app1.py
> def application(e, sr):
>     sr('200 OK',[('Content-Type','text/plain')])
>     return ["app1"]
>
> #app2.py
> def application(e, sr):
>     sr('200 OK',[('Content-Type','text/plain')])
>     return ["app2"]
>
> uwsgi --mount "/app1=app1.py" --mount "/app2=app2.py" --http-socket :9090
> --route "^/app1 setapp:/app1" --route "^/app2 setapp:/app2"
>
> once an app is mounted you can call it at the request phase using the
> setapp:<mountpoint> routing action


I just tried this using an ini file to run uwsgi.

My understanding is that each command line switch can be converted to ini
properties, so here the ini file I used:

> [uwsgi]
> socket = localhost:9090
> wsgi-file = my_wsgi_server.py
> processes = 4
> threads = 2
>
> # mounts + routes (example from mailing list)
> # uwsgi --mount "/app1=app1.py" --mount "/app2=app2.py" --http-socket
:9090 --route "^/app1 setapp:/app1" --route "^/app2 setapp:/app2"
> # (where each appN.py file contains an application() function)
>
> mount /verify=verify.py
> route ^/verify setapp:/verify

As before, /verify requests got sent to the "application()" function
defined in my_wsgi_server.py and not the one in verify.py.

I realized it must be because of the wsgi-file property in line 3.

So I removed it, and restarted uwsgi with this ini file:

> [uwsgi]
> socket = localhost:9090
> processes = 4
> threads = 2
>
> # mounts + routes (example from mailing list)
> # uwsgi --mount "/app1=app1.py" --mount "/app2=app2.py" --http-socket
:9090 --route "^/app1 setapp:/app1" --route "^/app2 setapp:/app2"
> # (where each appN.py file contains an application() function)
>
> mount /verify=verify.py
> route ^/verify setapp:/verify

But this time, I got this error:

> *** no app loaded. going in full dynamic mode ***

So I tried wrapping the ini values in quotes, as they would have appeared
as command line arguments:

> [uwsgi]
> socket = localhost:9090
> processes = 4
> threads = 2
>
> # mounts + routes (example from mailing list)
> # uwsgi --mount "/app1=app1.py" --mount "/app2=app2.py" --http-socket
:9090 --route "^/app1 setapp:/app1" --route "^/app2 setapp:/app2"
> # (where each appN.py file contains an application() function)
>
> mount "/verify=verify.py"
> route "^/verify setapp:/verify"

But got the same "no app loaded" error.

So what am I missing?

I could, of course, just go back to using the wsgi-file parameter in the
ini file, and dispatching requests based on the content of the query string
in the application() function defines there (which was my first approach,
before I read the section in the docs on internal routing), but it seems
like an unnecessary thing to do if I could get the back moount+route
configuration to work.
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to