Live Demo on Render: Pyblog
PyBlog is a complete, feature-rich blog application built on the Django web framework. This project demonstrates proficiency in full-stack web development, covering everything from user authentication and database management to static file handling and secure deployment. It serves as a personal portfolio piece showcasing a comprehensive understanding of modern web development principles and best practices.
- User Authentication & Authorization: Secure user registration, login, and logout. Users can only create, edit, or delete their own posts.
- Post Management (CRUD): A complete system for creating, reading, updating, and deleting blog posts.
- Image Uploads: Users can upload images directly to accompany their posts, demonstrating file handling and storage.
- Persistent File Storage: Implemented a solution to ensure user-uploaded images are not lost on server restarts or redeployments.
- Production-Ready Static File Handling: Implements
WhiteNoiseto efficiently serve static assets (CSS, JavaScript) in a production environment. - Dynamic Database: Utilizes PostgreSQL for robust data management, handling posts, users, and other data relationships.
- Contact Form: A functional contact page allows visitors to send messages to the site administrator.
- Python: The core programming language.
- Django: The high-level Python web framework used to build the application.
- Gunicorn: A Python WSGI HTTP server used to run the application in production.
- PostgreSQL: The relational database used for data persistence.
- HTML5 & CSS3: For structuring and styling the web pages.
- JavaScript: For interactive elements.
- Render: The cloud platform used for continuous deployment of the application.
- dj-database-url: A utility for easily configuring the database from a single
DATABASE_URLenvironment variable. - WhiteNoise: A library to handle the serving of static files from the Django app in production.
- Git: For version control.
To run this project on your local machine, follow these steps.
-
Clone the Repository:
git clone [https://github.com/meez-111/pyblog.git](https://github.com/meez-111/pyblog.git) cd pyblog -
Create and Activate a Virtual Environment:
python -m venv venv source venv/bin/activate -
Install Dependencies:
pip install -r requirements.txt
-
Database Migrations:
python manage.py makemigrations python manage.py migrate
-
Create a Superuser (Optional): To access the Django admin panel, create a superuser account.
python manage.py createsuperuser
-
Run the Development Server:
python manage.py runserver
The application will be available at
http://127.0.0.1:8000/.
In a production environment, user-uploaded files are lost on every server restart. To solve this problem use a Render Persistent Disk. This volume is mounted to the server, providing a durable location for media files that persists across deployments. This demonstrates an understanding of stateless services and the need for persistent storage in a production environment.
This project is deployed on Render and uses a PostgreSQL database.
- Build Command:
pip install -r requirements.txt && python manage.py collectstatic --no-input - Start Command:
gunicorn pyblog.wsgi
Secure environment variables are used for the SECRET_KEY, DATABASE_URL, and other sensitive settings.
- LinkedIn - My LinkdIn
- Email: My Email
- Moaz Sabra - meez-111