Use Wagtail master

i18n-poc
Karl Hobley 2020-06-30 11:38:58 +01:00
rodzic 766fdf3db6
commit 4451df5001
8 zmienionych plików z 85 dodań i 54 usunięć

3
.gitmodules vendored
Wyświetl plik

@ -4,3 +4,6 @@
[submodule "wagtail-localize-pontoon"]
path = wagtail-localize-pontoon
url = https://github.com/wagtail/wagtail-localize-pontoon.git
[submodule "wagtail"]
path = wagtail
url = https://github.com/kaedroho/wagtail.git

Wyświetl plik

@ -1,50 +1,82 @@
FROM python:3.5-alpine
FROM node:14 as frontend
ADD requirements/ /requirements/
RUN mkdir /code/
WORKDIR /code/
# Compile static files
COPY ./wagtail ./wagtail
RUN cd ./wagtail && npm install --no-optional --no-audit --progress=false
RUN cd ./wagtail && npm run dist
FROM python:3.7-slim
# Install packages needed to run your application (not build deps):
# We need to recreate the /usr/share/man/man{1..8} directories first because
# they were clobbered by a parent image.
RUN set -ex \
&& apk add --no-cache --virtual .build-deps \
gcc \
g++ \
make \
libc-dev \
musl-dev \
linux-headers \
pcre-dev \
postgresql-dev \
libjpeg-turbo-dev \
zlib-dev \
git \
&& pyvenv /venv \
&& /venv/bin/pip install -U pip \
&& LIBRARY_PATH=/lib:/usr/lib /bin/sh -c "/venv/bin/pip install -r /requirements/production.txt" \
&& runDeps="$( \
scanelf --needed --nobanner --recursive /venv \
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
| sort -u \
| xargs -r apk info --installed \
| sort -u \
)" \
&& apk add --virtual .python-rundeps $runDeps \
&& apk del .build-deps \
&& apk add libjpeg-turbo pcre
RUN apk add --no-cache postgresql-client
&& RUN_DEPS=" \
libexpat1 \
libjpeg62-turbo \
libpcre3 \
libpq5 \
mime-support \
postgresql-client \
procps \
zlib1g \
" \
&& seq 1 8 | xargs -I{} mkdir -p /usr/share/man/man{} \
&& rm -rf /var/lib/apt/lists/*
RUN set -ex \
&& BUILD_DEPS=" \
build-essential \
git \
libexpat1-dev \
libjpeg62-turbo-dev \
libpcre3-dev \
libpq-dev \
zlib1g-dev \
" \
&& apt-get update && apt-get install -y --no-install-recommends $BUILD_DEPS \
&& python3.7 -m venv /venv \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir /code/
WORKDIR /code/
ADD . /code/
COPY --from=frontend /code/wagtail /code/wagtail
RUN /venv/bin/pip install -U pip \
&& /venv/bin/pip install --no-cache-dir -r ./requirements/production.txt
EXPOSE 8000
# Add custom environment variables needed by Django or your settings file here:
ENV DJANGO_SETTINGS_MODULE=bakerydemo.settings.production DJANGO_DEBUG=off
# uWSGI configuration (customize as needed):
ENV UWSGI_VIRTUALENV=/venv UWSGI_WSGI_FILE=bakerydemo/wsgi_production.py UWSGI_HTTP=:8000 UWSGI_MASTER=1 UWSGI_WORKERS=2 UWSGI_THREADS=8 UWSGI_UID=1000 UWSGI_GID=2000
# Tell uWSGI where to find your wsgi file:
ENV UWSGI_WSGI_FILE=bakerydemo/wsgi.py
# Base uWSGI configuration (you shouldn't need to change these):
ENV UWSGI_VIRTUALENV=/venv UWSGI_HTTP=:8000 UWSGI_MASTER=1 UWSGI_HTTP_AUTO_CHUNKED=1 UWSGI_HTTP_KEEPALIVE=1 UWSGI_UID=1000 UWSGI_GID=2000 UWSGI_LAZY_APPS=1 UWSGI_WSGI_ENV_BEHAVIOR=holy
# Number of uWSGI workers and threads per worker (customize as needed):
ENV UWSGI_WORKERS=2 UWSGI_THREADS=4
# uWSGI uploaded media file serving configuration:
ENV UWSGI_STATIC_MAP="/media/=/code/bakerydemo/media/"
# Call collectstatic with dummy environment variables:
RUN DATABASE_URL=postgres://none REDIS_URL=none /venv/bin/python manage.py collectstatic --noinput
# make sure static files are writable by uWSGI process
RUN chown -R 1000:2000 /code/bakerydemo/media
RUN mkdir -p /code/bakerydemo/media/images && chown -R 1000:2000 /code/bakerydemo/media
# mark the destination for images as a volume
VOLUME ["/code/bakerydemo/media/images/"]
# start uWSGI, using a wrapper script to allow us to easily add more commands to container startup:
ENTRYPOINT ["/code/docker-entrypoint.sh"]
CMD ["/venv/bin/uwsgi", "--http-auto-chunked", "--http-keepalive", "--static-map", "/media/=/code/bakerydemo/media/"]
# Start uWSGI
CMD ["/venv/bin/uwsgi", "--show-config"]

Wyświetl plik

@ -1,17 +1,5 @@
{
"name": "WagtailBakeryDemo",
"description": "WagtailBakeryDemo",
"repository": "https://github.com/wagtail/bakerydemo",
"keywords": ["wagtail", "django"],
"env": {
"DJANGO_DEBUG": "off",
"DJANGO_SETTINGS_MODULE": "bakerydemo.settings.production",
"DJANGO_SECURE_SSL_REDIRECT": "on"
},
"scripts": {
"postdeploy": "django-admin.py migrate && django-admin.py load_initial_data && echo 'from wagtail.images.models import Rendition; Rendition.objects.all().delete()' | django-admin.py shell"
},
"addons": [
"heroku-postgresql:hobby-dev"
]
"postdeploy": "django-admin.py migrate"
}
}

Wyświetl plik

@ -1,7 +1,7 @@
from wagtail.api.v2.endpoints import PagesAPIEndpoint
from wagtail.api.v2.views import PagesAPIViewSet
from wagtail.api.v2.router import WagtailAPIRouter
from wagtail.images.api.v2.endpoints import ImagesAPIEndpoint
from wagtail.documents.api.v2.endpoints import DocumentsAPIEndpoint
from wagtail.images.api.v2.views import ImagesAPIViewSet
from wagtail.documents.api.v2.views import DocumentsAPIViewSet
# Create the router. "wagtailapi" is the URL namespace
api_router = WagtailAPIRouter('wagtailapi')
@ -10,6 +10,6 @@ api_router = WagtailAPIRouter('wagtailapi')
# The first parameter is the name of the endpoint (eg. pages, images). This
# is used in the URL of the endpoint
# The second parameter is the endpoint class that handles the requests
api_router.register_endpoint('pages', PagesAPIEndpoint)
api_router.register_endpoint('images', ImagesAPIEndpoint)
api_router.register_endpoint('documents', DocumentsAPIEndpoint)
api_router.register_endpoint('pages', PagesAPIViewSet)
api_router.register_endpoint('images', ImagesAPIViewSet)
api_router.register_endpoint('documents', DocumentsAPIViewSet)

7
heroku.yml 100644
Wyświetl plik

@ -0,0 +1,7 @@
build:
docker:
web: Dockerfile
release:
image: web
command:
- django-admin migrate --noinput

Wyświetl plik

@ -1,6 +1,6 @@
Django>=2.1,<2.2
django-dotenv==1.4.1
Wagtail==2.7
-e ./wagtail
wagtailfontawesome>=1.1.3,<1.2
Pillow==4.0.0

Wyświetl plik

@ -5,7 +5,7 @@ elasticsearch==2.4.1
# Additional dependencies for Heroku deployment
dj-database-url==0.4.1
uwsgi==2.0.18
psycopg2==2.8.4
psycopg2==2.8.5
whitenoise==3.2.2
boto==2.45.0
django-storages==1.6.5

1
wagtail 160000

@ -0,0 +1 @@
Subproject commit 80f7db750aceead11ab3f4c9d410bd227d203495