A good start for a project
Python VimL
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
custom
stages
templates
.gitignore
.vimproject
Makefile
PROJECT.rst
README.rst
Session.vim
TODO.rst
__init__.py
manage.py
requirements.txt
urls.py

README.rst

Dependencies:Python>=2.6

Install

Development

To install, first change the first line of stages/Makefile, then edit stages/data.yaml, and the run:

make # creates virtualenv + dependencies, static and stages

Test server

On a server using postgresql, you have to install psycopg2 into the virtualenv manually. Do:

createdb <project> # only first time, of course
make virtualenv    # creates virtualenv
source virtualenv/bin/activate
pip install psycopg2
make
sudo make reload   # reloads apache and nginx
                   # 'make restart' restarts both,
                                   # 'make refresh' touches the wsgi file (and doesn't need sudo)

Project setup

Configuration files for different stages (servers) go into stages. They are generated from the templates in stages/templates, filled with data from stages/data.yaml by make_stages.py. You shouldn't edit make_stages.py, but consider it a 3rd party app. For every stage, a directory is generated. On stage (server) X, make_stages.py should create a symlink stages/current to stages/X. The convention is to use the the domain as the stage name, e.g. stages/trumpetcms_nl.

Fixtures

The fixture initial_data.json should be used for data that may be overwritten only. For other data (initial data that will be edited by the customer), use schema migrations. The easiest way to use schema migrations is having them load fixtures from a specific file.

CKEditor

The javascript dependencies for CKEDitor are automatically installed by make. To use CKEditor in a template, put the following in there:

<script type="text/javascript" src="{{ STATIC_URL }}js/jquery.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}ckeditor/adapters/jquery.js"></script>
<script type="text/javascript">
        $(function() {
                $('textarea').ckeditor();
        });
</script>

For use in the admin, put the following in templates/admin/<app>/change_form.html:

{% extends "admin/change_form.html" %}

{% block extrahead %}
        {{ block.super }}
        <script type="text/javascript" src="{{ STATIC_URL }}js/jquery.js"></script>
        <script type="text/javascript" src="{{ STATIC_URL }}ckeditor/ckeditor.js"></script>
        <script type="text/javascript" src="{{ STATIC_URL }}ckeditor/adapters/jquery.js"></script>
        <script type="text/javascript">
                $(function() {
                        $('textarea').ckeditor();
                });
        </script>
{% endblock %}

See the CKEditor docs and Django admin docs for a more detailed explanation.