django-step-by-step
docker-django-example
django-step-by-step | docker-django-example | |
---|---|---|
23 | 44 | |
168 | 1,100 | |
- | - | |
8.7 | 7.8 | |
14 days ago | 24 days ago | |
Python | Python | |
- | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
django-step-by-step
-
What is your development cycle when using docker and containers? What's the general flow between developing locally and running the containers to test.
Here's an example of a docker-compose file in my reference Django project: https://github.com/briancaffey/django-step-by-step/blob/main/docker-compose.yml
- My Infrastructure as Code Rosetta Stone - Deploying the same Django application on AWS ECS Fargate with CDK, Terraform and Pulumi
-
My Infrastructure as Code Rosetta Stone - Deploying the same web application on AWS ECS Fargate with CDK, Terraform and Pulumi
Mono repo with a sample Django micro blogging app (μblog) and frontend app (Vue SPA written with Quasar), GitHub Action workflows for infrastructure and (separate) application deployment pipelines, IaC code that consumes each of the libraries listed above, VuePress documentation site and miscellaneous items (k6 load testing scripts, Cypress tests, docker-compose, etc.): github.com/briancaffey/django-step-by-step
-
My Django blog website doesn't have a 'like' button. How can I add one?
This project also uses a model manager to make it easy to show how many people like a post as well as if the current user likes the post or not https://github.com/briancaffey/django-step-by-step/blob/main/backend/apps/blog/managers.py.
-
Need some theoretical clarity on Terraform vs AWS CDK
Here's another repo that consumes these IaC libraries and deploys them through GitHub Actions pipelines: https://github.com/briancaffey/django-step-by-step
-
Decoupling terraform ecs task definition and deployments
By ignoring changes here you don’t have to worry about infra upgrades pushing out application updates. And you can update your app with with a separate pipeline. My code uses AWS CLI to register new task definitions. Here’s an example of my pipeline that deploy the app: https://github.com/briancaffey/django-step-by-step/blob/main/.github/workflows/ad_hoc_update_backend.yml
-
Scenario based question for DevOps Engineers out there
Here are some other questions that would be good to ask about the infrastructure: * What AWS account will this run in? Who has access to that account? Are SSO permission sets used? * What DNS records will be used to access the frontend and the backend? Are these two services accessed via the same record URL? For example, all do you to only send example.com/api/* traffic to the backend and then send all other example.com/* to the Angular frontend? Or do you want to use api.example.com for all API traffic and example.com for the Angular site. What about non-prod environments? Will you use alpha.example.com for a staging environment for a non-prod environment named alpha? * You mentioned that the team will be using Terraform heavily, how will you be splitting up your modules? When you run Terraform's apply command, does it update a single set of infrastructure for your entire application, or do you run terraform apply several times for different groups of resources, such as a networking stack (with VPC), data stack (with RDS) and application stack (for ECS resources), for example? You will probably use terraform remote state to manage these different logical components and the data dependencies they have between each other. * Another related question is how you are running pipelines for Terraform? I would use something like GitHub Actions. When a pipeline runs, you should see the output of a terraform plan stage and then the pipeline should pause for manual approval after the changes have been reviewed. This can be done with GitHub environments, for example, and other CI/CD tools can also do this. * What happens when you need to change an environment variable? This can be a complicated question. Environments that are not secrets might be stored in a terraform.tfvars file, or might be stored in environment variables in your pipeline in the form of TFVAR{name}, so this implies that changing an environment variable is an infrastructure change. You want to keep your infrastructure deployments separate from your application deployments. If you are using ECS, you probably want to use ignore_changes for the task definitions referenced by the services. This will create a new task definition, but it will not be used by the new services. When you do an application update, the service may use this new task definition with the updated environment variable. * Another question: does anyone on the team need direct access to the database? Is there a bastion host used in the infrastructure that can people can connect to the DB with via port forwarding? I hope these questions are helpful. I have thought about a lot of these and have been exploring their answers with an open source project focused on a containerized, database-backed Python web app (made with Django) that I deploy on AWS with ECS Fargate, and I have another repo with Terraform modules for deploying application infrastructure. Here's the application repo: https://github.com/briancaffey/django-step-by-step and here is the Terraform module repo: https://github.com/briancaffey/terraform-aws-django. Please let me know if you have any questions
-
How do you organize your code in Vue 3 composition api?
Here is how I organize my modules for an example microblog app: https://github.com/briancaffey/django-step-by-step/tree/main/quasar-app/src/modules
-
Django templates with DRF and React
Yes, this is possible. There are different ways to do this and it will depend on how and where you host your applications. Here's an example project of mine that I run on AWS that uses some the same URL with some routes for Django template-powered views, some views for a Vue app, some views for REST API and some views for GraphQL: https://github.com/briancaffey/django-step-by-step.
-
When to implement CI/CD in a brand new project?
Here's an example of how I implement CI and CD with a Django project on AWS using GitHub Actions. I use ECS Fargate. https://github.com/briancaffey/django-step-by-step/blob/main/.github/workflows/backend_linting_and_unit_tests.yml
docker-django-example
-
Django 5.0 Is Released
Congrats on the release to the Django community!
If anyone is curious, I updated my Django / Docker starter kit app to use Django 5.0 at: https://github.com/nickjj/docker-django-example
It pulls together gunicorn, Celery, Redis, Postgres, esbuild and Tailwind with Docker Compose. It's set up to run in both development and production.
-
Working with Docker Containers Made Easy with the Dexec Bash Script
- https://github.com/nickjj/docker-django-example
-
What's the correct way to install or version up packages when using Docker and Poetry?
For example I edit the regular non-lock file and then run ./run pip3:install from my host which handles the above. A repo with an example Django project in Docker can be found here https://github.com/nickjj/docker-django-example. There's a pip3-install script in the bin/ directory, you can replace that with Poetry commands instead.
-
Docker advantages for a single developer?
Currently, I'm using a modified version of this Docker setup (https://github.com/nickjj/docker-django-example) to work locally and build/deploy a production image. However, using PyCharm as my IDE, the development process is incredibly slow, especially when adding or removing Python packages. It takes at least 3 minutes to rebuild the Docker image after adding a package, and PyCharm has to update its index. Additionally, PyCharm's inspector sometimes gets confused about which packages are already installed based on the requirements.txt.
-
Django 4.2 released
If anyone is interested I updated my Django / Docker starter project for 4.2: https://github.com/nickjj/docker-django-example
-
Django Local to Production - FTP or what ?
Lots of handy stuff in this Django and Docker example project https://github.com/nickjj/docker-django-example He does a good course about Docker too.
-
psycopg2 in production
If you're using Docker with a Debian based image you only need to apt install libpq-dev and you're good to go, it only needs to exist in your Docker image not your VPS directly. I've been using it for years. Here's a working example if you want to poke around https://github.com/nickjj/docker-django-example.
- Looking to use Docker & Docker Compose in production and need advice.
-
How to Dockerize any Django Application: A Step-by-Step Tutorial
On a positive note, I would recommend perhaps looking at https://github.com/nickjj/docker-django-example for a good, somewhat beginner guide for django + docker work.
-
What is your development cycle when using docker and containers? What's the general flow between developing locally and running the containers to test.
I put together https://github.com/nickjj/docker-django-example which pulls together a typical Django set up using Gunicorn, Celery, Postgres, Redis, esbuild and Tailwind.
What are some alternatives?
homelab
Poetry - Python packaging and dependency management made easy
cookiecutter-django-vue-graphql-aws - A highly opinionated Cookiecutter template that fuses together Django, Vue.js, GraphQL, and AWS into one full-stack web application.
Tailwind CSS - A utility-first CSS framework for rapid UI development.
todo-app-infra - Repository contains example application with PaaS, SaaS & IaaS
django-async-orm - Bringing Async Capabilities to django ORM
scim-examples - 1Password SCIM Bridge deployment examples
headwind - An opinionated Tailwind CSS class sorter built for Visual Studio Code
pulumi-aws-django - A Pulumi package for deploying Django applications to AWS using ECS Fargate and other managed services
launchr - Launchr is an open source SaaS starter kit, based on Django.
django-postgres-vue-gitlab-ecs
full-stack-fastapi-template - Full stack, modern web application template. Using FastAPI, React, SQLModel, PostgreSQL, Docker, GitHub Actions, automatic HTTPS and more.