Skip to content

mKleinCreative/BlogForYourDog

Repository files navigation

🐾 BlogForYourDog

Prerequisites

  1. Docker
  2. docker-compose
  3. watchman
    brew update
    brew install watchman

Installation

  1. Clone the repo: git clone git@github.com:mKleinCreative/BlogForYourDog
  2. Navigate to the repo directory created in the last step: cd BlogForYourDog
  3. Create a .env file by using .env.sample as a boilerplate: cp .env.sample .env
  4. Edit the new .env file and augment the variables to match your local environment.
  5. Create a backend/core/local_settings.py file by using backend/core/local_settings.py.sample as a boilerplate: cp backend/core/local_settings.py.sample backend/core/local_settings.py Edit the new backend/core/local_settings.py file and augment the variables to match your local environment.
  6. Execute docker-compose up.
  7. Wait until the build finishes. You'll see this message: dogblog_frontend | Compiled successfully!
  8. Open a new terminal tab and run docker exec -it dogblog_backend /bin/bash.
  9. Once logged into the dogblog_backend Docker container, execute python manage.py createsuperuser and follow the prompts to create an Admin user for the Django Admin interface.
  10. Exit the Docker bash shell by typing exit.
  11. Finally...
    • Open your browser and enter:
    • Use cURL in a new Terminal tab to test the backend Django API via DRF token authentication:
      1. Visit http://0.0.0.0:8000/admin/authtoken/token/add/ in your browser.
      2. Authenticate using your superuser credentials.
      3. Select your current User from the dropdown menu and click Save.
      4. 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"}
  12. Write your fancy new Django + React app!
  13. Run docker-compose down to safely shut down all containers for this project.

Troubleshooting

Docker

  • 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

macOS

  • 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.

Debug Django via VSCode Remote Debugger

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"
  }

About

BlogForYourDog

Resources

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
LICENSE.MD

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published