3 ms·
> But flask also almost invented the whole @route API, which is really awesome. -1000 on this. It's a side-effect-on-import nightmare. Not to mention scatterin
by ris 9y ago
> But flask also almost invented the whole @route API, which is really awesome.
-1000 on this. It's a side-effect-on-import nightmare. Not to mention scattering your url scheme all over your view modules makes it much harder to spot where your scheme doesn't make sense.
In my opinion.
- sametmax 9y agoIt's declarative configuration, I don't see how more side effects you get than with the Django way.
- ris 9y agoViews "register themselves" as functions that should be called given a certain URL at import time. That is a side effect and it's horrible if you want to do anything more subtle. Way more "magic" than anything django does.
- sametmax 9y agoDjango does the same thing. urls.py are imported automatically at startup, even if you run a regular manage.py command that doesn't run the server.
- ris 9y agoThat's not remotely the same thing. In django, one specific file is looked for and imported if it exists, django then looking for an `urlpatterns` in it. No side effects anywhere. Just a default place to look for something, much like it does with models.py.
- wruza 9y agoYou can use regular routing instead of route decorators in flask, iirc. http://flask.pocoo.org/docs/0.12/api/#application-object add_url_rule