Skip to content

Commit

Permalink
Major changes (including Django 1.11 and Python 3) (#178)
Browse files Browse the repository at this point in the history
- Add Docker setup
- Add Sentry support for error tracking
- Update to Django 1.11
- Update to Python 3.6
- Update dependencies
- Pin dependencies
- Vendor in django-faq
- Format code with black
- Convert codebase indents to spaces
- Order imports with isort
- Remove south migrations
- Replace Piston-based API with DRF (note: it's a quick replacement, expect 500s on invalid data, gameserver version detection isn't ported)
- Implement envvar-based configuration
- Replace brabeion with pinax.badges
- Remove django-admin-tools
- Move static assets to static dir from media
  • Loading branch information
chaosk committed Jul 20, 2018
1 parent 787875a commit 1d94f53
Show file tree
Hide file tree
Showing 502 changed files with 8,393 additions and 13,815 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.git/
.env
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ teerace/teerace.cache/
build/
pip-log.txt
src/
.env
celerybeat.pid
celerybeat-schedule
239 changes: 0 additions & 239 deletions .pylintrc

This file was deleted.

42 changes: 42 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
ARG PYTHON_TAG=3.6.5-alpine3.7

# Builder image
FROM python:${PYTHON_TAG} AS builder
RUN apk add --no-cache \
gettext-dev \
postgresql-dev \
gcc \
musl-dev \
pcre-dev
RUN mkdir /wheels
WORKDIR /wheels
COPY requirements.txt /wheels/requirements.txt
RUN pip wheel -r requirements.txt

# Final image
FROM python:${PYTHON_TAG}
ARG PROJECT_NAME=teerace
ENV PYTHONUNBUFFERED 1
ENV PROJECT_NAME ${PROJECT_NAME}
ENV GIT_COMMIT ${GIT_COMMIT}

RUN apk add --no-cache \
libpq \
pcre \
gettext
COPY --from=builder /wheels /wheels
RUN pip install \
-r /wheels/requirements.txt \
-f /wheels \
&& rm -rf /wheels \
&& rm -rf /root/.cache/pip
RUN addgroup -S app \
&& adduser -S -G app app
RUN mkdir /code
WORKDIR /code
COPY --chown=app:app setup.cfg entrypoint.sh ${PROJECT_NAME} /code/
# ADD tests /code/tests
USER app
WORKDIR /code/${PROJECT_NAME}/

ENTRYPOINT ["../entrypoint.sh"]
10 changes: 5 additions & 5 deletions LICENCE → LICENSE
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Copyright (c) 2010-2016, Krzysztof Socha <ksocha+teerace@ksocha.com> and individual contributors.
Copyright (c) 2010-2018, Krzysztof Socha <ksocha+teerace@ksocha.com> and individual contributors.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice,
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright

2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

Expand All @@ -24,4 +24,4 @@ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
recursive-include teerace/media *
recursive-include teerace/templates *

include LICENCE
include LICENSE
include README
include *.txt
52 changes: 52 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
COMPOSE_FILE?=dev.yml
BASE=docker-compose -f $(COMPOSE_FILE)
RUN_DJANGO = $(BASE) run --rm django

shell:
$(RUN_DJANGO) manage shell

shell_plus:
$(RUN_DJANGO) manage shell_plus

migrate:
$(RUN_DJANGO) manage migrate

makemigrations:
$(RUN_DJANGO) manage makemigrations

test:
$(BASE) run django pytest

sh:
$(RUN_DJANGO) sh

up:
$(BASE) up

stop:
$(BASE) stop

down:
$(BASE) down

build:
$(BASE) build

runserver:
$(BASE) run --service-ports --rm django runserver

runserver_plus:
$(BASE) run --service-ports --rm django runserver_plus

outdated:
$(BASE) pip list --outdated --format=columns

isort:
$(RUN_DJANGO) isort

mypy:
$(RUN_DJANGO) mypy

black:
$(RUN_DJANGO) black

Loading

0 comments on commit 1d94f53

Please sign in to comment.