What I have:
I have a Pyramid application that is created from Paste ini, is served by uWSGI and the nginx proxy. It works great. Here is the nginx configuration:
server { listen 80; server_name localhost; access_log /var/log/myapp/nginx.access.log; error_log /var/log/myapp/nginx.error.log warn; location / { uwsgi_pass localhost:8080; include uwsgi_params; } }
Here is the configuration of uWSGI ini:
[uwsgi] socket = 127.0.0.1:8080 virtualenv = /srv/myapp/venv die-on-term = 1 master = 1 logto = /var/log/myapp/uwsgi.log
This configuration is located inside Pyramid production.ini , so I serve the application with this command:
uwsgi --ini-paste-logged production.ini
All of this works great.
What I want to do:
One simple change. I want to use this application as a subfolder, and not as a root. Instead of serving it from http://localhost , I want to serve it from http://localhost/myapp .
And now everything is broken.
If I change the nginx location directive from / to /myapp or /myapp/ , I get 404s because the WSGI application gets uris, all of which are added using /myapp .
The uWSGI solution is similar to mounting the WSGI to be called in a subfolder and then passing the --manage-script-name parameter, after which uWSGI should magically separate the subfix prefix from uri and fix the problem.
However, the documentation and any other resource I found only gave examples of the form:
mount = /myapp=myapp.py
I do not have myapp.py which contains WSGI because my called object is created by PasteDeploy.
So, is it possible to mount the WSGI called inside Paste ini? Or will I have to break up the uwsgi configuration from Paste ini, and also define a separate wsgi.py with a call to paste.deploy.loadapp to generate a wsgi callable that I can install?
Or is there another way to serve this application as a subfolder from nginx without messing up the backlink?