- Docker
- docker-compose
- watchman
brew update brew install watchman
- Clone the repo:
git clone git@github.com:mKleinCreative/BlogForYourDog
- Navigate to the repo directory created in the last step:
cd BlogForYourDog
- 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:
dogblog_frontend | Compiled successfully!
- Open a new terminal tab and run
docker exec -it dogblog_backend /bin/bash
. - Once logged into the
dogblog_backend
Docker container, executepython manage.py createsuperuser
and follow the prompts to create an Admin user for the Django Admin interface. - Exit the Docker
bash
shell by typingexit
. - Finally...
- Open your browser and enter:
- [WIP] http://localhost:8000 to access the frontend.
- [WIP] http://localhost:8000/api to access the graphical, interactive Django REST Framework API interface describing available API endpoints.
- http://localhost:8000/admin to access the Django Admin interface.
- Use cURL in a new Terminal tab to test the backend Django API via DRF token authentication:
- Visit http://0.0.0.0:8000/admin/authtoken/token/add/ in your browser.
- Authenticate using your superuser credentials.
- Select your current User from the dropdown menu and click Save.
- To test authentication to the API, use the following command that returns the Token generated in the prior step. In your Terminal, run:
$ curl -X POST -d "username=SUPERUSER_USERNAME&password=SUPERUSER_PASSWORD" http://localhost:8000/api/v1/auth/` {"token":"a66bfc378fc443f33953c99c3d852bace48094c2"}
- Open your browser and enter:
- Write your fancy new Django + React app!
- Run
docker-compose down
to safely shut down all containers for this project.
-
Create a clean Docker build with verbose debugging output:
$ docker-compose --verbose up --build --abort-on-container-exit --force-recreate
-
Rebuild from scratch:
$ ./docker-rebuild.sh
-
Mac users may need to increase the max open files limit in macOS by executing the following commands:
$ sudo launchctl limit maxfiles unlimited unlimited $ sudo launchctl limit maxfiles $ ulimit -n 1024
For additonal information regarding
ulimit
, please visit this Gist.
Add the following launch.json
entry:
{
"name": "BlogForYourDog Django App",
"type": "python",
"request": "attach",
"localRoot": "${workspaceRoot}",
"remoteRoot": "/code/backend",
"port": 8000,
"secret": "debugger-local-secret",
"host": "localhost"
}