Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Pyramid is just a WSGI application. This means it's dependent on the HTTP_HOST environ key (set by the Host header) to determine the host of the application. It's all relative. Point-being that Pyramid has no restrictions on what it can accept, thus the world is your oyster and you can set it up to limit content to various domains however you'd like. This of course starts with what hosts your webserver is configured to feed to your application.</p> <p>Assuming you're using URL dispatch, you might want to design some custom route predicates that check the <code>request.host</code> value for whatever you'd like. Returning <code>False</code> from that predicate will prevent that route from ever matching a request to that host.</p> <p>This is a large topic, so it might help if you give some more specifics. For example, since Pyramid is relative, any URL you may want to generate from 'example.com' to redirect someone to 'sub.example.com' will need to be done via a pregenerator.</p> <pre><code>def pregen(request, elements, kw): kw['_app_url'] = 'http://sub.example.com' return elements, kw def req_sub(info, request): return request.host.startswith('sub') config.add_route('sub_only', '/', custom_predicates=(req_sub,), pregenerator=pregen) config.add_route('foo', '/foo') config.add_view(view, route_name-'foo') def view(request): # redirect the user to "http://sub.example.com", regardless of whether # request.host is "example.com" or "sub.example.com" return HTTPFound(request.route_url('sub_only')) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload