Introducing Django-dress-blog¶
A pluggable application that provides blog capabilities to your Django project.
Documentation work in progress!
Features:
- Three different type of posts: Stories, Quotes and Diary Entries.
- Choose between either 3 or 4 columns layout format.
- Default theme based on twitter-bootstrap.
- Create new themes without modifying existing code.
- Posts may be in Draft/Public status, and published in the future.
- Posts categorized with tags, with django-tagging.
- Independent paginated list of Stories, Quotes and Comments.
- Comments managed with django-comments-xtd.
- Support for inline media with django-inline-media.
- Blogroll, Multiple Authors, Search capabilities with django-haystack, and more.
Run the demo project to see django-dress-blog in action.
Contents:
Tutorial¶
Django-dress-blog is a blogging app that allows authors post stories, quotes and diary entries.
Motivation¶
Django-dress-blog is a blogging app inspired by Kevin Fricovsky’s django-mingus that offers authors three different type of posts: stories to write their own content, quotes to cite other people’s content, and the diary to micro-post on anything in a quick fashion.
Django-dress-blog is suitable for start-ups and other collaborative projects, may show posts’ author, and it comes with a fully functional theme based on twitter-bootstrap and support for extra themes.
Its search functionality make use of django-haystack, which supports up to four different search engines. The default installation uses xapian-haystack.
Using Django-dress-blog authors categorize content by tagging, what produces a Folksonomy, allowing categorization on the go rather than enforcing category creation in advance.
Installation¶
Installing Django-dress-blog is as simple as checking out the sources and adding the path to your project or PYTHONPATH
.
Use git, pip or easy_install to check out Django-dress-blog from Github or get a release from PyPI:
- Use git to clone the repository, and then install the package (read more about git):
git clone git://github.com/danirus/django-dress-blog.git
andpython setup.py install
- Or use pip (read more about pip):
- Do
pip install django-dress-blog
, or- Edit your project’s
requirements
file and append either the Github URL or the package namedjango-dress-blog
, and then dopip install -r requirements
.
- Or use easy_install (read more about easy_install):
- Do
easy_install django-dress-blog
Configuration¶
It is assumed you have pip installed and virtualenv. Although virtualenv is not a requirement, just a healthy recommendation. Configuration comprehends the following steps:
Install the dependencies listed in the
requirements
file:pip install -r requirements
Add the following entries to
INSTALLED_APPS
in yoursettings.py
file:'django.contrib.staticfiles', 'django.contrib.comments', 'django_comments_xtd', 'django_markup', 'inline_media', 'flatblocks', 'sorl.thumbnail', 'tagging', 'request', 'dress_blog', 'haystack',
Some of the new installed apps requires extra configuration. Edit your
settings.py
file again and append the next entries:For the comments app:
COMMENTS_APP = 'django_comments_xtd' COMMENTS_XTD_CONFIRM_EMAIL = True COMMENTS_XTD_SALT = 'es-war-einmal-una-bella-princesa-in-a-beautiful-castle'
For Django-tagging:
FORCE_LOWERCASE_TAGS = True
For sorl.thumbnail:
THUMBNAIL_BACKEND = 'inline_media.sorl_backends.AutoFormatBackend' THUMBNAIL_FORMAT = 'JPEG'
For request:
REQUEST_IGNORE_AJAX = True REQUEST_IGNORE_USERNAME = ["admin"] REQUEST_IGNORE_PATHS = (r'^admin/', r'^favicon.ico') REQUEST_TRAFFIC_MODULES = ( 'request.traffic.UniqueVisitor', 'request.traffic.UniqueVisit', 'request.traffic.Hit', 'request.traffic.Search', )
For Django-haystack, when using the Xapian search engine:
HAYSTACK_CONNECTIONS = { 'default': { 'ENGINE': 'haystack.backends.xapian_backend.XapianEngine', 'PATH': os.path.join(os.path.dirname(__file__), 'xapian_index'), }, }
For Django-dress-blog:
DRESS_BLOG_PAGINATE_BY = 10 DRESS_BLOG_UI_COLUMNS = 3 DRESS_BLOG_THEMES_PATH = os.path.join(STATIC_ROOT, 'dress_blog/themes')
To use the XapianEngine backend with Haystack you have to copy the
xapian_backend.py
file from the xapian_haystack directory into django-haystack’s backends directory. Go to your VirtualEnvsrc/
directory and copy the file:cp xapian-haystack/xapian_backend.py django-haystack/haystack/backends/
Add a new context processor to
TEMPLATE_CONTEXT_PROCESSORS
in yoursettings.py
file:TEMPLATE_CONTEXT_PROCESSORS = ( ... 'dress_blog.context_processors.config', )
Edit your
urls.py
file and add the following entries:url(r'^blog/', include('dress_blog.urls')), url(r"^comments/", include("django_comments_xtd.urls")),
Collect static files provided with Django-dress-blog:
python manage.py collectstatic
Build the Xapian search index in a regular basis to track new content added to your blog by running the following command:
python manage.py rebuild_index
Create database data structures:
python manage.py syncdb
Run you project dev web server and hit your project’s dress-blog URL <http://localhost:8000/blog>_:
python manage.py runserver