DjBlogger is a modern blog platform built with Django, featuring infinite scroll, tag-based navigation, search functionality, and a responsive design.
- 📜 Infinite scroll blog posts
- 🏷️ Tag-based categorization
- 🔍 Advanced search functionality
- 📱 Responsive design for seamless usage across devices
- ✍️ Markdown support
- 💾 Automated backup system
- ⚡ Seamless HTMX integration
- Django 4.2
- Python 3.10
- Bootstrap 5
- HTMX
- SQLite (default database)
- pytest for testing
- Markdown for content formatting
- Factory Boy for test data generation
The core Post model (referenced in blog/models.py).
The project implements both class-based and function-based views:
HomeView: Main blog listing with infinite scrollTagListView: Tag-filtered post listingPostSearchView: Search functionalitypost_single: Individual post display
The project uses a hierarchical template structure:
- Base template with common layout
- Reusable components for post listings
- Responsive design breakpoints
The project includes an automated backup system that backs up the database file the database file into a directory named backups in the root. You can automate this feature using crontab in your system. To backup the database use this command:
$ python manage.py backup_filesIf there are more than 5 backup files in the backups directory, then the command will delete older backups.
-
First make a
pytest.inifile indjbloggerdirectory and paste the content below in it:[pytest] DJANGO_SETTINGS_MODULE = djblogger.settings.local python_files = test_*.pyNow you can use the command below:
$ pytest
Here is the latest result:
-
Factory Boy for test data generation
-
Coverage reporting You can generate more detailed reports for the coverage with this commmand and explore the result in the
htmlcovdirectory in the project:$ coverage html
-
Clone the repository
-
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Make a
.envfile in thedjbloggerdirectory Set up environment variables by filling in the SECRET_KEYwith your secret key and setting the DEBUGvalue:SECRET_KEY=your_secret_key DEBUG=True
note: there are three files in thesettingsdirectory:a. local.py b. production.py c. base.pyyou by changing the
DEBUGvalue in the.envfile, Django decides which settings file to use for running the server based on theDEBUGvalue. -
Run migrations:
python manage.py makemigrations python manage.py migrate
-
Create a superuser:
python manage.py createsuperuser
-
Now you can make test data in database with the commands below:
python manage.py shell
Then, enter the following code in the shell to generate test data:
>>> from djblogger.blog.factory import PostFactory >>> x = PostFactory.create_batch(100)
-
run the development server
python manage.py runserver
This project is licensed under the MIT License - see the LICENSE file for details.
The home page features an infinite-scroll list of blog posts, each displaying the title, excerpt, publication date, and associated tags. The clean, modern design ensures optimal readability.
The search results page dynamically displays filtered posts based on user queries, maintaining the same consistent layout while highlighting matching content.
When viewing posts by tag, the platform shows all related content in a filtered view, making it easy to explore specific topics or categories.