Skip to content

adityabhalsod/django-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django Setup Application - Complete Technical Guide

Overview

This is a complete Django full-stack application with Docker setup that includes:

  • Django Web Console (CRUD with Bootstrap)
  • Django REST API (CRUD operations)
  • Django WebSocket + Channels + Redis (Chat Application)
  • Django Celery (Background Tasks and Scheduling)
  • Django + PostgreSQL database

Prerequisites

  • Docker and Docker Compose installed
  • Git (optional, for version control)
  • Basic knowledge of Django and Docker

Running the Application

1. Start Docker Containers

docker-compose up --build

2. Run Migrations

In a new terminal:

docker-compose exec django python manage.py makemigrations
docker-compose exec django python manage.py migrate

3. Create Superuser

docker-compose exec django python manage.py createsuperuser

4. Collect Static Files

docker-compose exec django python manage.py collectstatic --noinput

Accessing the Application

Running Background Tasks

Run a Sample Task

docker-compose exec web python manage.py shell -c "
from apps.tasks.tasks import sample_background_task;
result = sample_background_task.delay('test parameter');
print(f'Task ID: {result.id}')
"

Schedule Periodic Tasks

  1. Go to Django Admin: http://localhost:8000/admin/
  2. Navigate to "Periodic Tasks"
  3. Create a new periodic task using the scheduled_task function

Troubleshooting

Common Issues and Solutions

1. Static Files Not Loading

# Collect static files
docker-compose exec web python manage.py collectstatic --noinput

# Check static files directory
docker-compose exec web ls -la staticfiles/

2. Migration Issues

# Show migration status
docker-compose exec web python manage.py showmigrations

# Reset migrations (⚠️ For development only)
docker-compose exec web python manage.py migrate console zero
docker-compose exec web python manage.py makemigrations console
docker-compose exec web python manage.py migrate

Features Summary

1. Django Web Console

  • Full CRUD operations with Bootstrap UI
  • Comprehensive form with all Django field types
  • File uploads (images, documents)
  • Rich form validation
  • Responsive design

2. Django REST API

  • Full CRUD API endpoints
  • JSON serialization
  • Authentication support -Browsable API interface

3. WebSocket Chat Application

  • Real-time messaging
  • Persistent message storage
  • Connection management
  • Reconnection handling
  • Bootstrap-styled interface

4. Celery Background Tasks

  • Asynchronous task processing
  • Scheduled tasks with Celery Beat
  • Task monitoring
  • Database-backed results

5. PostgreSQL Database

  • Production-ready database
  • Data persistence
  • Proper indexing
  • Relationship handling

6. Redis Integration

  • WebSocket channel layer
  • Celery broker
  • Caching support
  • High performance

About

Django Create read update delete application

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •