Skip to content

Latest commit

 

History

History
162 lines (116 loc) · 5.1 KB

README.MD

File metadata and controls

162 lines (116 loc) · 5.1 KB

Django Reddit

Django CI CodeQL Python Django Django Rest Framework Angular

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.

🚀 Features

  • 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.

📸 Screenshots

Django Reddit Sign In Page

Django Reddit Feed

Django Reddit Group

Django Reddit User Feed


🔧 Requirements

Backend

  • Python 3.8+
  • virtualenv
  • WSL (Windows Subsystem for Linux)

Frontend

  • Angular 10.2.4 (or 10.2.5)
  • Node 10.13.x+

⚙️ Installation

Backend Setup

  1. Clone the repository and navigate to the project directory:

    git clone https://github.com/madhvi-n/django-reddit.git
    cd django-reddit
  2. Create and activate a virtual environment:

    virtualenv venv
    source venv/bin/activate  # For macOS/Linux
    venv\Scripts\activate     # For Windows
  3. Install dependencies:

    pip install -r requirements.txt
  4. Set the Django Secret Key:

    • Edit reddit_clone/settings.py and manually set a secret key.
    • Or, export SECRET_KEY in your environment variables.
  5. Apply database migrations:

    python manage.py migrate
  6. Run the development server:

    python manage.py runserver

    Visit http://127.0.0.1:8000/ to access the app.

🌐 Frontend Setup

  1. Navigate to the frontend directory:

    cd static/frontend/reddit-app
  2. Install Angular dependencies:

    npm install
  3. Run the frontend development server:

    ng serve

    Visit http://127.0.0.1:4200/ to access the frontend.

📝 API Documentation

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/

⚙️ Environment Variables

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

📈 Management Commands

Generate Data in Django Shell

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")

Populate Dummy Data

python manage.py populate_users
python manage.py populate_posts
python manage.py populate_tags
python manage.py populate_groups

💡 Notes

  • Backend (Django) runs on WSL
  • Frontend (Angular) runs directly on Windows

📐 References

🎉 Happy Coding! 🚀