Fix things

This commit is contained in:
Jan Tuomi
2017-09-15 20:11:44 +03:00
parent 84ca084533
commit 12027a5a80
4 changed files with 40 additions and 18 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ services:
web:
build: .
image: 86.50.143.82:5000/web20
command: ["bash", "-c", "./.wait-for-it.sh db:5432 -- bash setup.py --no-input"]
command: ["bash", "-c", "cd /code && ./wait-for-it.sh db:5432 -- bash setup.sh --no-input --no-npm && python manage.py runserver 0.0.0.0:8080"]
volumes:
- .:/code
ports:
+13 -4
View File
@@ -6,10 +6,17 @@ echo "========================================================="
echo "Dependencies: postgresql>9.5, python>3.5"
INTERACTIVE="true"
USE_NPM="true"
if [[ $* == *--no-input* ]]
then
INTERACTIVE="false"
fi
if [[ $* == *--no-npm* ]]
then
USE_NPM="false"
fi
$INTERACTIVE || echo "Running in non-interactive mode." && env
$INTERACTIVE && read -p "Are these programs installed? [y/n]" -n 1 -r || REPLY="y"
echo ""
@@ -56,11 +63,13 @@ then
fi
set -e
(set -x; pip install -r requirements.txt)
(set -x; npm install)
(set -x; python manage.py migrate)
(set -x; python manage.py createdefaultadmin)
set -x
pip install -r requirements.txt
$USE_NPM && npm install
python manage.py migrate
python manage.py createdefaultadmin
set +e
set +x
echo "Done."
echo "Run 'python manage.py runserver 0.0.0.0:8000' to start the development server!"
+16 -3
View File
@@ -19,6 +19,7 @@ from django.utils.translation import ugettext_lazy as _
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
IS_DOCKER = bool(os.getenv('IS_DOCKER', None))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
@@ -106,7 +107,8 @@ WSGI_APPLICATION = 'sikweb.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.9/ref/settings/#databases
DATABASES = {
if not IS_DOCKER:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'sik',
@@ -118,8 +120,19 @@ DATABASES = {
'NAME': 'sik_test',
},
},
}
}
else:
logging.info('Using docker database configuration')
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'postgres',
'USER': 'postgres',
'PASSWORD': 'postgres',
'HOST': 'db',
'PORT': '5432',
},
}
# Password validation
# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
View File