A Django-based social media application similar to Twitter, where users can create, edit, delete, and search tweets with photo uploads.
- π User Authentication: Register and login system with Django's built-in authentication
- π Tweet Management: Create, edit, and delete tweets (up to 240 characters)
- πΈ Photo Uploads: Add images to your tweets
- π Advanced Search: Search tweets by content or username with real-time filtering
- π€ User Profiles: Each tweet is associated with a user
- π¨ Modern UI: Bootstrap 5 dark theme interface with responsive design
- π Authorization: Users can only edit/delete their own tweets
- βοΈ Admin Panel: Easy access to Django admin for content management
- Backend: Django 6.0
- Database: SQLite (default)
- Image Processing: Pillow 12.0.0
- Frontend: Bootstrap 5.3.8
- Python: 3.x
- Python 3.8 or higher
- pip (Python package manager)
-
Clone the repository
git clone https://github.com/Sg-2003/Django-Tweet-App.git cd Django-Tweet-App/chaiwala -
Create a virtual environment (recommended)
python -m venv venv
-
Activate the virtual environment
- On Windows:
venv\Scripts\activate
- On macOS/Linux:
source venv/bin/activate
- On Windows:
-
Install dependencies
pip install -r ../requirements.txt
-
Run migrations
python manage.py migrate
-
Create a superuser (optional, for admin access)
python manage.py createsuperuser
-
Run the development server
python manage.py runserver
The server will start on
http://127.0.0.1:8000/ -
Access the application
- Main Application:
http://127.0.0.1:8000/tweet/ - Admin Panel:
http://127.0.0.1:8000/admin/ - User Registration:
http://127.0.0.1:8000/accounts/register/ - User Login:
http://127.0.0.1:8000/accounts/login/
- Main Application:
The application includes a clean navigation bar with the following options:
- TweetApp (brand logo) - Links to admin panel
- Admin - Direct link to Django admin panel
- Search Bar - Search tweets by content or username
- Tweet Home - Navigate to the main tweets page
- Register/Login - User authentication (when not logged in)
- Logout - Sign out (when logged in)
- Click on the Register button in the navbar
- Fill in your username, email, and password
- You'll be automatically logged in after registration
- Log in to your account
- Navigate to the Tweet Home page
- Click on "Add Tweets Here:" button
- Enter your tweet text (max 240 characters)
- Optionally upload a photo
- Click Submit to post your tweet
- Only your own tweets will show Edit and Delete buttons
- Click Edit to modify your tweet
- Click Delete to remove your tweet (confirmation required)
- Use the search bar in the navbar
- Type your search query and press Enter or click Search
- Search by tweet content or username (case-insensitive)
- A search results banner will appear showing your query
- Click Clear Search to view all tweets again
- Click the Admin button in the navbar or the TweetApp brand logo
- You must be logged in as a superuser to access the admin panel
- Create a superuser using:
python manage.py createsuperuser
Django-Tweet-App/
βββ chaiwala/ # Main Django project
β βββ chaiwala/ # Project settings
β β βββ __init__.py
β β βββ settings.py
β β βββ urls.py
β β βββ wsgi.py
β β βββ asgi.py
β βββ tweet/ # Tweet application
β β βββ migrations/
β β βββ templates/
β β β βββ tweet_list.html
β β β βββ tweet_form.html
β β β βββ tweet_confirm_delete.html
β β βββ models.py
β β βββ views.py
β β βββ forms.py
β β βββ urls.py
β βββ templates/ # Base templates
β β βββ layout.html
β β βββ registration/
β β βββ login.html
β β βββ logout.html
β β βββ register.html
β βββ media/ # User uploaded files
β β βββ photos/
β βββ static/ # Static files
β βββ db.sqlite3 # SQLite database
β βββ manage.py
βββ requirements.txt # Python dependencies
βββ README.md
user: ForeignKey to User (who created the tweet)text: TextField (max 240 characters)photo: ImageField (optional)created_at: DateTimeField (auto-generated)updated_at: DateTimeField (auto-updated)
/tweet/- List all tweets (home page)/tweet/create- Create a new tweet (login required)/tweet/<id>/edit/- Edit a tweet (login required, owner only)/tweet/<id>/delete/- Delete a tweet (login required, owner only)/accounts/register/- User registration/accounts/login/- User login/accounts/logout/- User logout/admin/- Django admin panel
The navbar includes:
- Brand Logo (TweetApp): Links to admin panel
- Admin Link: Quick access to Django admin
- Search Bar: Real-time tweet search functionality
- Tweet Home Button: Navigate to main tweets feed
- Authentication Buttons: Register/Login (when logged out) or Logout (when logged in)
- Tweet List: Displays all tweets in a card-based layout
- Tweet Form: Create or edit tweets with photo upload
- Search Results: Filtered view of tweets matching search criteria
- User Registration: Account creation form
- User Login: Authentication form
cd chaiwala
python manage.py runserverpython manage.py testpython manage.py makemigrationspython manage.py migratepython manage.py createsuperuserpython manage.py collectstatic- Change
SECRET_KEYinsettings.py - Set
DEBUG = False - Configure
ALLOWED_HOSTS - Use a production database (PostgreSQL, MySQL, etc.)
- Set up proper static file serving
- Configure HTTPS
- Review Django security checklist: https://docs.djangoproject.com/en/6.0/howto/deployment/checklist/
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is open source and available under the MIT License.
Sg-2003
- GitHub: @Sg-2003
- Django Documentation
- Bootstrap for the UI framework
- Pillow for image processing
Note: This is a development project. For production use, please follow Django's deployment guidelines and security best practices.