Dockerized boilerplate. PostgreSQL 10 database + Django 2.0.x/DRF API backend + React frontend. Powered via proxy!
- Docker
- docker-compose
- Clone the repo:
git clone git@github.com:outputs-io/docker-django-react.git your-project-name
- Navigate to the repo directory created in the last step:
cd your-project-name
- Delete the leftover
.git
directory:rm .git
. Remember togit init
andgit remote add origin <url>
when you're ready to add, commit, and push your code! - Create a
.env
file by using.env.sample
as a boilerplate:cp .env.sample .env
Edit the new.env
file and augment the variables to match your local environment. - Create a
backend/core/local_settings.py
file by usingbackend/core/local_settings.py.sample
as a boilerplate:cp backend/core/local_settings.py.sample backend/core/local_settings.py
Edit the newbackend/core/local_settings.py
file and augment the variables to match your local environment. - Execute
docker-compose up
. - Wait until the build finishes. You'll see this message:
dr_example_frontend | Compiled successfully!
- Open browser and access
http://localhost:8000
to access the frontend. - Use cURL in a new Terminal tab to test the backend Django API via DRF token authentication:
$ curl -X POST -d "username=SUPERUSER_USERNAME&password=SUPERUSER_PASSWORD" http://localhost:8000/api/v1/auth/` {"token":"a66bfc378fc443f33953c99c3d852bace48094c2"}%
- Write your fancy new Django + React app!
Add the following launch.json
entry:
{
"name": "Remote Django App",
"type": "python",
"request": "attach",
"localRoot": "${workspaceRoot}",
"remoteRoot": "/code/backend",
"port": 8010,
"secret": "debugger-local-secret",
"host": "localhost"
}