A modern image sharing application built with Django, featuring user authentication, image uploads, and a responsive design.
- User authentication (login, register, logout)
- Image upload and management
- User profiles
- Image likes and comments
- Responsive design with Bootstrap
- Search functionality
- AWS S3 integration for media storage (in production)
- Docker (20.10+ recommended) - Install Docker
- Docker Compose (2.0+ recommended) - Included with Docker Desktop
- Python 3.11+ (for local development)
image-sharing-app/
├── image_sharing_app/ # Main Django app
├── templates/ # HTML templates
├── static/ # Static files
├── media/ # User uploaded files (not version controlled)
├── nginx/ # Nginx configuration
├── config/ # Django project settings
├── docker-compose.local.yml # Local development setup
├── docker-compose.prod.yml # Production setup
└── requirements.txt # Python dependencies
- Clone the repository:
git clone <repository-url>
cd image-sharing-app- Create and configure environment files:
cp .env.example .env.local
# Edit .env.local with your settings- Build and start the containers:
docker-compose -f docker-compose.local.yml --env-file .env.local up --build -d- Run the database migrations:
docker-compose -f docker-compose.local.yml --env-file .env.local exec web python manage.py migrate- Create a superuser (optional):
docker-compose -f docker-compose.local.yml --env-file .env.local exec web python manage.py createsuperuser- Access the application:
- Main site: http://127.0.0.1:8000
- Admin interface: http://127.0.0.1:8000/admin
For detailed production deployment instructions, please see the Deployment Guide.
# Start containers
docker-compose -f docker-compose.local.yml --env-file .env.local up -d
# Stop containers
docker-compose -f docker-compose.local.yml --env-file .env.local down
# Stop containers and remove volumes
docker-compose -f docker-compose.local.yml --env-file .env.local down -v
# View logs
docker-compose -f docker-compose.local.yml --env-file .env.local logs -f
# Create superuser
docker-compose -f docker-compose.local.yml --env-file .env.local exec web python manage.py createsuperuser
# Run migrations
docker-compose -f docker-compose.local.yml --env-file .env.local exec web python manage.py migrate
# Collect static files
docker-compose -f docker-compose.local.yml --env-file .env.local exec web python manage.py collectstaticThe application uses Docker volumes for data persistence:
image-sharing-app_media: Stores user-uploaded images and filesimage-sharing-app_static: Stores collected static filesimage-sharing-app_postgres_data: Stores the PostgreSQL database data
Important notes:
- Volume data is not pushed to GitHub
- Each developer needs to set up their own volumes locally
- In production, use proper backup strategies for volume data
If you encounter an error about a missing nginx directory, ensure that you have cloned the complete repository. The nginx directory contains configuration files needed for the web server and should be included in the repository.
If you experience permission issues with media uploads or static files, fix the permissions by running:
docker-compose -f docker-compose.local.yml --env-file .env.local exec web chmod -R 755 /app/media
docker-compose -f docker-compose.local.yml --env-file .env.local exec web chmod -R 755 /app/staticIf you encounter database connection errors, ensure:
- The PostgreSQL container is running (
docker-compose ps) - Your .env.local file has the correct database credentials
- You've run the migrations
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Django
- Bootstrap
- PostgreSQL
- Nginx
- Docker