File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ __pycache__
2+ * .pyc
3+ * .pyo
4+ * .pyd
5+ .Python
6+ * .so
7+ * .egg
8+ * .egg-info
9+ dist
10+ build
11+ .git
12+ .gitignore
13+ .vscode
14+ .idea
15+ * .swp
16+ * .swo
17+ * ~
18+ .DS_Store
19+ db.sqlite3
20+ * .sqlite3
21+ .env
22+ venv
23+ env
24+ ENV
25+ .venv
26+ staticfiles
27+ media
28+ * .log
29+ .coverage
30+ htmlcov
31+ .pytest_cache
32+ .mypy_cache
33+ node_modules
34+ postgres_data
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ editgroups/settings/secret.py
55editgroups /settings /__init__.py
66static /
77celerybeat-schedule.db
8+ celerybeat-schedule
89docs /_build /
910
1011.project
Original file line number Diff line number Diff line change 1+ FROM docker-registry.tools.wmflabs.org/toolforge-python311-sssd-web:latest
2+
3+ WORKDIR /root/www/python/
4+
5+ RUN apt-get update && apt-get install -y \
6+ gcc \
7+ libxml2-dev \
8+ libxslt1-dev \
9+ zlib1g-dev \
10+ git \
11+ netcat-openbsd \
12+ curl \
13+ && rm -rf /var/lib/apt/lists/*
14+
15+ # Necessary flags for mysqlclient driver
16+ ENV MYSQLCLIENT_CFLAGS="-I/usr/include/mariadb/"
17+ ENV MYSQLCLIENT_LDFLAGS="-L/usr/lib/x86_64-linux-gnu/ -lmariadb"
18+ ENV VIRTUAL_ENV /root/www/python/venv
19+ ENV PATH="/root/www/python/venv/bin:${PATH}"
20+ ENV DJANGO_SETTINGS_MODULE=editgroups.settings
21+ ENV PYTHONPATH="/root/www/python/src:${PYTHONPATH}"
22+ COPY requirements.txt ./src/requirements.txt
23+ RUN echo "mysqlclient==2.2.7" >> /root/www/python/src/requirements.txt
24+ RUN webservice-python-bootstrap
25+
26+ COPY . ./src
27+ WORKDIR /root/www/python/src/
28+
29+ RUN echo "from .dev import *" > /root/www/python/src/editgroups/settings/__init__.py
30+ COPY editgroups/settings/docker.py /root/www/python/src/editgroups/settings/secret.py
31+ RUN echo "source /root/www/python/venv/bin/activate" >> /root/.bashrc # useful when entering the shell
32+
33+ # Just to make sure virtual environment is working properly
34+ RUN ["/bin/bash" , "-c" , "source ../venv/bin/activate && python3 manage.py collectstatic --no-input" ]
35+
36+ EXPOSE 8000
Original file line number Diff line number Diff line change 1+ services :
2+ mariadb :
3+ image : mariadb:11.7.2
4+ environment :
5+ MARIADB_DATABASE : ${DB_NAME:-editgroups}
6+ MARIADB_ROOT_PASSWORD : ${DB_PASSWORD:-editgroups}
7+ volumes :
8+ - mariadb:/var/lib/mysql
9+ healthcheck :
10+ test : healthcheck.sh --connect --innodb_initialized
11+ start_period : 10s
12+ interval : 10s
13+ timeout : 5s
14+ retries : 3
15+ expose :
16+ - 3306
17+
18+ redis :
19+ image : redis:7.4
20+ expose :
21+ - 6379
22+ healthcheck :
23+ test : ["CMD", "redis-cli", "ping"]
24+ interval : 5s
25+ timeout : 3s
26+ retries : 5
27+
28+ app :
29+ ports :
30+ - 8000:8000
31+ healthcheck :
32+ test : curl --fail http://localhost:8000/ || exit 1
33+ start_period : 10s
34+ interval : 10s
35+ command : >
36+ /bin/bash -c "
37+ django-admin collectstatic --no-input &&
38+ django-admin migrate &&
39+ django-admin runserver 0.0.0.0:8000
40+ "
41+ << : &app
42+ build :
43+ context : .
44+ dockerfile : Dockerfile
45+ depends_on :
46+ mariadb :
47+ condition : service_healthy
48+ redis :
49+ condition : service_healthy
50+ environment :
51+ - SECRET_KEY=${DJANGO_SECRET_KEY:-}
52+ - DB_NAME=${DB_NAME:-editgroups}
53+ - DB_PASSWORD=${DB_NAME:-editgroups}
54+
55+ celery :
56+ << : *app
57+ command : >
58+ /bin/bash -c "
59+ source ../venv/bin/activate
60+ C_FORCE_ROOT=1 python3 ../venv/bin/celery --app=editgroups.celery:app worker -l INFO -B --concurrency=3 --max-memory-per-child=50000
61+ "
62+ depends_on :
63+ app :
64+ condition : service_healthy
65+ listener :
66+ << : *app
67+ command : >
68+ /bin/bash -c "
69+ source ../venv/bin/activate
70+ django-admin listener
71+ "
72+ depends_on :
73+ app :
74+ condition : service_healthy
75+
76+ volumes :
77+ mariadb :
Original file line number Diff line number Diff line change 1+ import os
2+
3+ SECRET_KEY = 'django-insecure-0ldt)=t=w(%l)7b28n=x!#9ciei^yuox3204(#(r!-fh^59+a-'
4+ DATABASES = {
5+ 'default' : {
6+ 'ENGINE' : 'django.db.backends.mysql' ,
7+ 'HOST' : 'mariadb' ,
8+ 'NAME' : os .getenv ("DB_NAME" ),
9+ 'PASSWORD' : os .getenv ("DB_PASSWORD" ),
10+ 'OPTIONS' : {
11+ 'init_command' : "SET sql_mode='STRICT_TRANS_TABLES'" ,
12+ 'charset' : 'utf8mb4' ,
13+ },
14+ }
15+ }
16+
17+ SOCIAL_AUTH_MEDIAWIKI_KEY = 'your_mediawiki_key'
18+ SOCIAL_AUTH_MEDIAWIKI_SECRET = 'your_mediawiki_secret'
19+ SOCIAL_AUTH_MEDIAWIKI_URL = 'https://www.wikidata.org/w/index.php'
20+ SOCIAL_AUTH_MEDIAWIKI_CALLBACK = 'http://localhost:8000/oauth/complete/mediawiki/'
21+
22+ REDIS_HOST = 'redis'
23+ REDIS_PORT = 6379
24+ REDIS_DB = 0
25+ REDIS_PASSWORD = ''
26+ REDIS_KEY_PREFIX = 'editgroups_'
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ import os
2+
3+ from django .core .wsgi import get_wsgi_application
4+
5+ os .environ .setdefault ("DJANGO_SETTINGS_MODULE" , "editgroups.settings" )
6+
7+ application = get_wsgi_application ()
8+
You can’t perform that action at this time.
0 commit comments