You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from jsonrpc import jsonrpc_site
import myproj.myapp.views
urlpatterns = (
# some url patterns ...
url(r'^json/', jsonrpc_site.dispatch, name="jsonrpc_mountpoint"),
# more url patterns ...
)
It is not immediately evident that the import myproj.myapp.views is actually useful. Somebody who inherits a project and needs to maintain it could erroneously believe that the import is not needed and decide to "clean it up".
I believe there are two possible ways to go:
Make it more explicit
This means having a jsonrpc_site.register function that takes these arguments:
entry point; e.g. r'^json/'
list of fully-qualified json rpc methods to register
the other usual parameters (e.g. url pattern name)
And the method will return a set of url pattern objects that can be appended to urlpatterns.
Make it completely implicit and work by convention
This means making the discovery of json rpc methods work somewhat like django.contrib.admin, where we don't need to import the views in urls.py. Instead, have django-json-rpc scan through all the apps listed in INSTALLED_APPS of Django settings.
The text was updated successfully, but these errors were encountered:
Currently, we need to do this in urls.py:
It is not immediately evident that the
import myproj.myapp.views
is actually useful. Somebody who inherits a project and needs to maintain it could erroneously believe that the import is not needed and decide to "clean it up".I believe there are two possible ways to go:
Make it more explicit
This means having a jsonrpc_site.register function that takes these arguments:
r'^json/'
And the method will return a set of url pattern objects that can be appended to
urlpatterns
.Make it completely implicit and work by convention
This means making the discovery of json rpc methods work somewhat like django.contrib.admin, where we don't need to import the views in urls.py. Instead, have django-json-rpc scan through all the apps listed in INSTALLED_APPS of Django settings.
The text was updated successfully, but these errors were encountered: