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
.gitdirectory:rm .git. Remember togit initandgit remote add origin <url>when you're ready to add, commit, and push your code! - Create a
.envfile by using.env.sampleas a boilerplate:cp .env.sample .envEdit the new.envfile and augment the variables to match your local environment. - Create a
backend/core/local_settings.pyfile by usingbackend/core/local_settings.py.sampleas a boilerplate:cp backend/core/local_settings.py.sample backend/core/local_settings.pyEdit the newbackend/core/local_settings.pyfile 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:8000to 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"
}