Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
Merge branch 'develop' of ssh://github.com/ic-labs/django-icekit into…
Browse files Browse the repository at this point in the history
… develop
  • Loading branch information
Greg Turner committed Dec 5, 2016
2 parents e3e3533 + 9a985be commit 8192212
Show file tree
Hide file tree
Showing 170 changed files with 4,874 additions and 565 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
/.env.local
/.idea/
/.tox/
/build/
/dist/
/docker-compose.override.yml
/project_template/bower_components/
Expand Down
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@ env:
global:
# Use `pull-N`, Git tag, or Git branch as Docker image tag.
- TAG=$([[ "$TRAVIS_PULL_REQUEST" != "false" ]] && echo "pull-$TRAVIS_PULL_REQUEST" || echo ${TRAVIS_TAG:-$TRAVIS_BRANCH} | sed 's/[^.0-9A-Za-z]/-/g')

notifications:
webhooks:
secure: "fuQLP69xYcIipFi1982mC9Q1o2IzBzclkDDpvqtevm20QJAGKYzNud7/ujH3r7tWZ6VcQ2fjXAQBfL68LLr0rgPi7Zy11/OiTGTGNxAF7HxZnX070fhh4tDNVYXQqRVWswGP/DyLBGMY3NDIDAY2s2U7SZeKisBFXZyv1JYcDxTWFCGpF5ia1+WprFNvDg9YQCAKqCFW37i1C+qsVUYfvKTpFiDcm9YrkvM3VH2i2ceupukkiBxh2Q8BI2TCc4Oj5dy+urOA40Zwy74HwGlpgi8IQF9BfD5GMzHTh26o10SxFwxNaQtbfXr+aH/df6+Qo0cXN82hjezcLwkQSf/G2A0hBA1TUuUwqGBEjTZ5evmGJKQEXDgEr4ZJmxZ4+2GvoCTHfC4fN6/VcdFD2JWVrfpkqJY1jpah50/K/PcorM/PI2IwIZ07AcG8IcMWo/WYOowUHnq6D7zjiXUU4S3WQ9pkl/MrE+EaLoEfFHf+y83WB8iOIRNSwWTAi73jXTFNFeK5HHtceMYwkYwI4tvPIDbzSV4sKBDL4qoJWqbHLwObfGbm3/kvYfv2h7lH6ZRGXUVO1FO8bVQxL0vQfh5R41RsVjy/hYlwgWrlai7QVWKBX3AbMvyKUEm0Ybnvm1LDQONLR+Oc/P5CZxZ8duba07tiIm5Y9X0X13HOyISg/lk="
13 changes: 10 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y --no-install-recommends \
apt-transport-https \
apt-utils \
gettext \
gnupg2 \
jq \
locales \
nano \
nginx \
postgresql-client \
Expand Down Expand Up @@ -41,13 +43,12 @@ RUN md5sum bower.json > bower.json.md5

WORKDIR /opt/django-icekit/

ENV PIP_SRC=/opt
RUN wget -nv -O - https://bootstrap.pypa.io/get-pip.py | python
ENV PIP_SRC=/opt

COPY requirements.txt setup.py /opt/django-icekit/
RUN pip install --no-cache-dir -r requirements.txt -U
RUN touch requirements-local.txt
RUN md5sum requirements.txt requirements-local.txt > requirements.md5
RUN md5sum requirements.txt > requirements.txt.md5

ENV DOCKERIZE_VERSION=0.2.0
RUN wget -nv -O - "https://github.com/jwilder/dockerize/releases/download/v${DOCKERIZE_VERSION}/dockerize-linux-amd64-v${DOCKERIZE_VERSION}.tar.gz" | tar -xz -C /usr/local/bin/ -f -
Expand All @@ -65,6 +66,12 @@ RUN cd /usr/local/bin \
# RUN echo "int chown() { return 0; }" > preload.c && gcc -shared -o /libpreload.so preload.c && rm preload.c
# ENV LD_PRELOAD=/libpreload.so

RUN echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen
RUN locale-gen
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US:en
ENV LC_ALL=en_US.UTF-8

ENV CRONLOCK_HOST=redis
ENV DOCKER=1
ENV ICEKIT_DIR=/opt/django-icekit/icekit
Expand Down
42 changes: 40 additions & 2 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

## In development

* Add `icekit.workflow` application to associate, manage, and filter workflow
state information like status and user-assigment for arbitrary models.

* Add `ICEkitContentsMixin` and `ICEkitFluentContentsMixin` abstract classes
in `icekit.models` to use as a base for models that will include publishing
and workflow features.

* Add `ICEkitContentsAdmin` and `ICEkitFluentContentsAdmin` admin classes
in `icekit.admin` as bases for admins for models with publishing and
workflow features.

* Add workflow features to all publishable models in ICEkit using the new
abstract model mixins and admin base classes mentioned above.

* Preview pages are now visually highlighted, and have a different HTML title.

* "Preview draft" button is now near "View published" button.
Expand All @@ -24,7 +38,20 @@
* Ignore `.env` and `docker-cloud.*.yml` files, which frequently contain
secrets that should not be committed.

Breaking changes:
* New `ContactPerson` model + and plugin added, allowing adding of staff
contacts to most types of content.

* Verbose Name for "o embed with caption" is now "Embedded media"

* Text plugin now has a style setting

* Overhaul of search system, using a consistent approach to index and depict
rich/publishable/polymorphic models.

### Breaking changes:

* `AbstractLayoutPage` now includes ListableMixin and HeroMixin. All models
which inherit from this will need a new migration.

* The initial migration for `icekit.plugins.slideshow` had the wrong database
table name, which meant that the `0004_auto_20160821_2140` migration would
Expand All @@ -39,7 +66,18 @@ Breaking changes:

* `icekit.articles` is no more. Functionality is moved to `icekit.content_collections`.

* The `FEATURED_APPS` setting has moved to `ICEKIT['DASHBOARD_FEATURED_APPS']`.
* The `FEATURED_APPS` setting has moved to `ICEKIT['DASHBOARD_FEATURED_APPS']`,
and is now a list, not a tuple, so as to support item assignment.

* Added HeroMixin and ListableMixin to LayoutPage and Article. This will break
ported/subclass models that define similarly-named fields. Either remove the
definition or migrate data somehow.

* The required version of Press Releases removes the `PressContact` model, in
favour of `ContactPerson`. If you have `PressContacts`, you will need to
migrate to the new model.



## 0.15 (27 September 2016)

Expand Down
23 changes: 16 additions & 7 deletions docs/contributing/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,27 @@ This reuses the test databases, and skips collectstatic and compress steps.

### To create a data dump with migrations applied

To achieve permanent speedup, create a data dump called `test_initial_data.sql`
with migrations applied. It will be restored to the test database in
`runtests.sh`, bypassing all migrations.
The slowest part of running tests from scratch is usually the "Rendering Model
States..." stage of migrations. This can be speeded up by loading a pre-
migrated database dump. ICEkit's `runtests.sh` automatically uses a file called
`test_initial_data.sql`.

To create a data dump called `test_initial_data.sql`
with migrations applied:

1. Drop/recreate your test database

dropdb FOO_test_develop
createdb FOO_test_develop

1. Create a fresh database `foo`
2. Run migrations:

manage.py migrate
BASE_SETTINGS_MODULE=test manage.py migrate

3. Dump the database to `test_initial_data.sql`

`pg_dump -O -x -f test_initial_data.sql -d foo`

pg_dump -O -x -f test_initial_data.sql -d FOO_test_develop
git add test_initial_data.sql

# To create fluent pages in tests.

Expand All @@ -60,6 +68,7 @@ We do this by using dynamic fixture:
from icekit.models import Layout
from icekit.page_types.layout_page.models import LayoutPage


User = get_user_model()


Expand Down
38 changes: 38 additions & 0 deletions docs/howto/start.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ All settings are optional, but you can provide:

## Where to put files

Put your layout template files in `templates/layouts/`.

Put your static files (js/css/static images) in `static/`.

Anything you put in the `static` or `templates` directories will override the
default ICEkit static files and templates.

Expand All @@ -56,6 +60,30 @@ The `project_settings.py` file is a Django settings module. You can override any
default Django/ICEkit settings or configure apps installed via `requirements
.txt`.


## How do I add project-specific URLs?

Create a `urls.py` file in a project folder of your choice, such as `myproject`.
It can contain something like

```python
from django.conf.urls import include, patterns, url

urlpatterns = patterns(
'myproject.views',
... your URLs here ...
# finally, fall back to ICEkit/GLAMkit URLs.
url('', include('icekit.project.urls')), # use `glamkit_urls` if this is a GLAMkit project
]
```

Lastly, in `project_settings.py`, override the default URL path:

```python
ROOT_URLCONF = 'myproject.urls'
```


## Where's my virtualenv? How do I modify a source package?

If you're running in Docker, the requirements are installed in the Docker image
Expand All @@ -80,3 +108,13 @@ Or list just the additional packages that you have already installed:

You can also create a `requirements-local.txt` file (ignored by Git) that will
be installed automatically when the project is started.

## How do I change the base template?

All icekit templates extend a template named `base.html` which is automatically provided by
icekit. To change the base template, you can add a file named `base.html` into your root
`templates` directory. This ensures that all icekit templates will now default to using
your template as a base.

To ensure maximum compatibility with icekit's conventions for block names, we strongly
recommend refering to [icekit's base template](/icekit/templates/icekit/base.html).
2 changes: 2 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Add custom functionality to your site.
* [Layouts]
* [Placeholders]
* [Publishing]
* [Workflow]
* [Page trees and mptt]
* [Articles]
* [Writing portable apps]
Expand Down Expand Up @@ -96,6 +97,7 @@ team at [the Interaction Consortium]: [[email protected]](mailto:labs@inte
[Articles]: topics/articles.md
[Placeholders]: topics/placeholders.md
[Publishing]: topics/publishing.md
[Workflow]: topics/workflow.md
[Page trees and mptt]: topics/page-trees-and-mptt.md
[Writing portable apps]: topics/portable-apps.md
[Release notes]: changelog.md
Expand Down
20 changes: 20 additions & 0 deletions docs/intro/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,23 @@ Here are some of the most commonly used Docker commands when getting started:
docker rm -f $(docker ps -a -q)
docker rmi $(docker images -q)
docker volume rm $(docker volume ls -q)

# Docker-cloud commands

The following commands can be run on a terminal on the docker-cloud container.
First run `entrypoint.sh bash` to set up the environment for the following
commands.

# Run Django's debug server on a cloud container - ge
$ supervisorctl.sh stop all
$ runserver.sh
# then when you've finished and Ctrl-C exited runserver
$ supervisorctl.sh start all

# Dump a database, encrypt it, and upload to the transfer.sh service, then delete the local copy
$ pg_dump -O -x -f ~/dump.sql && cat ~/dump.sql|gpg -ac -o-|curl -X PUT --upload-file "-" https://transfer.sh/dump.x && rm ~/dump.sql

# then on the destination machine, to download and decrypt:
$ curl [transfer.sh url] | gpg -o- > dump.sql
$ psql < dump.sql
$ rm dump.sql
9 changes: 9 additions & 0 deletions docs/topics/celery.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Celery

In ICEkit background tasks are queued using Celery, and scheduled in
`crontab`-like fashion using CeleryBeat.

## To check Celery tasks are running
check the log (stdout) of the Celery Docker container for actual tasks being
executed. Check the logs (stdout) of the celerybeat container to ensure the
scheduled tasks process is running.
51 changes: 51 additions & 0 deletions docs/topics/search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Search in ICEkit

ICEkit uses Haystack with an Elastic Search backend for its onsite search.

It comes with a simple SearchIndex, `icekit.utils.search.AbstractLayoutIndex`
which works well on content that:

* Implements the `ListableMixin` for getting list content
* Uses fluent contents (having a number of rich content placeholders)
* Is publishable (the index queryset defaults to `objects.published()`)
* Is polymorphic (the `django_ct` value always matches `get_model()`, rather
than varying by the object being indexed.

ICEkit and GLAMkit's default content types use this index:

* Page (including LayoutPage, ArticleListingPage, etc.)
* Article
* Author

And in optional libraries:
* icekit_events.EventBase
* icekit_press_releases.PressRelease
* glamkit_collections.WorkBase
* glamkit_collections.CreatorBase
* etc.

`AbstractLayoutIndex` renders the `search/indexes/icekit/default.txt` template
which indexes ListableMixin content, all Fluent placeholders, and some common
content fields. You can render a different template in your search index by
redeclaring the `title` field. HTML tags are stripped and HTML entities are
converted to unicode.

## Using `AbstractLayoutIndex`

As minimal example, create `search_indexes.py` on a publishable, `ListableMixin`
model:

from haystack import indexes
from icekit.utils.search import AbstractLayoutIndex
from . import models

class MyModelIndex(AbstractLayoutIndex, indexes.Indexable):
def get_model(self):
return models.MyModel

Publish the content you want to be indexed, then run `manage.py update_index`.

## Search Page

The `icekit.page_types.search_page` page plugin implements a search page.
To use it for your site, create a search page, and preview/publish it.
Loading

0 comments on commit 8192212

Please sign in to comment.