← All challenges
hardpallets/flask · v2.3

Flask routes to return domain/sub-domains information

webmicroframeworkbase 182ce3dd15
Mode

60 minutes, the full token budget.

  • Time limit60 min
  • Token budgetup to 1M
  • Worth up to310 XP

Opens VS Code with an AI agent in a new tab. Prompts, tokens, tool calls and test runs are recorded and scored.

Problem statement

Currently when checking flask routes it provides all routes but it is no way to see which routes are assigned to which subdomain.

Default server name:
SERVER_NAME: 'test.local'

Domains (sub-domains):
test.test.local
admin.test.local
test.local

Adding blueprints:
app.register_blueprint(admin_blueprint,url_prefix='',subdomain='admin')
app.register_blueprint(test_subdomain_blueprint,url_prefix='',subdomain='test')

$ flask routes
 * Tip: There are .env or .flaskenv files present. Do "pip install python-dotenv" to use them.
Endpoint                                                 Methods    Rule
-------------------------------------------------------  ---------  ------------------------------------------------
admin_blueprint.home                                      GET        /home
test_subdomain_blueprint.home                             GET        /home
static                                                    GET        /static/<path:filename>
...

Feature request
It will be good to see something like below (that will make more clear which route for which subdomain, because now need to go and check configuration).
If it is not possible to fix routes, can you add or tell which method(s) should be used to get below information from flask?

$ flask routes
 * Tip: There are .env or .flaskenv files present. Do "pip install python-dotenv" to use them.
Domain                Endpoint                                             Methods    Rule
-----------------   ----------------------------------------------------  ----------  ------------------------------------------------
admin.test.local     admin_blueprint.home                                  GET        /home
test.test.local      test_subdomain_blueprint.home                         GET        /home
test.local           static                                                GET        /static/<path:filename>
...
The environment starts at commit 182ce3dd15df (pallets/flask 2.3), dependencies installed and tests runnable from the first minute. You are graded by hidden tests taken from the fix that was actually merged upstream.