1

I am a php programmer, I have built some REST based solutions in php. Now I am learning python/django. I want to make a REST based solution in Django ( only for knowledge purpose ). I do not want to use any of REST frameworks/toolkits as This project is more a exploring django/python say how they work with raw REST concept.

I searched on net, But examples/tutorial filled on already built solutions. I also checkout for request method based filtering. I am thinking of two approaches.

Either urls.py have way to check request method and transfer to respective method in views.py.
Or I can add a pre load hook/class which determine request method on application initialize, And called respective method so overriding urls.py behavior (my preferred method).

If anybody can suggest a django way to do this?

Update : I found some interesting comments on SO, like https://stackoverflow.com/a/20898410/1230744 AND https://stackoverflow.com/a/1732520/1230744. Need to check if they can have the solution, I am searching.

1
  • 1
    This is a question and answer site. This should be a question, but appears to be a statement. Anyway, good luck! Commented Feb 3, 2014 at 8:05

2 Answers 2

1

Well I get the answer of my questions finally from following link. It is possible through using Class based Views + serialization.

Restful routes and Django

Snippet links in side above link gave pretty much example to gave quite picture of how one can create a REST Api using only Django Core. Also I used serialize https://docs.djangoproject.com/en/dev/topics/serialization/ for Json encoding

( Now if anybody prefer, he can flag duplicate the question. ;) )

Sign up to request clarification or add additional context in comments.

Comments

0

You can start from learning the code of this projects:

They are snadrd de facto for REST API for Django and their code could be a good starting point.

Also, please review this questions:

1 Comment

REST is not very hard thing in concept, So making a small app on pure REST concepts, should not need to learn a full fledged application source code. I agree they must have done a good code architecture. But my requirement is so small. Meanwhile I have found something interesting as I linked in my updated answer. If they works then that should be what I am searching. Just small and clear.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.