Django rest framework and frontend - django

I want to use Django Rest Framework to create RESTAPI to integrate with the payment gateway API like stripe. For the frontend part I can only see project using React for the frontend. Cant i use Django as a frontend?
Looking for suggestions if i really just need to use React or Vue. Or is it possible to use django as frontend as well.
Looking for your suggestions. Thank you.

To use Stripe in Django, you may refer to this package https://github.com/dj-stripe/dj-stripe which supports Stripe out-of-the box specific for Django
For replacing React with Django for front-end, it is possible and you can use Django template, however, it depends on your use-case.

Related

Can I use django as frontend and have a login system with Token Authentication

Well, this question is for the ones who has experience in working with Django.
I'm new to Django and I have been studying Django, still I want to build an webapi with Django as backend and frontend, with a token authentication. Is that possible, and logical? I have been watching tutorial and reading documentation. Everyone who creates an api full django, creates a basic authentication. And, I want to know if is possible to create a more secure authentication with django as frontend. Thank you.
Generally speaking: yes, you can do that - but not with django alone. Also don't know every possible solution, but you can do this with the Django REST framework.
Here are some links to the documentation:
Django REST framework - Homepage
Django REST framework - TokenAuthentication
I personally use JSON Web Tokens in combination with Django and Django REST framework:
Simple JWT

Django REST API as backend and ReactJS as frontend integration

I'm learning ReactJS and I already have experience with Django and DRF. My aim right now is to build a rather simple web application based on a Django backend and a ReactJS frontend. (Later on, when the web app is done, I'll tackle React Native).
I've been reading tons of documentation but nothing has sorted out the question:
What is the best approach to integrate a Django backend with a ReactJS frontend?
Should I keep them separate and connect them or should I mount ReactJS inside the Django application? Which one is the best-suited approach, taking into account maintenance and further development?
Thank you very much! Any opinion/hint will be appreciated.
My approach would be make an app called frontend or anything you like in Django, then all of my React code will be placed inside that app. You will also need webpack to bundle your React code then with collectstatic command Django will collect all the static files so it could be served. You can find the tutorial here

How site administration is managed in Django-Angular2 project

I have to use Angular 2+ for front-end and Django as back-end, in my project.
Usually Django provides the '/admin' URL through which we can access the admin portal to do all the site-administration stuffs. But to use Angular 2+ as front-end we need to convert the whole back-end (Django) into REST API, which is actually recommended.
In this case how can we use the Django Admin URL or its utilities from Angular URLs? Or else whether I have to replicate Django Admin in Angular 2.
It will be a great help if someone can give me some ideas on this.
You seem to have a misunderstanding of how the various technologies you are developing in actually coexist.
Django is the server-side framework.
DRF (Django REST Framework) is
used in addition to Django, to make it easier to implement a
RESTful API on top of your Django project. Django REST Framework does
not replace Django. Django REST Framework is an addition to
Django.
AngularJS is a JavaScript framework that can be used in your project (or just parts of your project).
Using Django REST Framework does not suddenly mean that the Django admin interface will 'stop working'.
If your project's URL routing ('urls.py') still contains a route connecting the Django admin interface with /admin you can still go to yourproject.com/admin and it will completely circumvent anything you've done with AngularJS.
It may be late to reply, but Angular and DRF connects over http call.

Can Django be used to combine both webapp and moblie api?

I want to use django framework to write a web site with static/dynamic pages (I will not be using angular/react - i.e. SPA technology) but I also want the web app to serve as the backend for a mobile app.
What's the best practice here? Can Django alone be used for it?
Will I need to use Django REST framework?
If you could recommend some specific modules to keep the app as simple as possible and avoid DRY code. That'd be great.
Thanks.
You have the right pointers in your question already.
Use django-rest-framework to create a rest service, create your web app in django to consume that service, create a mobile app to consume the same rest service.
In general, once you have a rest service, you can build anything on top of it. Just consume the service from whichever platform you want to build for.
I hope that helps.

What is the role of django REST framework if I want to integrate angularjs with django?

I am trying to set up django with angularjs and play around with it. Most of the tutorials contain something about django REST framework, Creating endpoints for an application, APIs and so forth. What is django REST framework, what are endpoints, APIs, why are they important for angular?
First of all, you should learn what is angularJS and how it works, with that knowledge is pretty clear why there is need for an API.
In short words: You feed angularJS with template and data, AngularJS will take it and build correct site on client side. There won't be any benefits if you won't change data dynamically. That's why you need to have API for you app (to exchange data, not pre-build templates) and for that API, good choice is Django Rest Framework.