stash
This commit is contained in:
parent
4f2fe011c0
commit
6fcdd1eefa
4 changed files with 22 additions and 9 deletions
|
|
@ -114,7 +114,7 @@ WSGI_APPLICATION = 'backend.wsgi.application'
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': {
|
'default': {
|
||||||
'ENGINE': 'django.db.backends.sqlite3',
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
'NAME': BASE_DIR / 'db.sqlite3',
|
'NAME': os.environ.get('TOOLSHED_DB_PATH', BASE_DIR / 'db.sqlite3'),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -155,7 +155,7 @@ USE_TZ = True
|
||||||
STATIC_ROOT = 'staticfiles'
|
STATIC_ROOT = 'staticfiles'
|
||||||
STATIC_URL = '/static/'
|
STATIC_URL = '/static/'
|
||||||
|
|
||||||
MEDIA_ROOT = 'userfiles'
|
MEDIA_ROOT = os.environ.get('TOOLSHED_USERFILES_PATH', 'userfiles')
|
||||||
MEDIA_URL = '/media/'
|
MEDIA_URL = '/media/'
|
||||||
|
|
||||||
# Default primary key field type
|
# Default primary key field type
|
||||||
|
|
|
||||||
|
|
@ -183,7 +183,11 @@ def testdata():
|
||||||
import django
|
import django
|
||||||
|
|
||||||
django.setup()
|
django.setup()
|
||||||
if os.path.exists('testdata.py'):
|
testdata_path = os.environ.get('TOOLSHED_SETUP_PATH', 'testdata.py')
|
||||||
|
if os.path.exists(testdata_path):
|
||||||
|
if testdata_path != 'testdata.py':
|
||||||
|
import sys
|
||||||
|
sys.path.append(os.path.dirname(testdata_path))
|
||||||
from testdata import create_test_data
|
from testdata import create_test_data
|
||||||
create_test_data()
|
create_test_data()
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ WORKDIR /code
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
COPY requirements.txt /code/
|
COPY requirements.txt /code/
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
RUN touch /mnt/db.sqlite3 && touch /mnt/testdata.py && mkdir /mnt/userfiles
|
||||||
|
|
||||||
# Run the application
|
# Run the application
|
||||||
CMD ["sh", "-c", "python manage.py migrate && python manage.py runserver 0.0.0.0:8000 --insecure"]
|
CMD ["sh", "-c", "python manage.py migrate && python manage.py runserver 0.0.0.0:8000 --insecure"]
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,16 @@ services:
|
||||||
build:
|
build:
|
||||||
context: ../backend/
|
context: ../backend/
|
||||||
dockerfile: ../deploy/dev/Dockerfile.backend
|
dockerfile: ../deploy/dev/Dockerfile.backend
|
||||||
|
environment:
|
||||||
|
TOOLSHED_DB_PATH: /mnt/db.sqlite3
|
||||||
|
TOOLSHED_USERFILES_PATH: /mnt/userfiles
|
||||||
|
TOOLSHED_SETUP_PATH: /mnt/testdata.py
|
||||||
volumes:
|
volumes:
|
||||||
- ../backend:/code
|
- ../backend:/code
|
||||||
- ../deploy/dev/instance_a/a.env:/code/.env
|
- ../deploy/dev/instance_a/a.env:/code/.env
|
||||||
- ../deploy/dev/instance_a/testdata.py:/code/testdata.py
|
- ../deploy/dev/instance_a/testdata.py:/mnt/testdata.py
|
||||||
- ../deploy/dev/instance_a/a.sqlite3:/code/db.sqlite3
|
- ../deploy/dev/instance_a/a.sqlite3:/mnt/db.sqlite3
|
||||||
- ../deploy/dev/instance_a/userfiles:/code/userfiles
|
- ../deploy/dev/instance_a/userfiles:/mnt/userfiles
|
||||||
expose:
|
expose:
|
||||||
- 8000
|
- 8000
|
||||||
command: bash -c "python configure.py; python configure.py testdata; python manage.py runserver 0.0.0.0:8000 --insecure"
|
command: bash -c "python configure.py; python configure.py testdata; python manage.py runserver 0.0.0.0:8000 --insecure"
|
||||||
|
|
@ -19,12 +23,16 @@ services:
|
||||||
build:
|
build:
|
||||||
context: ../backend/
|
context: ../backend/
|
||||||
dockerfile: ../deploy/dev/Dockerfile.backend
|
dockerfile: ../deploy/dev/Dockerfile.backend
|
||||||
|
environment:
|
||||||
|
TOOLSHED_DB_PATH: /mnt/db.sqlite3
|
||||||
|
TOOLSHED_USERFILES_PATH: /mnt/userfiles
|
||||||
|
TOOLSHED_SETUP_PATH: /mnt/testdata.py
|
||||||
volumes:
|
volumes:
|
||||||
- ../backend:/code
|
- ../backend:/code
|
||||||
- ../deploy/dev/instance_b/b.env:/code/.env
|
- ../deploy/dev/instance_b/b.env:/code/.env
|
||||||
- ../deploy/dev/instance_b/testdata.py:/code/testdata.py
|
- ../deploy/dev/instance_b/testdata.py:/mnt/testdata.py
|
||||||
- ../deploy/dev/instance_b/b.sqlite3:/code/db.sqlite3
|
- ../deploy/dev/instance_b/b.sqlite3:/mnt/db.sqlite3
|
||||||
- ../deploy/dev/instance_b/userfiles:/code/userfiles
|
- ../deploy/dev/instance_b/userfiles:/mnt/userfiles
|
||||||
expose:
|
expose:
|
||||||
- 8000
|
- 8000
|
||||||
command: bash -c "python configure.py; python configure.py testdata; python manage.py runserver 0.0.0.0:8000 --insecure"
|
command: bash -c "python configure.py; python configure.py testdata; python manage.py runserver 0.0.0.0:8000 --insecure"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue