librelist archives

« back to archive

[flask] How does flask do this with route

[flask] How does flask do this with route

From:
何威威
Date:
2010-06-29 @ 21:14
I have two modules admin and frontend(see flask docs). And then I want to
make admin module a url prefix "admin". It works like this.

app.register_module(admin, url_prefix='/admin')
app.register_module(frontend)

@admin.route('/')
def index():
    pass

@admin.route('/login')
def login():
    pass


@frontend.route('/')
def index():
    pass

@frontend.route('/<domain>')
def home(domain):
    pass

home's route is /<domain> which include admin.index ,  what can I do if I
want /admin route to admin.index?

In django, I put /admin before /([\w]+) and then /admin will route to
admin.index not to frontend.home. What about flask or Werkzeug?