{"id":23088243,"url":"https://github.com/leju-b/docker-simple-django-blog","last_synced_at":"2026-05-08T09:34:27.930Z","repository":{"id":254982487,"uuid":"848166385","full_name":"leju-b/Docker-simple-django-blog","owner":"leju-b","description":"This project involves developing a simple Django application, containerizing it with Docker, and deploying it on an EC2 instance. The app will be built and run in a Docker container on EC2, and then pushed to DockerHub for easy access and sharing.","archived":false,"fork":false,"pushed_at":"2024-09-04T13:59:31.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-18T05:40:39.303Z","etag":null,"topics":["containerization","django","docker"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leju-b.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-27T08:59:39.000Z","updated_at":"2025-02-04T07:17:35.000Z","dependencies_parsed_at":"2024-08-27T10:23:47.844Z","dependency_job_id":"8c360a75-eb36-4856-8a40-90bd8b338b3b","html_url":"https://github.com/leju-b/Docker-simple-django-blog","commit_stats":null,"previous_names":["leju-b/simple-django-blog","leju-b/docker-simple-django-blog"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/leju-b/Docker-simple-django-blog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leju-b%2FDocker-simple-django-blog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leju-b%2FDocker-simple-django-blog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leju-b%2FDocker-simple-django-blog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leju-b%2FDocker-simple-django-blog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leju-b","download_url":"https://codeload.github.com/leju-b/Docker-simple-django-blog/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leju-b%2FDocker-simple-django-blog/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32775037,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"ssl_error","status_checked_at":"2026-05-08T08:22:45.650Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["containerization","django","docker"],"created_at":"2024-12-16T20:16:19.546Z","updated_at":"2026-05-08T09:34:27.911Z","avatar_url":"https://github.com/leju-b.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# **Simple Django App Dockerization**\r\n\r\n## **Project Overview**\r\n\r\nThis project involves developing a simple Django application, containerizing it with Docker, and deploying it on an EC2 instance. The app will be built and run in a Docker container on EC2, and then pushed to DockerHub for easy access and sharing.\r\n\r\n## **Tech Stack**\r\n\r\n- **Backend:** Django\r\n- **Containerization:** Docker\r\n- **Deployment:** AWS EC2\r\n- **Container Registry:** DockerHub\r\n\r\n## **Getting Started**\r\n\r\n### **Prerequisites**\r\n\r\nEnsure you have the following installed:\r\n\r\n- **Docker:** [Install Docker](https://docs.docker.com/get-docker/)\r\n- **AWS CLI:** [Install AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html)\r\n- **EC2 Instance:** Set up an EC2 instance with Docker installed.\r\n\r\n### **Installation**\r\n\r\n1. **Fork the repository:**\r\n\r\n2. **Build the Docker image:**\r\n\r\n   ```bash\r\n   docker build -t yourusername/Docker-simple-django-blog .\r\n   ```\r\n\r\n3. **Run the Docker container:**\r\n\r\n   ```bash\r\n   docker run -d -p 8000:8000 yourusername/Docker-simple-django-blog\r\n   ```\r\n\r\n4. **View the app:**\r\n\r\n   Open your web browser and navigate to `http://localhost:8000/` to see the Django app running locally.\r\n\r\n### **Pushing to GitHub**\r\n\r\n1. **Initialize a Git repository:**\r\n\r\n   ```bash\r\n   git init\r\n   ```\r\n\r\n2. **Add and commit your files:**\r\n\r\n   ```bash\r\n   git add .\r\n   git commit -m \"Initial commit\"\r\n   ```\r\n\r\n3. **Push to GitHub:**\r\n\r\n   ```bash\r\n   git remote add origin https://github.com/yourusername/simple-django-docker.git\r\n   git push -u origin main\r\n   ```\r\n\r\n### **Deploying on EC2**\r\n\r\n1. **SSH into your EC2 instance:**\r\n\r\n   ```bash\r\n   ssh -i your-key.pem ubuntu@your-ec2-public-ip\r\n   ```\r\n\r\n2. **Clone your GitHub repository:**\r\n\r\n   ```bash\r\n   git clone https://github.com/yourusername/simple-django-docker.git\r\n   cd simple-django-docker\r\n   ```\r\n\r\n3. **Build the Docker image on EC2:**\r\n\r\n   ```bash\r\n   docker build -t yourusername/simple-django-app .\r\n   ```\r\n\r\n4. **Run the Docker container on EC2:**\r\n\r\n   ```bash\r\n   docker run -d -p 8000:8000 yourusername/simple-django-app\r\n   ```\r\n\r\n5. **View the app from EC2:**\r\n\r\n   Open your web browser and navigate to `http://your-ec2-public-ip:8000/` to see the Django app running from your EC2 instance.\r\n\r\n### **Pushing to DockerHub**\r\n\r\n1. **Log in to DockerHub:**\r\n\r\n   ```bash\r\n   docker login\r\n   ```\r\n\r\n2. **Tag your Docker image:**\r\n\r\n   ```bash\r\n   docker tag yourusername/simple-django-app yourusername/simple-django-app:v1\r\n   ```\r\n\r\n3. **Push the image to DockerHub:**\r\n\r\n   ```bash\r\n   docker push yourusername/simple-django-app:v1\r\n   ```\r\n\r\n## **Configuration**\r\n\r\n### **Dockerfile**\r\n\r\nHere’s a basic Dockerfile used to containerize the Django app:\r\n\r\n```Dockerfile\r\n# Use an official Python runtime as a parent image\r\nFROM python:3.9-slim\r\n\r\n# Set the working directory in the container\r\nWORKDIR /app\r\n\r\n# Copy the current directory contents into the container at /app\r\nCOPY . /app\r\n\r\n# Install any needed packages specified in requirements.txt\r\nRUN pip install --no-cache-dir -r requirements.txt\r\n\r\n# Make port 8000 available to the world outside this container\r\nEXPOSE 8000\r\n\r\n# Define environment variable\r\nENV DJANGO_ENV=production\r\n\r\n# Run the command to start uWSGI\r\nCMD [\"python\", \"manage.py\", \"runserver\", \"0.0.0.0:8000\"]\r\n```\r\nThe docker file uses the base image of Linux which is python slim for a Django app.\r\n\r\n### **requirements.txt**\r\n\r\nSpecify the dependencies needed for the Django app:\r\n\r\n```\r\nDjango==4.0.4\r\n```\r\n\r\n## **Usage**\r\n\r\n- **Starting the container:**\r\n  ```bash\r\n  docker start container_id\r\n  ```\r\n\r\n- **Stopping the container:**\r\n  ```bash\r\n  docker stop container_id\r\n  ```\r\n\r\n- **Checking logs:**\r\n  ```bash\r\n  docker logs container_id\r\n  ```\r\n\r\n## **Future Improvements**\r\n\r\n- **Automate the deployment** with CI/CD pipelines.\r\n- **Scale the application** using Docker Swarm or Kubernetes.\r\n- **Secure the application** with HTTPS and environment variable management.\r\n\r\n## **Thanks**\r\n\r\nA special shoutout to Abhishek Veeramalla for his incredibly helpful [DevOps playlist](https://www.youtube.com/playlist?list=PLdpzxOOAlwvIKMhk8WhzN1pYoJ1YU8Csa). His content was instrumental in guiding me through this process—if you're looking to level up your DevOps skills, I highly recommend checking it out! 🙌\r\n\r\n## **License**\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleju-b%2Fdocker-simple-django-blog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleju-b%2Fdocker-simple-django-blog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleju-b%2Fdocker-simple-django-blog/lists"}