Template repository using Django in backend as a Rest API consumed by React in front.
Follow these instructions in order to start your new project!
In order to build the app you will need:
- Node.js - For executing React and install dependencies such as ThreeJs
- Python + pip - Needed for Django & DjangoRestFramework
After the installation of Python & pip it's time to install Django and DjangoRestFramework:
- Django - See docs here
pip install Django==3.1.6
- DjangoRestFramework - Already configured in this template, just install through pip, see docs here
pip install djangorestframework
Now that Django is installed we need to create a superuser for db before running:
cd ./db
python manage.py migrate
python manage.py createsuperuser
Introduce an username and password for db superuser (email is not required)
Once the db su is created, you can run the dev server:
python manage.py runserver
Note: If python has not been added to PATH python
will not be recogniced, instead you can use py -3
(if you installed python 3 or higher) or py -2
(if you installed python 2)
Then you can see the db info in http://localhost:8080/api
Now let's install required dependencies for React-app (ThreeJs is already included)
cd ./app
npm install
Once the installation finish we can run the js code:
npm start
This will open a browser window in http://localhost:3000 (if not just do it manually) You should see a blue cube spinning in the center of screen, the code for this cube is located in App.js file.
- Alejandro Santisteban - [email protected] - Github