<p dir="auto">Hi !</p>
<p dir="auto">I'm in trouble since a moment using Flask with that point.<br>
I'm registring 2 url rules in a blueprint :</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class MyClass(Blueprint):
    def setup(self):
        self.add_url_rule('&lt;service&gt;.&lt;ext&gt;', view_func=service_call)
        self.add_url_rule('networks.&lt;ext&gt;', view_func=networks)"><pre class="notranslate"><span class="pl-k">class</span> <span class="pl-v">MyClass</span>(<span class="pl-v">Blueprint</span>):
    <span class="pl-k">def</span> <span class="pl-en">setup</span>(<span class="pl-s1">self</span>):
        <span class="pl-s1">self</span>.<span class="pl-en">add_url_rule</span>(<span class="pl-s">'&lt;service&gt;.&lt;ext&gt;'</span>, <span class="pl-s1">view_func</span><span class="pl-c1">=</span><span class="pl-s1">service_call</span>)
        <span class="pl-s1">self</span>.<span class="pl-en">add_url_rule</span>(<span class="pl-s">'networks.&lt;ext&gt;'</span>, <span class="pl-s1">view_func</span><span class="pl-c1">=</span><span class="pl-s1">networks</span>)</pre></div>
<p dir="auto">I've read somewhere that the rule with the less number of parameters is taken in routing.<br>
But, when I'm typing /networks.json, I'm in the <code class="notranslate">service_call()</code> function, not in <code class="notranslate">networks()</code><br>
When I print the <code class="notranslate">url_map</code> :</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="Map([ &lt;Rule '/v1/&lt;service&gt;.&lt;ext&gt;' (HEAD, OPTIONS, GET) -&gt; v1.service_call&gt;,
 &lt;Rule '/v1/networks.&lt;ext&gt;' (HEAD, OPTIONS, GET) -&gt; v1.networks&gt;,
 &lt;Rule '/static/&lt;filename&gt;' (HEAD, OPTIONS, GET) -&gt; static&gt;])"><pre class="notranslate"><span class="pl-v">Map</span>([ <span class="pl-c1">&lt;</span><span class="pl-v">Rule</span> <span class="pl-s">'/v1/&lt;service&gt;.&lt;ext&gt;'</span> (<span class="pl-v">HEAD</span>, <span class="pl-v">OPTIONS</span>, <span class="pl-v">GET</span>) <span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-s1">v1</span>.<span class="pl-s1">service_call</span><span class="pl-c1">&gt;</span>,
 <span class="pl-c1">&lt;</span><span class="pl-v">Rule</span> <span class="pl-s">'/v1/networks.&lt;ext&gt;'</span> (<span class="pl-v">HEAD</span>, <span class="pl-v">OPTIONS</span>, <span class="pl-v">GET</span>) <span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-s1">v1</span>.<span class="pl-s1">networks</span><span class="pl-c1">&gt;</span>,
 <span class="pl-c1">&lt;</span><span class="pl-v">Rule</span> <span class="pl-s">'/static/&lt;filename&gt;'</span> (<span class="pl-v">HEAD</span>, <span class="pl-v">OPTIONS</span>, <span class="pl-v">GET</span>) <span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-s1">static</span><span class="pl-c1">&gt;</span>])</pre></div>
<p dir="auto">After some tests, it seems that following code is working as expected :</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class MyClass(Blueprint):
    def setup(self):
        self.add_url_rule('&lt;service&gt;/&lt;ext&gt;', view_func=service_call)
        self.add_url_rule('networks/&lt;ext&gt;', view_func=networks)"><pre class="notranslate"><span class="pl-k">class</span> <span class="pl-v">MyClass</span>(<span class="pl-v">Blueprint</span>):
    <span class="pl-k">def</span> <span class="pl-en">setup</span>(<span class="pl-s1">self</span>):
        <span class="pl-s1">self</span>.<span class="pl-en">add_url_rule</span>(<span class="pl-s">'&lt;service&gt;/&lt;ext&gt;'</span>, <span class="pl-s1">view_func</span><span class="pl-c1">=</span><span class="pl-s1">service_call</span>)
        <span class="pl-s1">self</span>.<span class="pl-en">add_url_rule</span>(<span class="pl-s">'networks/&lt;ext&gt;'</span>, <span class="pl-s1">view_func</span><span class="pl-c1">=</span><span class="pl-s1">networks</span>)</pre></div>
<p dir="auto">So, the dot isn't considered as a "separator" ?<br>
Is there a way to fix that ?</p>
<p dir="auto">Thanks in advance for your help !</p>
<p dir="auto">The following program demonstrates the effect of defining the same route across blueprints and the app - fetch <a href="http://localhost:5678/hello" rel="nofollow">http://localhost:5678/hello</a> for each run:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ python server.py app app
$ python server.py bp
$ python server.py app
$ python server.py app bp
$ python server.py bp app
$ python server.py bp app bp"><pre class="notranslate"><code class="notranslate">$ python server.py app app
$ python server.py bp
$ python server.py app
$ python server.py app bp
$ python server.py bp app
$ python server.py bp app bp
</code></pre></div>
<p dir="auto">It surprised me that Flask does not report route collisions.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import sys
from flask import Flask, Blueprint


def main():
    bp_num = 1
    app = Flask(__name__)
    for arg in sys.argv:
        if arg == 'bp':
            bp_name = 'bp%d' % bp_num
            bp_num += 1
            bp = Blueprint(bp_name, __name__)

            @bp.route('/hello')
            def hello_bp():
                return 'Hello ' + bp_name
            app.register_blueprint(bp)

        if arg == 'app':
            @app.route('/hello')
            def hello():
                return 'Hello'

    app.run(host='0.0.0.0', port=5678)


if __name__ == '__main__':
    main()"><pre class="notranslate"><code class="notranslate">import sys
from flask import Flask, Blueprint


def main():
    bp_num = 1
    app = Flask(__name__)
    for arg in sys.argv:
        if arg == 'bp':
            bp_name = 'bp%d' % bp_num
            bp_num += 1
            bp = Blueprint(bp_name, __name__)

            @bp.route('/hello')
            def hello_bp():
                return 'Hello ' + bp_name
            app.register_blueprint(bp)

        if arg == 'app':
            @app.route('/hello')
            def hello():
                return 'Hello'

    app.run(host='0.0.0.0', port=5678)


if __name__ == '__main__':
    main()
</code></pre></div>