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