A full-featured web application for publishing, reading, and managing books written in Markdown format. Built with Django, it provides a complete platform for authors to publish their work and readers to discover, read, and review content.
- π Browse & Discover β Explore books by category, tags, popularity, or search
- π Markdown Rendering β Read chapters with beautifully rendered Markdown content
- β Reviews & Ratings β Rate books (1β5 stars) and write detailed reviews
- π Search & Filter β Find books by title, category, tag, or sort by popularity/rating
- ποΈ View Tracking β See how popular each book is
- π€ Public Profiles β View author profiles with their published works
- βοΈ Book Publishing β Create books with cover images, descriptions, and tags
- π Chapter Management β Write chapters in Markdown with ordering support
- π Statistics β Track views, likes, ratings, and review counts
- π Category Requests β Propose new categories for your books
- π·οΈ Flexible Tagging β Tag books with relevant keywords for discovery
- π Draft System β Save books and chapters as drafts before publishing
- β Category Approval β Review and approve/reject category requests
- ποΈ Django Admin β Full admin interface with custom actions and dashboards
- π Bulk Operations β Publish/unpublish books, approve categories in bulk
- π Authentication β Login, logout, password reset, and profile management
- π³ Donation Tracking β Stripe and PayPal integration for supporter donations
- π Social Profiles β GitHub, YouTube, Twitter, and website links
- π± Responsive Design β Bootstrap 5 based responsive UI
| Layer | Technology |
|---|---|
| Backend | Python 3.11+, Django 5.x |
| Database | SQLite (dev) / PostgreSQL (prod) |
| Frontend | HTML5, Bootstrap 5, JavaScript |
| Content | Markdown (rendered to HTML) |
| Images | Pillow, Django ImageField |
| Admin | Django Admin (customized) |
| Auth | Django built-in authentication |
| Payments | Stripe, PayPal (integration ready) |
md-books-library/
βββ manage.py
βββ requirements.txt
βββ README.md
β
βββ config/ # Project configuration
β βββ __init__.py
β βββ settings.py # Django settings
β βββ urls.py # Root URL configuration
β βββ asgi.py
β βββ wsgi.py
β
βββ accounts/ # User accounts & profiles
β βββ __init__.py
β βββ apps.py # AppConfig with signal registration
β βββ models.py # Profile model
β βββ forms.py # UserForm, ProfileForm
β βββ views.py # ProfileView, PublicProfileView
β βββ urls.py # Auth & profile URLs
β βββ admin.py # ProfileAdmin
β βββ signals.py # Auto-create Profile on User creation
β
βββ books/ # Core library application
β βββ __init__.py
β βββ apps.py # AppConfig
β βββ admin.py # Admin for all book models
β βββ urls.py # All book-related URLs
β β
β βββ models/ # Data models
β β βββ __init__.py
β β βββ category.py # Category (with approval workflow)
β β βββ tag.py # Tag (keyword labels)
β β βββ book.py # Book (main entity)
β β βββ chapter.py # Chapter (Markdown content)
β β βββ review.py # Review (ratings & comments)
β β
β βββ forms/ # Form classes
β β βββ __init__.py
β β βββ book.py # BookForm
β β βββ category.py # CategoryForm
β β βββ chapter.py # ChapterForm
β β βββ review.py # ReviewForm
β β βββ tag.py # TagForm
β β
β βββ views/ # View classes (CBV)
β β βββ __init__.py
β β βββ book.py # BookListView, DetailView, Create, Update
β β βββ category.py # Category views with approval workflow
β β βββ chapter.py # Chapter views with Markdown rendering
β β βββ review.py # Review views with duplicate prevention
β β βββ tag.py # Tag views with tag cloud
β β
β βββ templates/books/ # HTML templates
β βββ book/
β βββ category/
β βββ chapter/
β βββ review/
β βββ tag/
β
βββ core/ # Core pages
β βββ __init__.py
β βββ apps.py
β βββ views.py # HomeView (landing page)
β βββ urls.py
β βββ templates/core/
β βββ home.html
β
βββ templates/ # Global templates
β βββ base.html # Base template with Bootstrap
β
βββ static/ # Static files
β βββ css/
β βββ js/
β βββ images/
β
βββ media/ # User-uploaded files
βββ avatars/ # Profile pictures
βββ books/ # Book covers & category images
User (Django auth)
β
βββ< Profile (OneToOne)
β
βββ< Book (author) βββββββββββββββββββ
β β β
β βββ< Chapter (book) β
β βββ< Review (book, author) ββββ€
β βββ> Category (FK, nullable) β
β βββ<> Tag (M2M) β
β β
βββ< Category (request author) βββββββ
βββ< Category (reviewed_by)
| Model | Description | Key Fields |
|---|---|---|
| Profile | Extended user profile | avatar, bio, social links, donations |
| Book | A published work | title, slug, description, views, likes |
| Chapter | Book section with Markdown | title, content, order, is_published |
| Category | Book classification (with approval) | title, status, author, reviewed_by |
| Tag | Keyword label | name, slug |
| Review | User rating & feedback | rating (1-5), comment |
- Python 3.11 or higher
- pip (Python package manager)
- Git
git clone https://github.com/yourusername/md-books-library.git
cd md-books-library# Linux/Mac
python -m venv venv
source venv/bin/activate
# Windows (CMD)
python -m venv venv
venv\Scripts\activate
# Windows (PowerShell)
python -m venv venv
venv\Scripts\Activate.ps1pip install -r requirements.txtCreate a .env file in the project root:
DEBUG=True
SECRET_KEY=your-secret-key-here
DATABASE_URL=sqlite:///db.sqlite3
MEDIA_URL=/media/
MEDIA_ROOT=media/python manage.py makemigrations
python manage.py migratepython manage.py createsuperuserpython manage.py collectstaticpython manage.py runserverVisit http://127.0.0.1:8000/ to see the application.
| URL | View | Description |
|---|---|---|
/ |
HomeView |
Landing page with featured content |
| URL | View | Access |
|---|---|---|
/accounts/login/ |
LoginView |
Public |
/accounts/logout/ |
LogoutView |
Authenticated |
/accounts/profile/ |
ProfileView |
Authenticated |
/accounts/profile/<username>/ |
PublicProfileView |
Authenticated |
/accounts/password/change/ |
PasswordChangeView |
Authenticated |
/accounts/password/reset/ |
PasswordResetView |
Public |
| URL | View | Access |
|---|---|---|
/books/ |
BookListView |
Public |
/books/book/<slug>/ |
BookDetailView |
Public |
/books/book/create/ |
BookCreateView |
Authenticated |
/books/book/<slug>/edit/ |
BookUpdateView |
Author only |
| URL | View | Access |
|---|---|---|
/books/categories/ |
CategoryListView |
Public |
/books/category/<slug>/ |
CategoryDetailView |
Public |
/books/category/create/ |
CategoryCreateView |
Authenticated |
/books/category/<slug>/edit/ |
CategoryUpdateView |
Author (pending only) |
| URL | View | Access |
|---|---|---|
/books/book/<book_slug>/chapters/ |
ChapterListView |
Public |
/books/book/<book_slug>/chapter/<slug>/ |
ChapterDetailView |
Public |
/books/book/<book_slug>/chapter/create/ |
ChapterCreateView |
Book author |
/books/book/<book_slug>/chapter/<slug>/edit/ |
ChapterUpdateView |
Book author |
| URL | View | Access |
|---|---|---|
/books/reviews/ |
ReviewListView |
Public |
/books/review/<pk>/ |
ReviewDetailView |
Public |
/books/book/<book_slug>/review/create/ |
ReviewCreateView |
Authenticated |
/books/review/<pk>/edit/ |
ReviewUpdateView |
Review author |
| URL | View | Access |
|---|---|---|
/books/tags/ |
TagListView |
Public |
/books/tag/<slug>/ |
TagDetailView |
Public |
/books/tag/create/ |
TagCreateView |
Authenticated |
/books/tag/<slug>/edit/ |
TagUpdateView |
Staff only |
| URL | Access |
|---|---|
/admin/ |
Staff/Superuser |
Key settings to configure:
# Security
SECRET_KEY = os.environ.get('SECRET_KEY', 'your-secret-key')
DEBUG = os.environ.get('DEBUG', 'True') == 'True'
ALLOWED_HOSTS = ['localhost', '127.0.0.1']
# Database
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
# Installed Apps
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
# Local apps
'accounts.apps.AccountsConfig',
'books.apps.BooksConfig',
'core.apps.CoreConfig',
]
# Media files (user uploads)
MEDIA_URL = '/media/'
MEDIA_ROOT = BASE_DIR / 'media'
# Static files
STATIC_URL = '/static/'
STATIC_ROOT = BASE_DIR / 'staticfiles'For production, update these settings:
DEBUG = False
ALLOWED_HOSTS = ['yourdomain.com']
# Use PostgreSQL
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'md_books_library',
'USER': 'db_user',
'PASSWORD': 'db_password',
'HOST': 'localhost',
'PORT': '5432',
}
}
# Security settings
SECURE_SSL_REDIRECT = True
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
SECURE_HSTS_SECONDS = 31536000The admin interface is fully customized with:
- Avatar thumbnails and status badges
- Inline editing for chapters and reviews within books
- Custom actions for bulk publish/unpublish/approve/reject
- Query optimization to prevent N+1 problems
- Clickable links between related objects
- Star ratings and formatted statistics
Access at: http://127.0.0.1:8000/admin/
python manage.py testpip install black isort
black .
isort .python manage.py makemigrations
python manage.py migrate-
Create a new branch:
git checkout -b feature/your-feature-name
-
Make your changes
-
Run tests:
python manage.py test -
Commit and push:
git add . git commit -m "Add: your feature description" git push origin feature/your-feature-name
-
Open a Pull Request
- Markdown rendering with syntax highlighting
- Image optimization with django-imagekit
- Full-text search with PostgreSQL SearchVector
- Caching with Redis
- Email notifications for category approval/rejection
- AJAX tag autocomplete
- Live Markdown preview in chapter editor
- User follow system
- Reading progress tracking
- Book bookmarks/favorites
- Category moderation dashboard
- REST API with Django REST Framework
- Social authentication (Google, GitHub)
- Two-factor authentication
- Export books as PDF/EPUB
- Collaborative editing
- Analytics dashboard
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow PEP 8 guidelines
- Use Black for code formatting
- Add docstrings to all classes and methods
- Write tests for new features
This project is licensed under the MIT License β see the LICENSE file for details.
- Django β The web framework for perfectionists with deadlines
- Bootstrap β Frontend component library
- Python-Markdown β Markdown to HTML conversion
- Author: Ivan Levitsky
- Email: ivanlevitsky.fourmetrsquared@gmail.com
- GitHub: github.com/fourmetrsquared
Made with β€οΈ and Django
Since the project is being thrown together on a whim in spare time, an AI is writing the comments.)))