An very minimal Django-React template to jumpstart any Django-React web application.
Table of Contents
There are many Django-React boilerplates and some templates on Github. Most of these repos don't simply give you a blank Django-React project to expand code easily - they have many dependencies or seem complicated. In this template, simply edit the React code to change your frontend, and add apps to the Django framework for backend functionality. This template can become a very powerful web application through a fully-featured, rapid-development Django backend, and a UI-centric interactive frontend.
Obviously this template was built with Django and React. Most Django code was generated through django-admin
and then manage.py
, and most React code through create-react-app
. Here's links to Django and React:
This template assumes you don't know much about Django or React, but you're eager to get started because you know this combo is deadly. To get a local copy up and running follow these simple example steps.
For this template to work you need to have python and nodejs installed. Update node to the most recent version:
npm install npm@latest -g
-
Clone the repo and make it your current working directory
git clone https://github.com/repo.git
then
cd repo
-
Now you're going to need a virtual environment to install python packages like Django, and manage and keep those packages separate from other projects . You can use
virutalenv
or Anaconda as a python package manger. Both are good options; in either case, you'll want to get the latest version onpip
(python package installer):python -m pip install --user --upgrade pip
To use
virutalenv
:pip install --user virtualenv
Create a virtual environment called 'env' (or whatever you want to name your virtual environment):
python -m virtualenv env
Now activate the environment:
.\env\Scripts\activate
Finally, install Django in the virtual environment:
pip install django
Now in the main repository folder, you can use python manage.py runserver
to start the development django server. The output from the command will give you the IP address and port at which to view the template. From here, the Django backend can be added upon and experimented with live.
To edit the React frontend, it is easier to go to the frontend directory and npm run start
and view it locally on a different port. Since the template application is using the code from the frontend/build folder, you must run npm start build
after completing edits in the frontend.
Show a fleshed out example of using this template.
Let me know of any issues - See the open issues for a list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.
Definitely check out the Django and React documentation for tutorials and questions.
I love this django course, especially for beginners: https://www.dj4e.com/