Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Django web application — a blog site project for creating, editing and publishing posts (MIT-licensed).

License

Notifications You must be signed in to change notification settings

Rohit10jr/BlogSite

Repository files navigation

DjangoBlog

Django CI CodeQL codecov license

A powerful, elegant, and modern blog system.


DjangoBlog is a high-performance blog platform built with Python 3.10 and Django 4.0. It not only provides all the core functionalities of a traditional blog but also features a flexible plugin system, allowing you to easily extend and customize your website. Whether you are a personal blogger, a tech enthusiast, or a content creator, DjangoBlog aims to provide a stable, efficient, and easy-to-maintain environment for writing and publishing.

✨ Features

  • Powerful Content Management: Full support for managing articles, standalone pages, categories, and tags. Comes with a powerful built-in Markdown editor with syntax highlighting.
  • Full-Text Search: Integrated search engine for fast and accurate content searching.
  • Interactive Comment System: Supports replies, email notifications, and Markdown formatting in comments.
  • Flexible Sidebar: Customizable modules for displaying recent articles, most viewed posts, tag cloud, and more.
  • Social Login: Built-in OAuth support, with integrations for Google, GitHub, Facebook, Weibo, QQ, and other major platforms.
  • High-Performance Caching: Native support for Redis caching with an automatic refresh mechanism to ensure high-speed website responses.
  • SEO Friendly: Basic SEO features are included, with automatic notifications to Google and Baidu upon new content publication.
  • Extensible Plugin System: Extend blog functionalities by creating standalone plugins, ensuring decoupled and maintainable code. We have already implemented features like view counting and SEO optimization through plugins!
  • Integrated Image Hosting: A simple, built-in image hosting feature for easy uploads and management.
  • Automated Frontend: Integrated with django-compressor to automatically compress and optimize CSS and JavaScript files.
  • Robust Operations: Built-in email notifications for website exceptions and management capabilities through a WeChat Official Account.

🛠️ Tech Stack

  • Backend: Python≥3.10, Django≥4.0
  • Database: MySQL, SQLite (configurable)
  • Cache: Redis
  • Frontend: HTML5, CSS3, JavaScript
  • Search: Whoosh, Elasticsearch (configurable)
  • Editor: Markdown (mdeditor)

🚀 Getting Started

1. Prerequisites

Ensure you have Python 3.10+ and MySQL/MariaDB installed on your system.

2. Create a Python virtual environment

It's recommended to use a virtual environment to manage dependencies.

# Create a virtual environment named 'venv'
python -m venv venv

3. Activate the virtual environment

On Windows (cmd.exe)

venv\Scripts\activate

On Windows (PowerShell)

venv\Scripts\Activate.ps1

On macOS / Linux

source venv/bin/activate

Once activated, your shell prompt should show (venv) at the beginning.

4. Clone & Installation

# Clone the project to your local machine
git clone https://github.com/Rohit10jr/BlogSite.git

cd DjangoBlog

# Install dependencies
pip install -r requirements.txt

5. Project Configuration

  • Database: Open djangoblog/settings.py, locate the DATABASES section, and update it with your MySQL connection details.

    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.mysql',
            'NAME': 'djangoblog',
            'USER': 'root',
            'PASSWORD': 'your_password',
            'HOST': '127.0.0.1',
            'PORT': 3306,
        }
    }

    Create the database in MySQL:

    CREATE DATABASE `djangoblog` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
  • More Configurations: For advanced settings such as email, OAuth, caching, and more, please refer to our Detailed Configuration Guide.

6. Database Initialization

python manage.py makemigrations
python manage.py migrate

# Create a superuser account
python manage.py createsuperuser

7. Elasticsearch Setup

To enable full-text search using Elasticsearch, you can run Elasticsearch inside a Docker container.

Run Elasticsearch with Docker

docker run -d \
  --name elasticsearch7 \
  -e "discovery.type=single-node" \
  -e "xpack.security.enabled=false" \
  -p 9207:9200 \
  docker.elastic.co/elasticsearch/elasticsearch:7.17.15

Verify Elasticsearch is running

curl -X GET "localhost:9207/"

Build or Update Indexes

python manage.py update_index
python manage.py rebuild_index

8. Running the Project

# (Optional) Generate some test data
python manage.py loaddata initial_data.json

or 

python manage.py create_testdata


# (Optional) Collect and compress static files
python manage.py collectstatic --noinput
python manage.py compress --force

# Start the development server
python manage.py runserver

Now, open your browser and navigate to http://127.0.0.1:8000/. You should see the DjangoBlog homepage!

🧩 Plugin System

The plugin system is a core feature of DjangoBlog. It allows you to add new functionalities to your blog without modifying the core codebase by writing standalone plugins.

  • How it Works: Plugins operate by registering callback functions to predefined "hooks". For instance, when an article is rendered, the after_article_body_get hook is triggered, and all functions registered to this hook are executed.
  • Existing Plugins: Features like view_count and seo_optimizer are implemented through this plugin system.
  • Develop Your Own Plugin: Simply create a new folder under the plugins directory and write your plugin.py. We welcome you to explore and contribute your creative ideas to the DjangoBlog community!

🤝 Contributing

We warmly welcome contributions of any kind! If you have great ideas or have found a bug, please feel free to open an issue or submit a pull request.

📄 License

This project is open-sourced under the MIT License.


❤️ Support

If you find this project useful and would like to support its continued development, consider giving it a star ⭐ on GitHub or sharing it with others.
Your support motivates me to keep improving and maintaining it!

🙏 Acknowledgements

Special thanks to all open-source contributors and the tools that make this project possible.

📄 License

This project is licensed under the MIT License.
You are free to use, modify, and distribute this software with proper attribution.


About

Django web application — a blog site project for creating, editing and publishing posts (MIT-licensed).

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published