TODO project description
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.
TODO
- To use this template, you'll need to have Git and Docker Compose installed on your computer.
- Rename the project directory from
django-vue-postgres-project-templateto the name of your project. - 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 - 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 - 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 - Create a Django superuser from your command line:
# Create new superuser docker exec -it api python backend/manage.py createsuperuser - 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
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.
- First, create a new file in the project's root directory called
.env.prdand, in the newly created file, specify values for the following environment variables:SECRET_KEY= ALLOWED_HOSTS= POSTGRES_DB= POSTGRES_USER= POSTGRES_PASSWORD= - Add the following environment variables and their values to the
.env.prdfile you created in the previous step:DEBUG=0 DB_HOST=production_db REDIS_HOST=production_redis CORS_ALLOWED_ORIGINS=http://localhost:8000 - 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 - 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 - 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 - Create a Django superuser from your command line:
# Create new superuser docker exec -it production_api python backend/manage.py createsuperuser
TODO