PEST / Django REST API Architecture

I am trying to create a niche of a social network, for example Instagram, as a Python / Django application.

So, all I need is regarding architecture, (I think):

  • REST API (e.g. api.mystagram.com).
  • A public website (www.mystagram.com or mystagram.com).
  • URL shortener (e.g. mystagr.am).
  • Android app
  • iPhone app
  • Windows Phone App
  • ...

Before that, I had only created simple websites for some less simple websites, but I had never been extremely complicated with my own custom APIs or so. I have never created my own REST API before (I used other REST APIs) or even created an Android / iPhone application and distributed it in the Play Store / App Store (although I made some typical welcome examples).

So, the most important thing for me, it seems, is to first create a REST API for kick-ass and go from there. I am blocked, however, by several questions.

  • How to organize projects for a public website and REST API? Should they be separate Django projects, or should I create only one Django project and add both a public website and a REST API as an internal Django module?
  • Should a public website also use the REST API? Or is it better to use simple Django models for this?

Thanks in advance for your help! If someone knows some great presentations or so on this topic (architecture), we are always welcome!

Regards, Christoph

+4
source share
3 answers

Django rest framework

https://github.com/tomchristie/django-rest-framework

Very well maintained, excellent documentation, easy to use.

+5
source

I think Tastypie will do what you want. And its simple and easy. Check it out - http://django-tastypie.readthedocs.org/en/latest/ !

0
source

To answer your first question, it would be good practice to include a public website and a REST API in a single django project. Currently, each web application contains a public website, as well as an apis application for a mobile application. Thus, it would be easier to maintain both the website and the rest apis if they are both in the same application. Below is a link to the Django REST Framework. https://github.com/tomchristie/django-rest-framework

On the second question, yes, you can also use apis to relax on the website. But in general, you do not need to do this. In most cases, the django model works for you.

0
source

Source: https://habr.com/ru/post/1500795/


All Articles