Starting using werkzeug, i try to map urls (from a file urls.py) to views (from a folder views and then in different files to manage differents kinds of view), my folder organisation looks like that :
myapp/
- - - application.py
- - - urls.py
- - - views/
- - - - - - __init__.py
- - - - - - common.py
- - - - - - places.py
- - - - - - ...
my urls.py files looks like that:
from werkzeug.routing import Map, Rule
url_map = Map([
Rule('/places', endpoint='places.overview')
])
and obviously i got that piece in the views/places.py file :
def overview(request):
mycode...
render_template('places.html', extra...)
Most of werkzeug examples show the utilisation of the decorator expose to attach urls to views. It's practical for an app with 5 or 6 urls but can become a hell when you got more...
Is there a simple way to map the urls directly to the views???
Thanks.