Pinax upgrade from 0.7beta2 to 0.7.1
This article describes upgrade steps for a social project from 0.7beta2 to 0.7.1. Note that “social project” is the new name for “complete project”. The article may also theoretically be useful for other types of projects.
Overview
There are some gotchas. Refer to 0.7.1 version of social_project or the current version of social_project in case of issues which are not mentioned in this article.
Social project context processors
Some context processors were moved from Pinax itself to the actual complete project: inbox_count_sources(), combined_inbox_count() and footer(). So you’ll have to backport the sources.
Download 0.7.1 sources of social_project.context_processors or current sources of social_project.context_processors in your project root.
It is then possible to modify settings.CONTEXT_PROCESSORS, from strings like “misc.context_processors.combined_inbox_count” to “yourproject.context_processors.combined_inbox_count”.
Context processors must be updated according to the new settings.py.
Brian Rosner precises that this should not affect projects not based on social_project.
Context processors
Some context processors where totally removed:
- misc.context_processors.contact_email
- misc.context_processors.site_name
Those should be removed from settings.CONTEXT_PROCESSORS.
Social project apps
If a project was working with “tag_app” but does not “tasks” in settings.INSTALLED_APPS, then the following error will be raised:
Caught an exception while rendering: Could not import tag_app.views. Error was: cannot import name Task
The problem is caused in tag_app views. The easiest workaround is to update the views with the 0.7.1 sources of tag_app.views or current sources of tag_app.views
pinax.templatetags app
Add “pinax.templatetags” to INSTALLED_APPS or the following exception will be raised on {% load ifsetting_tag %}.
'ifsetting_tag' is not a valid tag library: Could not load template library from django.templatetags.ifsetting_tag, No module named ifsetting_tag
Wiki
Templates
Change all
{% load wiki %}
With:
{% load wiki_tags %}
This command works:
find templates/ -name "*.html" | xargs sed -i -b "s/load wiki/load wiki_tags/"
Settings
If one of these errors occur:
AttributeError: 'Settings' object has no attribute 'MARKUP_CHOICES'
Add to settings:
MARKUP_FILTER_FALLBACK = 'none'
MARKUP_CHOICES = (
('restructuredtext', u'reStructuredText'),
('textile', u'Textile'),
('markdown', u'Markdown'),
('creole', u'Creole'),
)
WIKI_MARKUP_CHOICES = MARKUP_CHOICES
Auth
Exception:
AttributeError at / 'Settings' object has no attribute 'ACCOUNT_REQUIRED_EMAIL'
This exception can be fixed by setting ACCOUNT_REQUIRED_EMAIL in settings.py, to True if email validation is required during registration or False otherwise.
Pinax templatetags
Exception:
'svn_app_version' is not a valid tag library: Could not load template library from django.templatetags.svn_app_version, No module named svn_app_version
Fix: add to INSTALLED_APPS: ‘pinax.templatetags’
Staticfiles
Exception:
Caught an exception while rendering: Please set your STATIC_ROOT setting to an existing directory in which the staticfiles can be collected.
Django-staticfiles is an excellent app allows to separate user content (medias) from site contents (static), but also to keep app-specific static files in the app directory.
Ensure urls.py, the site_media url should now include staticfiles.urls.
Installation instructions: http://bitbucket.org/jezdez/django-staticfiles/src/
Credits
Brian (aka Bruce) Rosner kindly helped migrating a project and writing this article.
Comments
Comment form for «Pinax upgrade from 0.7beta2 to 0.7.1»