Skip to content

freedompraise/blogthedata

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Awesome Django Blog

awesome-django-blog-tests Coverage Status CodeStyle Linting PythonVersion License

Awesome-django-blog is a fully functional blogging platform built using the Django web framework. It includes features such as creating and managing blog posts, comments, and categories, as well as user authentication and authorization.

image


Table of Contents

Installation

# first install Python 3.10.x (have not tested newer versions, but they could work)
git clone https://github.com/jsolly/awesome-django-blog.git
cd awesome-django-blog
python3 -m venv .venv # Create virtual environment
source .venv/bin/activate # Activate virtual environment
pip install -r requirements.txt
python app/manage.py setup_env # Creates .env file from .env.example
python3 app/manage.py migrate # Create empty schema
python3 app/manage.py runserver

Seed Posts (Optional)

This command creates sample posts.

python3 app/manage.py import_posts utilities/seed_posts/posts.json

Default Accounts

The app comes preinstalled with two users. One is an admin and the other can only add comments to posts.

(Username/Password):

  • admin/admin
  • comment_only/comment_only

Coverage

coverage run --rcfile=config/.coveragerc -m pytest app
coverage report -m --skip-covered --rcfile=config/.coveragerc

Tests

pytest app

Linting

ruff --config ./config/pyproject.toml app

Formating

ruff format app

Also see the actions tab to see if everything is passing.

Pre-commit Hooks

If there are any Ruff failures (badly linted code), the build will fail, so please make sure you have the pre-commit hook installed.

$ cd awesome-django-blog/config
$ pre-commit install

Live Reload

If you want to automatically reload the server whenever you make changes to source code, you can set LIVERELOAD in the .env file to True. You can learn more about this tool on their GitHub page.

To use livereload, you have to run these commands in TWO SEPARATE terminal windows. Or you can use the included vscode launch.json to run both commands at once.

python3 app/manage.py runserver
python3 app/manage.py livereload

Production Deployment

I recommend this post which I followed to deploy this app on blogthedata.com


Features

Functional Features

  • User profile with avatar (automatic sizing and compression using Pillow)
  • User Login with Django built-in auth to create posts and leave comments
  • Ckeditor 5 for authoring blog posts (also includes spell check, code snippets, character counter, and more!)
  • Add real-time comments without page reloads for a smooth user experience.
  • Slugified URLs for more readable links
  • Open Graph protocol compliant social media sharing for beautiful share cards (LinkedIn, Twitter, Facebook, Instagram, Reddit, etc)
  • Smart and powerful Global search so you can find any blog post with a keyword search.
  • Display site visitors in a web map
  • Light and Dark Theme that automatically switch based on user's current system theme.
  • Blog reading time so viewers can estimate how long it will take them to read a post.
  • Atom and RSS feed so users can subscribe to your latest blog posts.
  • GPT3 powered blog post title, slug, and metadesc generator so you can harness the power of AI in your blog post authoring workflow
  • Copy to clipboard anchor links on every header within a blog post so you can share specific sections of a post.
  • Site-wide 'breadcumbs' so your users can know exactly where they are and navigate with ease.
  • Each page is optimized for viewing (and printing) so break out those 8 1/2 by 11s and print out some content!
  • GPT-powered Chatbot that can answer questions about your blog and help you find content.
  • Related posts at the end of each post detail page so users can quickly navigate to a similar post on your blog.
  • Syntax highlighting with Prism.js for beautiful code blocks in a variety of languages. Also includes line numbers and copy to clipboard functionality. Automatically changes light/dark theme based on user's current system theme.

Non-Functional Features

  • No CSS/Layout frameworks (Bootstrap, Tailwind, etc). All CSS and components are custom and optimized for performance.
  • HTMX for dynamic page updates without a page refresh
  • Robots.txt, security.txt, and sitemap.xml for optimized SEO and security
  • Git hooks for automatic static file generation (manage.py collectstatic)
  • GitActions CI integration with coverage, linting, and testing. Push with confidence!
  • Compatible with Sqllite or postgres databases for fast protyping and production
  • Optimized for Performance, SEO, and A11Y
  • Latest Django 5.x
  • 95% or above unit code coverage for a maintainable codebase
  • 100% linted with ruff and PEP8 compliant for beautiful Python code.
  • Static scans with CodeQL and pip dependency checks with Dependabot for automated security and updates.
  • Formatted with Ruff for beauty and speed.
  • Strict Content Security Policy preventing inline styles and scripts for better security
  • Subresource Integrity for better security
  • A+ Score on Mozilla Observatory
  • 100/100 for Performance, SEO, and Accessibility according to Google Lighthouse
  • Automatic Conversion of images (.png, .jpeg, etc) to .webp for blazingly fast image loads.
  • Badges for test coverage, passing builds, formatter, and linting
  • Automated, rotating backups of blog posts using local and cloud storage
  • Status page for monitoring uptime and performance of your blog at https://blogthedata.com/status using Apache Echarts.
  • Custom 404 and 500 pages that look really cool. So even if your users are lost or your app is broke, they are still having a good time.

Depreciated Features

Contributing

We β™₯️ our contributors.

πŸ“• We expect everyone participating in the community to abide by our Code of Conduct. Please read and follow it.
🀝 If you'd like to contribute, start by reading our Contribution Guide.
πŸ‘Ύ Explore some good first issues.

Let's build great software together.

Top Contributors

John Solly Praise Dike
jsolly freedompraise
github.com/jsolly github.com/freedompraise

Support

Reach out to me on X! @_jsolly


License

License

About

Blogging platform written in Django

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 59.9%
  • CSS 19.8%
  • HTML 17.1%
  • JavaScript 2.2%
  • Shell 1.0%