Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I manipulate subdomains with Pyramid's url dispatch?
    text
    copied!<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/7607807/multiple-domains-and-subdomains-on-a-single-pyramid-instance">Multiple domains and subdomains on a single Pyramid instance</a> </p> </blockquote> <p>I can not seem to find any documentation on working with subdomains with the Pyramid framework. There is one <a href="https://stackoverflow.com/questions/5274813/routing-subdomains-in-pyramid">question/answer on SO</a> regarding this where they say </p> <blockquote> <p>"Theoretically, this is covered by add_route() with a pregenerator argument."</p> </blockquote> <p>I have also found in the <a href="http://docs.pylonsproject.org/projects/pyramid/en/latest/api/interfaces.html" rel="nofollow noreferrer">docs</a> where they mention subdomains under the interface IRoutePregenerator</p> <blockquote> <p><code>__call__(request, elements, kw)</code>: " The pregenerator for a route is called by <code>pyramid.request.Request.route_url()</code> in order to adjust the set of arguments passed to it by the user for special purposes, such as Pylons ‘subdomain’ support."</p> </blockquote> <p>But these are the only places that even mention subdomains and there is nothing on how to work with them.</p> <p>All I am wanting is to have a wildcard DNS accept any subdomain. If subdomain is user, route to a certain controller, if the subdomain is any other word, route to a controller and provide the subdomain as a variable.</p> <p>This is super easy with Flask:</p> <pre><code>mod = Blueprint('users', __name__, subdomain='user') @mod.route('/') code </code></pre> <p>or</p> <pre><code>mod = Blueprint('everything', __name__) @mod.route('/', subdomain='&lt;var1&gt;') </code></pre> <p>How can I/is it possible to achieve this with Pyramid?</p>
 

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