A feature-rich Reddit clone built using Django for the backend and Angular for the frontend. This project allows users to create, interact, and engage in discussions within communities.
- User Authentication: Sign up, log in, and manage accounts securely.
- Create & Interact with Posts: Standalone and group-based posts with threaded discussions.
- Community Features: Users can create and join groups (public, private, or restricted).
- Engagement Mechanisms: Upvote/downvote system for posts and comments.
- Social Interaction: Follow users and posts.
- Content Moderation: Report inappropriate content.
- Bookmarks & Saves: Users can save their favorite posts.
- Invites & Membership Requests: Manage group access through invites and requests.
- Python 3.8+
- virtualenv
- WSL (Windows Subsystem for Linux)
- Angular 10.2.4 (or 10.2.5)
- Node 10.13.x+
-
Clone the repository and navigate to the project directory:
git clone https://github.com/madhvi-n/django-reddit.git cd django-reddit
-
Create and activate a virtual environment:
virtualenv venv source venv/bin/activate # For macOS/Linux venv\Scripts\activate # For Windows
-
Install dependencies:
pip install -r requirements.txt
-
Set the Django Secret Key:
- Edit
reddit_clone/settings.py
and manually set a secret key. - Or, export
SECRET_KEY
in your environment variables.
- Edit
-
Apply database migrations:
python manage.py migrate
-
Run the development server:
python manage.py runserver
Visit
http://127.0.0.1:8000/
to access the app.
-
Navigate to the frontend directory:
cd static/frontend/reddit-app
-
Install Angular dependencies:
npm install
-
Run the frontend development server:
ng serve
Visit
http://127.0.0.1:4200/
to access the frontend.
The API documentation is available via Swagger:
- Swagger UI:
http://127.0.0.1:8000/api/swagger/
- Redoc:
http://127.0.0.1:8000/api/redoc/
Create a .env
file to store sensitive configuration details:
SECRET_KEY=your_secret_key
DEBUG=True
DATABASE_NAME=my_db
DATABASE_USER=my_username
DATABASE_PASSWORD=my_db_password
DATABASE_HOST=localhost
DATABASE_PORT=5432
from django.contrib.auth.models import User
from posts.models import Post
from groups.models import Group
user = User.objects.get(id=1)
post = Post.objects.create(title="Sample Post", content="Post content here", author=user)
group = Group.objects.create(name="Django", description="Official Django community on Django Reddit")
python manage.py populate_users
python manage.py populate_posts
python manage.py populate_tags
python manage.py populate_groups
- Backend (Django) runs on WSL
- Frontend (Angular) runs directly on Windows