ACRCms installation¶
Preliminary steps¶
System Packages Installation¶
For Ubuntu/Debian systems:
$ sudo apt-get install build-essential python-dev python-setuptools python-virtualenv
For Fedora systems:
$ su -c 'yum install gcc sqlite-devel python-virtualenv'
Standard installation¶
The standard installation pattern provides a full ACRCms instance
Environment setup¶
Install the environment:
$ virtualenv --no-site-packages acrenv
$ cd acrenv/
$ source bin/activate
(acrenv)$ easy_install -i http://tg.gy/222 tg.devtools
(acrenv)$ hg clone ssh://hg@bitbucket.org/axant/acrcms
(acrenv)$ cd acrcms/acr_cms/
(acrenv)$ python setup.py develop
(acrenv)$ paster setup-app development.ini
Serve the contents:
(acrenv)$ paster serve development.ini --reload
Enable libacr functionalities in any TG project¶
Instead of creating a brand new project, you can add the cms funcionalities provided by libacr in any TurboGears2 project.
Install libacr:
(yourenv)$ easy_install libacr
Enable libacr in your project.
Add this lines to yourproject/lib/helpers.py
:
import libacr
from libacr.helpers import *
icons = {}
icons.update(libacr.helpers.icons)
Add this lines to yourproject/lib/base.py
:
from libacr.lib import *
#[in the __call__ method]
full_acr_js.inject()
acr_css.inject()
Add this lines to yourproject/config/app_cfg.py
:
try:
from tgext.pluggable import plug
base_config.acr_pluggable_enabled = True
except ImportError:
base_config.acr_pluggable_enabled = False
if base_config.acr_pluggable_enabled:
try:
plug(base_config, 'photos')
except ImportError:
pass
try:
plug(base_config, 'smallpress')
except ImportError:
pass
Add this line to yourproject/model/__init__.py
:
from libacr.model import init_acr_model
Content, ContentData, Tag, Page, Slice, View, Comment = init_acr_model(DBSession, DeclarativeBase, User, Group)
Add this line to yourproject/controllers/root.py
:
from libacr.controllers.cms import AcrRootController
#[in the RootController class]
acr = AcrRootController()
Deploy ACRCms on Red Hat’s OpenShift PaaS¶
Get up and running with a ACRCms instance on OpenShift using acrcms-openshift-quickstart. It automatically handles creating a Python virtualenv, populating a MySQL database, and deploying the cms to the cloud.
Features¶
- Completely free, thanks to Red Hat’s OpenShift Express
- MySQL database automatically setup
- Dynamic database configuration at runtime. No passwords stored in your configs.
- Automatic deployment upon git push
- No need to think about servers, let alone apache/mod_wsgi configuration
How To¶
- Create an account at http://openshift.redhat.com/
- Add a namespace to your account:
rhc domain create -n <yournamespace> -l your@email.com
- Deploy the cms:
rhc app create -a ACRCms -t python-2.6 -l your@email.com
rhc app cartridge add -a ACRCms -c mysql-5.1 -l your@email.com
cd ACRCms
git remote add upstream -m master git@bitbucket.org:simock85/acrcms-openshift-quickstart.git
git pull -s recursive -X theirs upstream master
git push
Monitoring your logs¶
rhc-tail-files -a ACRCms -l your@email.com