$ cd django-react-boilerplate
Conda environment is used and the dependencies are shown in requirements.txt.
- Create conda environment, in my case, my environment name is django_react_test_env.
$ conda create -n django_react_test_env python=3.7
$ conda activate django_react_test_env
- Install dependencies.
$ pip install -r requirements.txt
$ python manage.py runserver
- Enter your username at http://127.0.0.1:8000/.
- See your username at http://127.0.0.1:8000/api/data/.
- Navigate to the django-react-boilerplate directory.
$ cd django-react-boilerplate
- You may need to run the following lines once.
$ python manage.py makemigrations
$ python manage.py migrate --run-syncdb
or
$ python manage.py makemigrations
$ python manage.py migrate
Whenever you start the server, run the following line to start the development server at 127.0.0.1:8000.
$ python manage.py runserver
When you only change python codes, you do not need to restart the server every time since django offers hot-reload.
- Whenever you change your frontend codes such as index.js and index.css, run the following line.
$ yarn build
- If you are only developing frontend codes. You can use hot-reload. It is suggested to run the following line to start another development server at localhost:3000. Remember that this server only contains frontend codes.