This project is a miniature Facebook-like web application built using Django. It allows users to create profiles, post status messages, upload images, manage friendships, and view a custom news feed. The app supports user authentication and was developed incrementally through multiple feature-based assignments.
The Mini Facebook app enables users to:
- Create and update personal profiles
- Post and edit status updates with image uploads
- Add and view friends
- Get friend suggestions
- See a personalized news feed
- Register, log in, and log out securely
This Django project leverages Django’s class-based views, form handling, and ORM features to provide a full-stack social experience.
Defines the core data structures:
Profile: User-linked profile with name, city, email, and imageStatusMessage: Timestamps and messages tied to a profileImage: File uploads associated with status messagesFriend: Bi-directional friendship relationships between profiles
Implements the logic for each page:
ShowAllProfilesView,ShowProfilePageView- Profile creation (
CreateProfileView) and updates (UpdateProfileView) - Status message creation, update, and deletion
- Friend adding (
CreateFriendView) and suggestions - News feed display (
ShowNewsFeedView) - Login-required behavior via
LoginRequiredMixin
Handles form input for:
- Profile creation and update
- Status message submission
- User registration via
UserCreationForm
Uses class-based view templates for:
- Creating/updating profiles and posts
- Viewing profiles, friend suggestions, and news feed
- Logging in and out
Maps routes to views:
- Profile and post management
- Friend handling
- Authentication (login/logout)
- News feed and friend suggestions
Registers models to the Django admin interface:
Profile,StatusMessage,Image, andFriend
Defines the app as mini_fb.
- User registration and login with Django's built-in auth system
- Profile and status management
- Media upload (images) and rendering
- Friendship logic with bidirectional tracking
- Friend suggestion algorithm excluding existing connections
- News feed combining user and friend activity
- Custom
get_absolute_url,get_friends, andget_news_feedmodel methods
- Install dependencies:
pip install -r requirements.txt pip install django pillow
- Apply Migrations
python manage.py makemigrations python manage.py migrate
- Create a superuser for the admin interface:
python manage.py createsuperuser
- Run the server
python manage.py runserver