A full-stack web application built with Python and Flask that enables users to create, share, and interact with news content in a social platform format
- Description
- Features
- Screenshots
- Technical Details
- Installation
- Usage
- Contributing
- License
- Questions
PythonPress is a full-stack web application that demonstrates modern Python web development using Flask. This platform provides a dynamic environment where users can share, discuss, and interact with news content in a social format. Built with SQLAlchemy ORM and robust authentication practices, the application implements secure user management, RESTful API endpoints, and interactive features.
The application uses bcrypt for password security and Flask sessions for authentication, enabling users to post articles, engage in discussions through comments, and participate in content curation through upvoting. The database architecture uses SQLAlchemy relationships to manage user data, posts, comments, and votes efficiently, while custom Jinja filters help format dates, URLs, and text content.
Visit the live website at: https://pythonpress-64ffcf772c54.herokuapp.com
-
User Authentication
- Secure registration with email validation
- Password hashing using bcrypt
- Flask session-based authentication
- Protected routes via login_required decorator
- Automatic login after registration
-
Content Management
- Create posts with titles and URLs
- Edit and delete post functionality
- Personal dashboard for post management
- Post history tracking with timestamps
- URL sanitization and formatting
-
Interactive Features
- Comment system with user attribution
- Upvoting functionality with vote counting
- Dynamic comment updates
- Post sorting by creation date
- User-specific content filtering
-
User Interface
- Clean and intuitive dashboard design
- Real-time content updates
- Responsive layout for all devices
- Dynamic form validation feedback
- Streamlined post creation and editing
This newsfeed platform was built using the following technologies and features:
-
Flask Framework: Modular application structure:
- Blueprint organization for home, dashboard, and API routes
- Custom login_required decorator for route protection
- Session-based user state management
- Custom Jinja filters for data formatting
- Static file serving configuration
-
Database Architecture: SQLAlchemy implementation:
- User Model: Username, email, and hashed password fields
- Post Model: Title, URL, and vote count with relationships
- Comment Model: Text content with user attribution
- Vote Model: Many-to-many relationship handling
- Cascading deletes for related data
-
Authentication System:
- Bcrypt password hashing with salt
- Email validation with @ verification
- Minimum password length enforcement
- Session-based login tracking
- Protected route access control
-
API Implementation:
- RESTful endpoints for CRUD operations
- JSON response formatting
- Error handling with status codes
- Transaction management with rollbacks
- Asynchronous JavaScript requests
-
Frontend Features:
- Date formatting for post timestamps
- URL sanitization for post links
- Word pluralization handling
- Form validation and error display
- Dynamic content updates without reload
- Python 3.x
- pip (Python package installer)
- MySQL (or another SQL database)
-
Clone the Repository
git clone https://github.com/kyoriku/PythonPress.git
-
Navigate to the project directory
cd PythonPress -
Set up a virtual environment
python3 -m venv venv source venv/bin/activate # for macOS/Linux # or venv\Scripts\activate # for Windows
-
Install dependencies
pip install -r requirements.txt
-
Configure environment variables
Create a
.envfile in the root directory with:DB_URL=mysql+pymysql://<username>:<password>@localhost/python_press_db
Replace
<username>with your MySQL username, and<password>with your MySQL password -
Initialize the database
mysql -u root -p CREATE DATABASE python_press_db;
-
Start the application
flask run
-
Navigate to the website
http://127.0.0.1:5000
-
Create an account to:
- Share and manage your posts
- Engage with content through comments
- Upvote interesting articles
- Access your personal dashboard
Contributions are welcome! Here are ways you can help:
- Fork the repository
- Create a feature branch
git checkout -b feature/YourFeature
- Make your changes - this could include:
- Adding new features
- Improving the UI/UX
- Optimizing database queries
- Enhancing security
- Bug fixes
- Commit your changes
- Push to your branch
- Open a Pull Request
Please ensure your contributions:
- Follow the existing code style
- Include appropriate error handling
- Test all changes locally
- Include clear descriptions in your pull request
This project is licensed under the MIT license - see the LICENSE file for details.
For any questions, feel free to email me at devkyoriku@gmail.com.



