I’m trying to make a simple pyramid app without using the scaffold generator. The code consists of a single app.py file.
The question is: since app.py is not a part of a package, how do I specify a directory as a static asset specification? I understand an absolute path can always be used, but can I use a path relative to the app.py file?
The following seems to work correctly when the app is run with wsgiref.simple_server but is it guaranteed to work in all cases (e.g. when deployed with mod_wsgi or uwsgi?)
config.add_static_view('static', 'static')
From the pyramid.config API documentation:
Furthermore, I have looked into the Pyramid sources and it doesn’t seem that it depends on the WSGI used in any way. So from my point of view it seems it will always treat this as a relative path to the calling script. It depends on where the Configurator was placed or which script gets executed which is generally the same.
So I conclude that it should work with any WSGI compliant system.