Django-Mako-Plus¶
Routing Django to Mako since 2013
Documentation: | http://doconix.github.io/django-mako-plus/ |
---|---|
Code: | https://github.com/doconix/django-mako-plus |
Features¶
DMP adds convention-over-configuration to Django:
- Uses standard Python in templates; no more weak-sauce Django templating.
- Calls view functions by convention instead of listing every. single. page. in urls.py.
- Converts parameters in the URL and loads model objects by convention.
- Supports bundling of static files with tools like Webpack.
- Automatically links .js and .css in your HTML documents (if not using bundlers).
- Automatically injects context variables in the client-side Javascript namespace.
- Provides Django-style signals.
- Plays nicely with third party apps.
- Extends Django’s redirecting with exception-based redirecting.
- Supports language translations, class-based views, and collection of static files.
- Includes a comprehensive test suite.
DMP doesn’t replace Django; it extends Django to make you more productive.
Quick Start¶
# install/upgrade django, mako, and DMP
pip3 install --upgrade django-mako-plus
# create a new project with a 'homepage' app
python3 -m django_mako_plus dmp_startproject mysite
cd mysite
python3 manage.py dmp_startapp homepage
# open mysite/settings.py and append 'homepage' to the INSTALLED_APPS list
INSTALLED_APPS = [
...
'homepage',
]
# run initial migrations and run the server
python3 manage.py migrate
python3 manage.py runserver
# open a browser to http://localhost:8000/
# install/upgrade django, mako, and DMP
pip install --upgrade django-mako-plus
# create a new project with a 'homepage' app
python -m django_mako_plus dmp_startproject mysite
cd mysite
python manage.py dmp_startapp homepage
# open mysite/settings.py and append 'homepage' to the INSTALLED_APPS list
INSTALLED_APPS = [
...
'homepage',
]
# run initial migrations and run the server
python manage.py migrate
python manage.py runserver
# open a browser to http://localhost:8000/
Contents¶
- Home
- Comparison with Django
- Upgrade Notes
- Installation
- Tutorial
- FAQ
- Basic Concepts
settings.py
- Escaping Special Characters
- Metadata about the Request
- Python Imports in Templates
- Using Third-Party Apps
- Inheritance Paths and Template Location
- Convenience Functions
- Redirecting the Browser
- CSRF Tokens
- Class-Based Views
- Using the Django API
- Lazy Rendering with
TemplateResponse
- Customizing
@view_function
- Rendering Partial Templates for Ajax
- Combining Django and Mako Templates
- Signals in DMP
- Internationalization
- Parameter Conversion
- Static Files
- Deployment
- Editors
Compatability¶
DMP requires Python 3.4+ and Django 1.9+.
The first Django 2.0+ release was in December 2017.