Skip to content

Commit ea6cefc

Browse files
committed
fixed a few bugs
1 parent 6a809e2 commit ea6cefc

File tree

6 files changed

+48
-24
lines changed

6 files changed

+48
-24
lines changed

DOCKER_README.md

Whitespace-only changes.

celerybeat-schedule

16 KB
Binary file not shown.

docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ services:
3636
- "8000:8000"
3737
environment:
3838
- DJANGO_SETTINGS_MODULE=editgroups.settings.docker
39+
- RUN_MIGRATIONS=true
3940
depends_on:
4041
db:
4142
condition: service_healthy
@@ -49,6 +50,7 @@ services:
4950
- .:/app
5051
environment:
5152
- DJANGO_SETTINGS_MODULE=editgroups.settings.docker
53+
- C_FORCE_ROOT=true
5254
depends_on:
5355
- db
5456
- redis

docker-entrypoint.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,21 @@
22

33
set -e
44

5-
echo "Waiting for PostgreSQL..."
5+
echo "Waiting for PostgreSQL"
66
while ! nc -z db 5432; do
77
sleep 0.1
88
done
99
echo "PostgreSQL started"
1010

11-
echo "Running migrations..."
12-
python manage.py migrate --noinput
11+
if [ "$RUN_MIGRATIONS" = "true" ]; then
12+
echo "Running migrations"
13+
python manage.py migrate --noinput
1314

14-
echo "Collecting static files..."
15-
python manage.py collectstatic --noinput
15+
echo "Collecting static files"
16+
python manage.py collectstatic --noinput
1617

17-
echo "Creating superuser if it doesn't exist..."
18-
python manage.py shell -c "
18+
echo "Creating superuser if it doesn't exist"
19+
python manage.py shell -c "
1920
from django.contrib.auth import get_user_model
2021
User = get_user_model()
2122
if not User.objects.filter(username='admin').exists():
@@ -24,5 +25,6 @@ if not User.objects.filter(username='admin').exists():
2425
else:
2526
print('Superuser already exists')
2627
" || true
28+
fi
2729

2830
exec "$@"

editgroups/settings/docker.py

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
from .common import *
2-
3-
DEBUG = True
4-
ALLOWED_HOSTS = ['*']
5-
6-
SECRET_KEY = '20oj&tj8uaruseitlrise,tries,uirsetur36746209etus7e'
1+
import os
2+
import sys
3+
from types import ModuleType
74

8-
DATABASES = {
5+
secret = ModuleType('editgroups.settings.secret')
6+
secret.SECRET_KEY = '20oj&tj8uaruseitlrise,tries,uirsetur36746209etus7e'
7+
secret.DATABASES = {
98
'default': {
109
'ENGINE': 'django.db.backends.postgresql_psycopg2',
1110
'NAME': 'editgroups',
@@ -16,14 +15,20 @@
1615
'DISABLE_SERVER_SIDE_CURSORS': False,
1716
}
1817
}
18+
secret.SOCIAL_AUTH_MEDIAWIKI_KEY = 'your_mediawiki_key'
19+
secret.SOCIAL_AUTH_MEDIAWIKI_SECRET = 'your_mediawiki_secret'
20+
secret.SOCIAL_AUTH_MEDIAWIKI_URL = 'https://www.wikidata.org/w/index.php'
21+
secret.SOCIAL_AUTH_MEDIAWIKI_CALLBACK = 'http://localhost:8000/oauth/complete/mediawiki/'
22+
secret.REDIS_HOST = 'redis'
23+
secret.REDIS_PORT = 6379
24+
secret.REDIS_DB = 0
25+
secret.REDIS_PASSWORD = ''
26+
secret.REDIS_KEY_PREFIX = 'editgroups_'
1927

20-
SOCIAL_AUTH_MEDIAWIKI_KEY = 'your_mediawiki_key'
21-
SOCIAL_AUTH_MEDIAWIKI_SECRET = 'your_mediawiki_secret'
22-
SOCIAL_AUTH_MEDIAWIKI_URL = 'https://www.wikidata.org/w/index.php'
23-
SOCIAL_AUTH_MEDIAWIKI_CALLBACK = 'http://localhost:8000/oauth/complete/mediawiki/'
28+
sys.modules['editgroups.settings.secret'] = secret
2429

25-
REDIS_HOST = 'redis'
26-
REDIS_PORT = 6379
27-
REDIS_DB = 0
28-
REDIS_PASSWORD = ''
29-
REDIS_KEY_PREFIX = 'editgroups_'
30+
from .common import *
31+
32+
DEBUG = True
33+
ALLOWED_HOSTS = ['*']
34+
BASE_DIR = os.path.dirname(os.path.dirname(__file__))

editgroups/wsgi.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,16 @@
1-
../app.py
1+
"""
2+
WSGI config for editgroups project.
3+
4+
It exposes the WSGI callable as a module-level variable named ``application``.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/
8+
"""
9+
10+
import os
11+
12+
from django.core.wsgi import get_wsgi_application
13+
14+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "editgroups.settings")
15+
16+
application = app = get_wsgi_application()

0 commit comments

Comments
 (0)