-
Notifications
You must be signed in to change notification settings - Fork 695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
python plugin routing support #214
Comments
Added chdir,setapp and sethome actions: [uwsgi] http-socket = :9090 mount = topogigio=werkzeug.testapp:test_app route = ^/foo chdir:/tmp route = ^/bar chdir:/var i have not tested sethome, let me know if it works |
Thanks, chdir and setapp work fine. With sethome I'm not sure, it should be the equivalent to
A request of http://127.0.0.1:8000/foo shows the following debug output:
Adding
makes it work, though. |
just realized that with mount we preload the applications, so dynamic virtualenv are not possibile. I have added the "setfile" intruction to allows dynamic loading of application: [uwsgi] http-socket = :9090 route = ^/foo chdir:/tmp route = ^/bar chdir:/var route = ^/test setapp:/var/uwsgi/app002.py in the second application we even modify SCRIPT_NAME and PATH_INFO dynamically (this should allow another series of tricks). In the third application we reference the app loaded in the second one (dynamic apps are mounted under a virtual path named like the full path of the file) but redefining SCRIPT_NAME and PATH_INFO accordingly |
With the new
There are a few oddities with the environment:
Fortunately they are easy to work around (based on your example above) by adding:
Can you comment on whether the above is expected/intended? |
Yes it is the expected behaviours, the routing subsystem does not change SCRIPT_NAME/PATH_INFO by itself, they must br voluntary rewritten. What is annoying is having to specify setapp and setfile, i do not know it if is a good approach to imply setapp in setfile |
OK, I think the setapp/setfile is no big deal, just something to be aware of. What about |
UWSGI_HOME (as well as the others UWSGI_ vars) is parsed before routing happens. They are used by frontend to pass infos to uWSGI. Internally they have no scope (the wsgi_request structure is used). By the way, you mean you cannot set it with: route-run = addvar:UWSGI_HOME=pippo ? |
No problem if the |
Is the inability to set |
No, variables (from the internal routing point of view) are not related to internal behaviours. UWSGI_HOME set wsgi_req->home only at parsing phase (if passed by a webserver) after that phase it lose meaning |
Virtual hosting with the python plugin is already possible through routing as in http://article.gmane.org/gmane.comp.python.wsgi.uwsgi.general/5153. However, there seems to be no way to specify different virtualenvs for each application, for that it is still necessary to configure a reverse proxy in front of uwsgi as in http://projects.unbit.it/uwsgi/wiki/Example#TwoPinaxsiteintwovirtualenvintwovirtualhostwithonlyoneuWSGIinstance. It would be desirable to have uwsgi handle this on its own so the owner of an uwsgi vassal who is not in control of the reverse proxy in front of uwsgi can configure this on his own. As discussed, routing targets are the current approach to virtualhosting in uwsgi, in this case the python: target should allow the specification of the UWSGI_PYHOME, UWSGI_SCRIPT, and UWSGI_CHDIR parameters.
The text was updated successfully, but these errors were encountered: