I have WSGI application, which uses Pyramid, that I want to deploy under the path In the Webfaction panel, I created the WSGI application in "Domains/websites > Applications", and using "Domains/websites > Websites", I added it with the URL path "/foo". I then change the file There is one problem though: I'm using the functions provided by Pyramid to generate URL to the static resources of my application. Those functions use the So far, this is my mod_wsgi configuration directives:
I can wrap my WSGI application into a small function which sets the correct environment variables, but that seems hacky at best. How to correctly deploy a WSGI application under a path so that the WSGI environment is correctly defined? asked 01 Mar '12, 19:45 multani |
The problem is that when an application is mounted to a subpath, it is rewritten without that path when passed to the backend server. So the information that you are looking for is not available in the PATH_INFO and SCRIPT_NAME variables. The only way I can see for you to make this work would be to add the "foo/" prefix somewhere in your code when generating the URLs. answered 02 Mar '12, 02:28 todork Yes, that's the problem. Adding "foo/" is actually handled by the framework (Pyramid in this case) if it has the right information, which it lacks. There's no way I'm going to add the prefix everywhere in my code, though.
(02 Mar '12, 02:35)
multani
You can try modifying the PATH_INFO and SCRIPT_NAME variables, after they have been received, and prefixing "foo/" there.
(02 Mar '12, 02:38)
todork
I tried to change it (wrapping my app into another app which changes the environ dictionnary), but it didn't work. I don't remember the exact details though (got 404 answers), I will post this latter. It would be great if it worked out of the box, though.
(02 Mar '12, 03:42)
multani
Sorry - this is a feature of our system. It helps in some cases but it creates problems in others (such as yours). I would suggest that you open a ticket if you want further help with this matter, as we could actually look at your app.
(02 Mar '12, 03:48)
todork
|