A mini Django REST Framework API for building a social media application. It offers essential features like user accounts, posts, comments, notifications, and tag-based post retrieval.
Features
- User Accounts:
- Login and registration
- Profile management
- Follower/following functionality
- Secure authentication with JSON Web Tokens (JWT)
- Posts:
- Create, read, update, and delete posts
- Like and save posts
- Retrieve posts by code and liked/saved posts for a user
- Comments:
- Create, read, update, and delete comments
- Like comments
- Get comments for a specific post
- Notifications:
- View inbox notifications
- Get notification badge count
- Mark all notifications as read
- Tags:
- Retrieve posts by tag name
Installation
Prerequisites
- Python (version 3.7 or later recommended)
- pip (package installer for Python)
Setting Up a Virtual Environment (Recommended)
Mac/Linux:
- Open your terminal.
- Create a virtual environment using
python3 -m venv venv
- Activate the environment:
source venv/bin/activate
Windows:
- Open your command prompt.
- Create a virtual environment using
python -m venv venv
. - Activate the environment:
venv\Scripts\activate
Installing Dependencies
Inside the activated virtual environment, run:
shellpip install -r requirements.txt
Usage
-
Clone this repository:
shellgit clone https://github.com/kimkorngmao/jaitaw.git
-
Navigate to the project directory:
shellcd jaitaw
-
Create a local copy of the
.env
file (located in the project root) and add environment variables.envSECRET_KEY=your_secret_key DEBUG=True ALLOWED_HOSTS=localhost,127.0.0.1 # Add additional allowed hosts if needed
-
Apply database migrations:
shellpython manage.py migrate
-
Run the development server:
shellpython manage.py runserver
This will typically start the server at
http://127.0.0.1:8000/
. Access the API documentation at the root path for detailed usage instructions.
API Documentation
Detailed API documentation is available at http://127.0.0.1:8000/
when the development server is running. It provides comprehensive information about endpoints, request methods, parameters, responses, and authentication requirements.