3 ms·
Views "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 any
by ris 9y ago
Views "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.