├── .dockerfile
├── LICENSE
├── Procfile
├── README.md
├── bin
└── post_compile
├── dashboard
└── templates
│ └── wagtailadmin
│ ├── base.html
│ ├── home.html
│ └── login.html
├── docker-compose.yml
├── requirements.txt
└── runtime.txt
/.dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.4
2 |
3 | RUN mkdir -p /usr/src/app
4 | WORKDIR /usr/src/app
5 |
6 | COPY requirements.txt /usr/src/app/
7 | RUN pip install --no-cache-dir -r requirements.txt
8 |
9 | ENV PYTHONUNBUFFERED 1
10 | ENV PYTHONDONTWRITEBYTECODE 1
11 | ENV LANG en_US.UTF-8
12 | ENV PYTHONIOENCODING utf_8
13 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 fffunction
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/Procfile:
--------------------------------------------------------------------------------
1 | web: gunicorn [appname].wsgi:application
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Starting a Wagtail build
2 |
3 | ## Prerequisites
4 |
5 | - [Docker for mac/Docker for windows](https://docs.docker.com/engine/installation/#/on-osx-and-windows)
6 |
7 | ## Getting Running
8 |
9 | 1. Go to folder you want to start a new project in. It doesn't have to be empty.
10 | 2. Copy the `.dockerfile`, `docker-compose.yml`, and `requirements.txt` files included here into your directory.
11 | 3. In a command line, `cd` to your project folder.
12 | 4. `docker-compose build`
13 | 5. `docker-compose run web wagtail start [projectname]`
14 | 6. Move the contents of the new [projectname] folder out into the root
15 | 7. Change the database settings in [projectname]/settings/base.py to use `dj_database_url` [Link to example config](#dj_database_url-config)
16 | 8. `docker-compose run web ./manage.py migrate`
17 | 9. `docker-compose run web ./manage.py createsuperuser`
18 | 10. `docker-compose up` and your Wagtail admin will be running at `http://localhost/admin` (if you use the default docker ip)
19 |
20 | ### Optional
21 |
22 | Update your `STATICFILES_DIRS`, `STATIC_ROOT`, `STATIC_URL`, `MEDIA_ROOT`, `MEDIA_URL` variables.
23 |
24 | ## Custom Branding
25 |
26 | 1. Create a new app called `dashboard` to hold your custom wagtail branding templates. This is done with `docker-compose run web django startapp dashboard`
27 | 2. Copy the `dashboard/templates` folder from this repo into your own dashboard folder.
28 | 3. Point the image sources in these tempates to a logo and change `[project name]` to a suitable name.
29 | 4. Add `'dashboard'` to the `INSTALLED_APPS` in `base.py` making sure `'overextends','dashboard',` comes before `'wagtail.wagtailadmin','wagtail.wagtailcore',`.
30 |
31 | ## Set up for Dokku deployment
32 |
33 | Required files:
34 |
35 | - Procfile (requires pointing to the correct wsgi file)
36 | - runtime.txt (requires setting to correct env)
37 | - wsgi.py changes [Link to config](#wsgipy-config)
38 |
39 | 1. Add the dokku server to your remotes. `git remote add dokku dokku@server.com:[appname]`
40 | 2. Push to dokku. `git push dokku [currentbranch]:master`
41 | 3. Either import a database with pgAdmin or run the `migrate` and `createsuperuser` commands details above
42 |
43 | ___
44 |
45 | ## Misc
46 |
47 | ### dj_database_url config
48 |
49 | ```python
50 | import dj_database_url
51 |
52 | DATABASES = {
53 | 'default': dj_database_url.config()
54 | }
55 | ```
56 |
57 | ### wsgi.py config
58 |
59 | Replace with the following:
60 |
61 | ```python
62 | import os
63 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "[APPNAME].settings")
64 |
65 | from django.core.wsgi import get_wsgi_application
66 | from whitenoise.django import DjangoWhiteNoise
67 |
68 | application = get_wsgi_application()
69 | application = DjangoWhiteNoise(application)
70 | ```
71 |
--------------------------------------------------------------------------------
/bin/post_compile:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | echo "-----> Running django-compressor"
4 | python manage.py compress --force
5 |
--------------------------------------------------------------------------------
/dashboard/templates/wagtailadmin/base.html:
--------------------------------------------------------------------------------
1 | {% overextends "wagtailadmin/base.html" %}
2 | {% load staticfiles %}
3 |
4 | {% block branding_logo %}
5 |
6 | {% endblock %}
7 |
--------------------------------------------------------------------------------
/dashboard/templates/wagtailadmin/home.html:
--------------------------------------------------------------------------------
1 | {% overextends "wagtailadmin/home.html" %}
2 |
3 | {% block branding_welcome %}Welcome to {{ site_name }}{% endblock %}
4 |
--------------------------------------------------------------------------------
/dashboard/templates/wagtailadmin/login.html:
--------------------------------------------------------------------------------
1 | {% overextends "wagtailadmin/login.html" %}
2 | {% load staticfiles %}
3 |
4 | {% block branding_login %}
5 | Sign in to
6 | {% endblock %}
7 |
--------------------------------------------------------------------------------
/docker-compose.yml:
--------------------------------------------------------------------------------
1 | web:
2 | build: .
3 | dockerfile: .dockerfile
4 | command: python manage.py runserver 0.0.0.0:80
5 | volumes:
6 | - ./:/usr/src/app
7 | links:
8 | - postgres
9 | - elasticsearch
10 | ports:
11 | - "80:80"
12 | environment:
13 | - DEBUG=True
14 | - DEV=True
15 | - DATABASE_URL=postgres://postgres:@postgres:5432/postgres
16 | - ELASTICSEARCH_URL=http://elasticsearch:9200
17 | - SECRET_KEY=notasecretreplaceme
18 | postgres:
19 | image: postgres
20 | ports:
21 | - "5432:5432"
22 | elasticsearch:
23 | image: orchardup/elasticsearch
24 | ports:
25 | - "9200:9200"
26 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | # Updated: 2016-10-31
2 |
3 | # Core
4 | gunicorn==19.6.0
5 | Django==1.10.2
6 | whitenoise==3.2.2
7 | wagtail==1.7
8 | django-overextends==0.4.2
9 | wagtailmodeladmin==2.5.7
10 |
11 | ## PostgreSQL
12 | psycopg2==2.6.2
13 | dj-database-url==0.4.1
14 |
15 | ## Search
16 | elasticsearch==5.0.0
17 |
18 | ## GIF image processing
19 | Wand==0.4.4
20 |
21 | # HTML sanitisation/cleaning
22 | bleach==1.4.3
23 |
24 | # Debug
25 | django-debug-toolbar==1.6
26 | django-template-debug==0.3.5
27 |
--------------------------------------------------------------------------------
/runtime.txt:
--------------------------------------------------------------------------------
1 | python-3.4.3
2 |
--------------------------------------------------------------------------------