Tuesday, January 2, 2018

Re: Split API URLs to second project/settings/wsgi ?

What you can do is split the backend into a REST API using http://www.django-rest-framework.org/

Refactor the views to share common logic, and you can have your template renders bound to one view handler and an api call to another.   Configure your urls.py to have a url like /api/{version}/{resource/{id} mapped to an API endpoint.  Since the logic is shared between the different views, you'll get the same results regardless of access method.

The nice part with DRF views is you can customize the permissions and authentications for specific resources.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/cabb7821-78ff-4a63-9919-f7e9cfc5f6e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment