-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start this project off with a basic scaffolding for local development using Poetry, Docker, and Tox. Bits and pieces have been cribbed from past projects and many, many web searches.
- Loading branch information
0 parents
commit 7c56543
Showing
17 changed files
with
2,455 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
*.py{cod} | ||
*.egg-info | ||
.cache | ||
.gitignore | ||
/.coverage | ||
/.coverage.* | ||
/.env | ||
/.git | ||
/.tox | ||
/COPYING | ||
/docker-compose.yaml | ||
/docs | ||
/poetry.toml | ||
__pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
*.pyc | ||
/*.egg-info/ | ||
/.coverage | ||
/.env | ||
/.python-version | ||
/.tox | ||
/docs/htmlcov | ||
/poetry.toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
default_language_version: | ||
python: python3.7 | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v3.2.0 | ||
hooks: | ||
- id: check-yaml | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- repo: https://github.com/psf/black | ||
rev: 20.8b1 | ||
hooks: | ||
- id: black | ||
- repo: https://github.com/PyCQA/bandit | ||
rev: '1.6.2' | ||
hooks: | ||
- id: bandit |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
FROM python:3.7-buster | ||
|
||
ENV PYTHONBUFFERED=1 \ | ||
PYTHONDONTWRITEBYTECODE=1 \ | ||
PIP_NO_CACHE_DIR=off \ | ||
PIP_DISABLE_PIP_VERSION_CHECK=on \ | ||
POETRY_ROOT="/srv/poetry" \ | ||
POETRY_BIN_DIR="/srv/poetry/bin" \ | ||
POETRY="/srv/poetry/bin/poetry" \ | ||
POETRY_NO_INTERACTION=1 \ | ||
POETRY_VIRTUALENVS_CREATE=0 | ||
|
||
# Install poetry in an isolated venv | ||
RUN python3 -m venv $POETRY_ROOT \ | ||
&& $POETRY_BIN_DIR/pip3 install poetry | ||
|
||
WORKDIR /usr/src/app | ||
COPY pyproject.toml poetry.lock ./ | ||
RUN $POETRY export -f requirements.txt -o requirements.txt \ | ||
&& pip3 install -r requirements.txt | ||
|
||
COPY . ./ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
================= | ||
Wikimedia Toolhub | ||
================= | ||
|
||
An authoritative and well promoted catalog of Wikimedia tools. | ||
|
||
License | ||
======= | ||
Toolhub is licensed under the `GNU GPLv3+`_ license. | ||
|
||
.. _GNU GPLv3+: https://www.gnu.org/copyleft/gpl.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--- | ||
version: "3.2" | ||
services: | ||
toolhub: | ||
build: . | ||
image: "toolhub:${DOCKER_TOOLHUB_TAG}" | ||
command: python3 manage.py runserver 0.0.0.0:8000 | ||
environment: | ||
- DJANGO_SECRET_KEY | ||
- DJANGO_DEBUG | ||
- DJANGO_ALLOWED_HOSTS | ||
- LOGGING_HANDLERS | ||
- LOGGING_LEVEL | ||
- DB_ENGINE | ||
- DB_NAME | ||
- DB_USER | ||
- DB_PASSWORD | ||
- DB_HOST | ||
- DB_PORT | ||
- CACHE_BACKEND | ||
- CACHE_LOCATION | ||
volumes: | ||
- type: bind | ||
source: . | ||
target: /usr/src/app | ||
consistency: cached | ||
ports: | ||
- "8000:8000" | ||
restart: always | ||
depends_on: | ||
- db | ||
db: | ||
image: mariadb:10.4 | ||
restart: always | ||
command: | ||
- "--character-set-server=utf8mb4" | ||
- "--collation-server=utf8mb4_unicode_ci" | ||
environment: | ||
MYSQL_DATABASE: ${DB_NAME} | ||
MYSQL_USER: ${DB_USER} | ||
MYSQL_PASSWORD: ${DB_PASSWORD} | ||
MYSQL_ROOT_PASSWORD: ${DOCKER_DB_MYSQL_ROOT_PASSWORD} | ||
volumes: | ||
- type: volume | ||
source: dbdata | ||
target: /var/lib/mysql | ||
consistency: consistent | ||
volumes: | ||
dbdata: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
=============== | ||
Code of Conduct | ||
=============== | ||
|
||
The development of this software is covered by the `Code of Conduct for | ||
Wikimedia technical spaces`_. | ||
|
||
.. _Code of Conduct for Wikimedia technical spaces: https://www.mediawiki.org/wiki/Code_of_Conduct |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
================= | ||
How to contribute | ||
================= | ||
|
||
.. code-block:: shell-session | ||
$ docker-compose up --build -d | ||
$ docker-compose run toolhub python3 manage.py migrate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env python3 | ||
"""Django's command-line utility for administrative tasks.""" | ||
import os | ||
import sys | ||
|
||
|
||
def main(): | ||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "toolhub.settings") | ||
try: | ||
from django.core.management import execute_from_command_line | ||
except ImportError as exc: | ||
raise ImportError( | ||
"Couldn't import Django. Are you sure it's installed and " | ||
"available on your PYTHONPATH environment variable? Did you " | ||
"forget to activate a virtual environment?" | ||
) from exc | ||
execute_from_command_line(sys.argv) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
Oops, something went wrong.