Skip to content

app-generator/django-react-user-roles

Repository files navigation

Open-source Django Starter bundled with React, React-Flow - Actively supported by AppSeed.


Feature:

  • 🚀 Stack: Django & React
  • ✅ Tooling: Webpack
  • Design: Django Theme Datta - Free Version
  • Sections covered by the design:
    • Admin section (reserved for superusers)
    • Authentication: Django.contrib.AUTH, Registration
    • All Pages available in for ordinary users
  • 🚀 Deployment: Docker, CI/CD flow via Render

Django & React Codebase - Free Starter by AppSeed.


Start with Docker

👉 Step 1 - Download the code from the GH repository (using GIT)

$ git clone https://github.com/app-generator/django-react-starter.git
$ cd django-react-starter

👉 Step 2 - Start the APP in Docker

$ docker-compose up --build 

Visit http://localhost:5085 in your browser. The app should be up & running.


Manual Build

Download the code

$ git clone https://github.com/app-generator/django-react-starter.git
$ cd django-react-starter

👉 Set Up for Unix, MacOS

Install modules via VENV

$ virtualenv env
$ source env/bin/activate
$ pip3 install -r requirements.txt

Set Up Database

$ python manage.py makemigrations
$ python manage.py migrate

Start the APP

$ python manage.py createsuperuser # create the admin
$ python manage.py runserver       # start the project

At this point, the app runs at http://127.0.0.1:8000/.


👉 Set Up for Windows

Install modules via VENV (windows)

$ virtualenv env
$ .\env\Scripts\activate
$ pip3 install -r requirements.txt

Set Up Database

$ python manage.py makemigrations
$ python manage.py migrate

Start the APP

$ python manage.py createsuperuser # create the admin
$ python manage.py runserver       # start the project

At this point, the app runs at http://127.0.0.1:8000/.



Profile

  • We have created a model UserProfile and make one to one relationship between User and UserProfile. That means a user has only one profile.
  • Signals used for:
    • We are using signals for creating a new profile automatically.
    • Here we have used post_save signals. That means when a new User is created a new Profile will create automatically.
  • In apps.py file we have add this line of code. Here we have registered the signals with the app by importing the signals inside ready method. It is important to include cause we have used receiver in signals.py file.
      def ready(self):
          import apps.home.signals
    


Codebase Structure

The project is coded using a simple and intuitive structure presented below:

< PROJECT ROOT >
   |
   |-- core/                            
   |    |-- settings.py      # Project Configuration  
   |    |-- urls.py          # Project Routing
   |
   |-- apps/
   |    |-- home/            # Handle the default route  
   |
   |-- frontend/             # React Code
   |
   |-- requirements.txt      # Project Dependencies
   |-- manage.py             # Start the app - Django default start script
   |
   |-- ************************************************************************


Django & React Codebase - Open-Source starter crafted by AppSeed.