- Features
- Tech Stack
- Applications
- Requirements
- Installation
- Docker configuration
- AWS S3 Configuration
- Database Schema
- User Registration and Authentication
- Profile Management
- Post Creation and Management
- Comment Creation and Management
- Connections Creation and Management
- Real-time notifications
- User
- Post
- Connection
- Framework: Django
- API: Django Rest Framework (DRF)
- Database: PostgreSQL
- Channels backend: Redis
- Authentication: SessionAuth
- Containerization: Docker
- Proxy Server: Nginx
- Storage: AWS S3*
- HTML/CSS
- JavaScript
- JQuery
*production only
- Docker
- Docker Compose
-
Clone the Repository:
git clone https://github.com/BGabor01/TrendLink.git
-
Create an .env File:
Create an .env file in the project root with the following content:
# Django Settings DJANGO_SECRET_KEY=your_secret_key # PostgreSQL Database Settings POSTGRES_DB=your_db_name POSTGRES_USER=your_db_user POSTGRES_PASSWORD=your_db_password # AWS S3 Settings (Production only) AWS_ACCESS_KEY_ID=your_access_key_id AWS_SECRET_ACCESS_KEY=your_secret_access_key AWS_STORAGE_BUCKET_NAME=your_bucket_name AWS_S3_REGION_NAME=region_of_your_bucket
-
Build the docker containers
docker-compose build
-
Start the applications:
docker-compose up
The DockerFile uses the python:3.11-slim
base image.
The services are defined in the docker-compose.yml
.
Django
- Service name:
django
Database (PostgreSQL)
- Service name:
postgres
Channels backend (Redis)
- Service name:
redis
Nginx
- Service name:
nginx
- The configuration file is located at
trend_link/nginx.conf
.
AWS S3 is used for storing static and media files in production.
Follow these steps to configure AWS S3.
-
Create an S3 Bucket:
- Go to the AWS S3 console and create a new bucket.
- Disable the block public access settings to allow public access to the bucket.
-
Configure Bucket Policies
- Set the appropriate bucket policy to allow public read access.
Example
{ "Version": "2012-10-17", "Statement": [ { "Sid": "PublicReadGetObject", "Effect": "Allow", "Principal": "*", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::your_bucket_name/*" } ] }
- Configure CORS policy for the bucket
Example
[ { "AllowedHeaders": ["*"], "AllowedMethods": ["GET"], "AllowedOrigins": ["*"], "ExposeHeaders": [] } ]
-
Set Up IAM Permissions
- Create an
IAM
user withAmazonS3FullAccess
permissions. - Generate access keys for the IAM user.
- Create an