francisfueconcillo / django-jwt-react

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Django-JWT-React Boilerplate

Boilerplate for Django & ReactJS Authentication using JWT. Instead of separating ReactJS Frontend and Django Backend API, the 2 components are bundled together. The index.html is rendered by Django Templating system, while the rest of the application is loaded by ReactJS

PROS:

  • Get the best of both worlds of Django and ReactJS
  • Use Django for Authentication
  • No CORS settings needed

CONS:

  • No live reload on JS

Technologies

Backend

Frontend

  • ReactJS
  • Babel
  • Webpack

Local Development Setup

Frontend

  • Install Frontend modules
$ npm i
  • Build frontend app (need to build on each change in development)
$ npm run build
  • NOTE: FE routes must end in "/"

Backend

  • Install pipenv globally
$ pip install pipenv
  • Set pipenv and install dependencies
$ pipenv --python 3.7
$ pipenv install django djangorestframework djangorestframework-simplejwt
  • Setup DB and Create super user
$ ./djsr/manage.py makemigrations
$ ./djsr/manage.py migrate
$ ./djsr/manage.py createsuperuser
  • Run server application
$ ./djsr/manage.py runserver

Deployment

References

About


Languages

Language:Python 52.5%Language:JavaScript 31.0%Language:TypeScript 14.3%Language:HTML 1.8%Language:CSS 0.5%