Skip to content

A completely Dockerized application template which is comprised of a Vue.js frontend, Django REST API backend, PostgreSQL database and Celery/Celery Beat/redis distributed task queue. Getting up and running is as simple as creating a new repository with the template, cloning that repository and building the development containers with Docker Com…

License

Notifications You must be signed in to change notification settings

epm0dev/django-vue-postgres-celery-redis-docker

Repository files navigation

django-vue-postgres-celery-redis-docker

TODO project description

Table of Contents

  1. Acknowledgements
  2. Template Structure
  3. Using This Template
  4. Project Deployment
  5. FAQ

Acknowledgements

Special thanks to Very Academy. Their two Youtube videos (here and here) helped tremendously in getting the individual backend and frontend components of the project setup and working. Much of the project's boilerplate code is based on this GitHub repository of theirs.

Special thanks to testdriven.io. This blog post was very useful when setting up Celery and Celery Beat as well as redis. You can check out the example project referenced in the tutorial here.

Template Structure

TODO

Using This Template

  1. To use this template, you'll need to have Git and Docker Compose installed on your computer.
  2. Rename the project directory from django-vue-postgres-project-template to the name of your project.
  3. Change to the project directory and initialize a new git repository from your command line as follows:
    # Change to the project directory
    cd new-project-directory-name
    
    # Delete the existing .git folder
    rm -rf .git
    
    # Initialize a new git repository for the project
    git init
    
  4. Build and run the development Docker containers from your command line:
    # Build and run the development containers
    docker-compose -f docker-compose.dev.yml up -d --build
    
  5. Make and perform Django database migrations from your command line:
    # Make database migrations
    docker exec -it api python backend/manage.py makemigrations
    
    # Perform database migrations
    docker exec -it api python backend/manage.py migrate
    
  6. Create a Django superuser from your command line:
    # Create new superuser
    docker exec -it api python backend/manage.py createsuperuser
    
  7. Once the containers are built, you can see what tasks have been run by the celery container from your command line as follows:
    # Check the celery container logs
    docker-compose -f docker-compose.dev.yml logs celery
    

Project Deployment

Note: These instructions assume that you have already completed the steps provided in the Using This Template section of this README file. Note: Directions for creating a production environment file are incomplete and will vary drastically depending on how the application is deployed.

  1. First, create a new file in the project's root directory called .env.prd and, in the newly created file, specify values for the following environment variables:
    SECRET_KEY=
    ALLOWED_HOSTS=
    POSTGRES_DB=
    POSTGRES_USER=
    POSTGRES_PASSWORD=
    
  2. Add the following environment variables and their values to the .env.prd file you created in the previous step:
    DEBUG=0
    DB_HOST=production_db
    REDIS_HOST=production_redis
    CORS_ALLOWED_ORIGINS=http://localhost:8000
    
  3. Stop all running containers and remove their networks, volumes and images from your command line:
    # Stop any running development containers
    docker-compose -f docker-compose.dev.yml down -v
    
    # Stop any running production containers
    docker-compose -f docker-compose.prd.yml down -v
    
  4. Build and run the production Docker containers from your command line:
    # Build and run the production containers
    docker-compose -f docker-compose.prd.yml up -d --build
    
  5. Make and perform Django database migrations from your command line:
    # Make database migrations
    docker exec -it production_api python backend/manage.py makemigrations
    
    # Perform database migrations
    docker exec -it production_api python backend/manage.py migrate
    
  6. Create a Django superuser from your command line:
    # Create new superuser
    docker exec -it production_api python backend/manage.py createsuperuser
    

FAQ

TODO

About

A completely Dockerized application template which is comprised of a Vue.js frontend, Django REST API backend, PostgreSQL database and Celery/Celery Beat/redis distributed task queue. Getting up and running is as simple as creating a new repository with the template, cloning that repository and building the development containers with Docker Com…

Topics

Resources

License

Stars

Watchers

Forks