Skip to content

Unixxxxxx/login

Repository files navigation

██████╗      ██╗ █████╗ ███╗   ██╗ ██████╗  ██████╗
██╔══██╗     ██║██╔══██╗████╗  ██║██╔════╝ ██╔═══██╗
██║  ██║     ██║███████║██╔██╗ ██║██║  ███╗██║   ██║
██║  ██║██   ██║██╔══██║██║╚██╗██║██║   ██║██║   ██║
██████╔╝╚█████╔╝██║  ██║██║ ╚████║╚██████╔╝╚██████╔╝
╚═════╝  ╚════╝ ╚═╝  ╚═╝╚═╝  ╚═══╝ ╚═════╝  ╚═════╝
          Login & Blog App  |  Docker  |  CI/CD

Django Docker GitHub Actions Python License


A powerful Django-based web application featuring modular apps for user authentication, blog post management, and extended utilities — fully containerised with Docker and automated with GitHub Actions CI/CD.


✨ Features  ·  📁 Structure  ·  🚀 Quick Start  ·  🐳 Docker  ·  🔁 CI/CD  ·  📦 Dependencies


✨ Features

# Feature Description
🔐 User Authentication Secure login and registration system
📝 Blog Management Create, list, and manage blog posts
📁 Media Uploads Handle images and Excel file uploads
📊 Excel Processing Read and store data from .xlsx files
📜 Admin Access Logs Track admin activity via log files
🐳 Dockerized Setup One-command container build & run
🔄 CI/CD Pipeline Auto-build, push, and deploy on commit

🗂️ Project Structure

django-login-blog/
│
├── 📄 Dockerfile                   # Docker image configuration
├── 📄 manage.py                    # Django entry point
├── 📄 requirements.txt             # Python dependencies
├── 📄 cb.sqlite3                   # SQLite database
├── 📄 user_data.xlsx               # Sample Excel data file
│
├── 📂 templates/                   # HTML UI templates
│   ├── base.html                   # Base layout template
│   ├── index.html                  # Home page
│   ├── form.html                   # Form page
│   ├── blog.html                   # Blog listing page
│   ├── Thankyou.html               # Success / thank-you page
│   └── myapp/
│       └── pdf_list.html           # PDF listing template
│
├── 📂 media/                       # User-uploaded files
│   ├── blog_image/                 # Blog post images
│   └── user_data.xlsx              # Uploaded Excel data
│
├── 📂 log/
│   └── admin_access.log            # Admin activity log
│
├── 📂 login/                       # 🔐 Authentication app
│   ├── settings.py                 # Project settings
│   ├── views.py                    # Login/register views
│   ├── urls.py                     # URL routing
│   ├── wsgi.py                     # WSGI entry point
│   └── asgi.py                     # ASGI entry point
│
├── 📂 myapp/                       # 📝 Blog logic app
│   ├── models.py                   # Blog data models
│   ├── forms.py                    # Blog forms
│   ├── views.py                    # Blog views
│   ├── urls.py                     # Blog URL routing
│   └── migrations/                 # Database migrations
│
├── 📂 myapp1/                      # 🔧 Extended feature module
│   ├── models.py                   # Extended models
│   ├── views.py                    # Extended views
│   └── urls.py                     # Extended URL routing
│
└── 📂 .github/
    └── workflows/
        └── deploy.yml              # 🔄 GitHub Actions CI/CD workflow

🚀 Quick Start

Prerequisites

Python Django Docker

1️⃣   Clone the Repository

git clone https://github.com/Unixxxxxx/django-login-blog.git
cd django-login-blog

2️⃣   Install Dependencies

pip install -r requirements.txt

3️⃣   Apply Migrations

python manage.py migrate

4️⃣   Run Development Server

python manage.py runserver

✅ Visit http://localhost:8000 in your browser.


🐳 Docker Deployment

Step 1 — Build the Image

docker build -t mynewapp .

Step 2 — Run the Container

docker run -d -p 8000:8000 mynewapp

✅ Visit http://localhost:8000 — your app is live inside Docker.

Useful Docker Commands

# View running containers
docker ps

# Stop the container
docker stop <container_id>

# View logs
docker logs <container_id>

🔁 CI/CD Pipeline

Deployment is fully automated via GitHub Actions on every push to main.

📦 Push to main
    │
    ├── ✅  Build Docker image
    ├── ✅  Login to Docker Hub
    └── ✅  Push image to Docker Hub

Workflow file location:

.github/workflows/deploy.yml

Workflow overview:

name: CI/CD Pipeline

on:
  push:
    branches: [main]

jobs:
  build-and-push:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Build Docker image
        run: docker build -t ${{ secrets.DOCKER_USERNAME }}/mynewapp .
      - name: Login to Docker Hub
        run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
      - name: Push to Docker Hub
        run: docker push ${{ secrets.DOCKER_USERNAME }}/mynewapp

📦 Dependencies

Install all dependencies with a single command:

pip install -r requirements.txt

Core packages:

Package Purpose
django Web framework
pillow Image upload handling
openpyxl Excel file processing
gunicorn Production WSGI server

📂 Data & Media Handling

📁 Media Files    →   media/blog_image/        (blog post images)
📊 Excel Files    →   media/user_data.xlsx     (uploaded data)
📜 Admin Logs     →   log/admin_access.log     (access tracking)
🗃️  Database       →   cb.sqlite3               (SQLite — dev only)

⚠️ Production Note: Replace cb.sqlite3 with PostgreSQL or MySQL for production deployments.


🙋‍♂️ Author


Sudhanshu Kumar

🛠️ DevSecOps Enthusiast  |  💻 Python & Django Developer


LinkedIn Portfolio Email



📜 License

MIT License — free to use, modify, and distribute.
See the LICENSE file for full terms.


Built with Django   Made by Sudhanshu   License MIT

About

Django Login & Blog App is a full-stack web application developed using the Django framework, designed to demonstrate a modular, production-ready architecture for real-world deployment. The application is structured around three distinct Django apps: login, which handles secure user authentication including registration, login, and session handling

Resources

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors