This is a Django-based project for managing blog posts. Users can register, log in, create, edit, delete, and search blog posts. Each user can only edit or delete their own blog posts.
- User authentication (Registration, Login, Logout)
- Create, read, update, and delete (CRUD) operations for blogs
- Search functionality for blog posts
- Restriction: Users can edit or delete only their own blogs
Ensure you have the following installed:
- Python 3.8+
- Django 4.0+
- pip (Python package installer)
-
Clone the repository:
git clone https://github.com/SimranShaikh20/BlogVault cd blog-project
-
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Run migrations:
python manage.py makemigrations python manage.py migrate
-
Start the development server:
python manage.py runserver
-
Access the application: Open your web browser and go to
http://127.0.0.1:8000/
.
blog-project/
├── app_name/ # Replace with your app name
│ ├── migrations/ # Database migration files
│ ├── templates/ # HTML templates
│ │ ├── app_name/ # Replace with your app name
│ │ ├── blog_list.html # List view for blogs
│ │ ├── blog_form.html # Form for creating/editing blogs
│ │ ├── register.html # User registration page
│ │ ├── login.html # User login page
│ └── views.py # Application views
├── manage.py # Django management script
└── requirements.txt # Project dependencies
Contains the logic for handling requests and rendering templates.
blog_list
: Displays a list of blog posts with search functionality.blog_create
: Allows users to create a new blog post.blog_edit
: Allows users to edit their own blog posts.blog_delete
: Allows users to delete their own blog posts.register
: Handles user registration.login_view
: Handles user login.logout_view
: Logs the user out.
Defines URL patterns for routing requests to the appropriate views.
Defines the Blog
model for storing blog post data in the database.
Contains form definitions for user registration and blog post creation/editing.
Displays the list of blog posts with a search bar.
Form template for creating and editing blog posts.
Template for user registration.
Template for user login.
- Navigate to
/register/
. - Fill in the registration form and submit.
- Navigate to
/login/
. - Enter your credentials and submit.
- Log in to your account.
- Navigate to
/create/
. - Fill out the form and submit.
- Log in to your account.
- Navigate to the blog list.
- Click on "Edit" or "Delete" for the blog post you own.
- Use the search bar on the blog list page to filter posts by keywords.
This project is licensed under the MIT License.
Contributions are welcome! Please fork the repository and create a pull request with your changes.
For questions or suggestions, please contact:
- Name: Simran Shaikh