Pyramid: Hosting an Application Under a URL Prefix

244 views
Skip to first unread message

Wouter Overmeire

unread,
Aug 25, 2011, 6:32:02 AM8/25/11
to pylons-discuss
Trying to find out how to host pyramid app under a URL Prefix.

Project was created using: 'paster create -t pyramid_routesalchemy',
using wsgi and runs fine.
Now i would like to add a url prefix. So that '/' really becomes '/
prefix/'.

As suggested in the documentation
https://docs.pylonsproject.org/projects/pyramid/1.1/narr/vhosting.html#hosting-an-application-under-a-url-prefixand
i added a [composite:main] section in my .ini file.
Unfortunately this is not possible when a [pipeline:main] section is
present. The [pipeline:main] section was generated by the paster. I
tried removing the [pipeline:main] section but that does not help.

How can this be done?


Chris McDonough

unread,
Aug 25, 2011, 10:19:57 PM8/25/11
to pylons-...@googlegroups.com

You can rename 'pipeline:main' to 'pipeline:mypipeline':

[pipeline:mypipeline]
... whatever is in your [pipeline:main] now ...

[composite:main]
/prefix = mypipeline

Please read the PasteDeploy documentation for more information.


- C


Wouter Overmeire

unread,
Aug 26, 2011, 4:13:55 PM8/26/11
to pylons-...@googlegroups.com
Using your suggestion gives an error: LookupError: No loader given in section 'composite:main'

But if i add 'use = egg:Paste#urlmap' in [composite:main] on top of your suggestion, it works fine.

So the fix i did is:


You can rename 'pipeline:main' to 'pipeline:mypipeline':

[pipeline:mypipeline]
... whatever is in your [pipeline:main] now ...


[composite:main]

use = egg:Paste#urlmap

/prefix = mypipeline



Thanks.
Reply all
Reply to author
Forward
0 new messages