This project is a social networking platform built with Django, allowing users to create and share posts, follow other users, and engage with content through comments and subscriptions. The application includes user authentication, pagination, caching, and error handling for a smooth user experience.
- index: Displays a paginated list of all posts, cached for 20 seconds.
- group_posts: Displays posts related to a specific group.
- profile: Displays a user's profile, their posts, and follower statistics.
- post_view: Displays a specific post along with comments.
- view_image: Displays an image attached to a post.
- new_post: Allows logged-in users to create a new post.
- post_edit: Allows the author of a post to edit it.
- add_comment: Enables users to add comments to posts.
- follow_index: Shows posts from users that the logged-in user follows.
- profile_follow: Allows users to follow another user.
- profile_unfollow: Allows users to unfollow another user.
- page_not_found (404): Renders a custom 404 page.
- server_error (500): Renders a custom 500 page.
All post listings (index, group posts, profile posts, follow index) are paginated to display 10 posts per page.
The index view is cached using Django's cache_page decorator.
All post-creation, editing, commenting, and following actions require user authentication. The login_required decorator ensures only authenticated users can perform these actions.
- Django framework
- Django authentication system
- Django pagination
- Django ORM for database interactions
- Clone the repository:
git clone <repository_url> cd <project_directory>
- Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
- Install dependencies:
pip install -r requirements.txt
- Apply database migrations:
python manage.py migrate
- Run the development server:
python manage.py runserver
- Creating Posts: Users can create, edit, and delete posts with text and images.
- Following Users: Users can follow and unfollow others to customize their feed.
- Commenting: Users can leave comments on posts.
- User Profiles: Each user has a profile displaying their posts and follower statistics.
- Group Pages: Users can view posts related to specific topics or groups.
- Authentication: Secure user authentication system with login/logout functionality.
Социальная сеть для блогеров
Это учебный проект, созданный в целях практики работы с Python.