How site administration is managed in Django-Angular2 project - django

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.

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 framework and frontend

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.

Django + Angular

i am new to the world of web development and i have a very good foundation on django for backend operations. i am also learning angular for front-end applications. so far i am quite happy writing in django for backend, but i dont like to work with the django templates. My question is, is there any way to integrate angular as the front-end portion in a django environment, keeping the django as the backend??
also while we at it, is there any good designing (UI design) courses available and where (free or paid)?
What you were doing was using Django as a backend and frontend framework. But you can use Rest Framework to build an API, keeping Django only on the backend. Once you have the API endpoints built, you can consume them with Angular or any other framework.
More info:
What is an API?
The tutorial in the official website of Django Rest Framework is a great start.

Django REST with SPA - what structure

Django REST with SPA "within" or completely stand alone?
I'm diving into a new project where I'll try to build a SaaS web application and I've set on using Django Rest (with Postgres to utilize schemas) and React/Vue on the frontend.
What I'm unsure and what I can't seem to get an answer to is the way people structure these frameworks. E.g, on https://www.valentinog.com/blog/drf/ the author writes:
I see the following patterns (which are common to almost every web
framework):
React in its own “frontend” Django app: load a single HTML template
and let React manage the frontend (difficulty: medium)
Django REST as a standalone API + React as a standalone SPA
(difficulty: hard, it involves JWT for authentication)
Mix and match: mini React apps inside Django templates (difficulty:
simple)
And here are my advices.
If you’re just starting out with Django REST and React avoid the
option 2.
Go for option number 1 (React in its own “frontend” Django app) if:
you’re building an app-like website
the interface has lot of user interactions/AJAX
you’re fine with Session based authentication
there are no SEO concerns
you’re fine with React Router
Why is this beneficial, and is it actually different from having a stand alone rest api and a standalone SPA? The reason I wanna use Django is so I don't have to worry about authentication and authorization, and I also plan on utilising the admin panel - will this "not work" if I were to use two completely standalone applications for the backend and frontend? (e.g django rest with the sole purpose of exposing the api and the frontend to consume it).
What alleged benefits do I get from having django rest and SPA in the same "root" project

How to create simple restful login system in django?

I want to create simple restful login system in django. I searched every where they are creating rest-full login system using Restful Framework. How to create without using any rest framework.
Though the default authentication views in Django are not RESTful, you can use third party addons that extend the default views.
Djoser works with Django Rest Framework and provides most of the endpoints for login system.
You can find the other options that work with most Django REST frameworks here: http://www.django-rest-framework.org/api-guide/authentication/#third-party-packages