split the requirements and settings
This commit is contained in:
parent
1db8b821ca
commit
99747257b0
|
@ -3,5 +3,4 @@ ENV PYTHONUNBUFFERED 1
|
|||
ADD . /code
|
||||
WORKDIR /code
|
||||
RUN pip install wheel
|
||||
RUN pip install -r requirements.txt
|
||||
WORKDIR /code/network_inventory
|
||||
RUN pip install -r requirements/docker.txt
|
||||
|
|
|
@ -13,12 +13,12 @@ services:
|
|||
|
||||
web:
|
||||
build: .
|
||||
command: python manage.py runserver 0.0.0.0:8000
|
||||
command: ./run.sh network_inventory.settings.docker
|
||||
volumes:
|
||||
- .:/code
|
||||
ports:
|
||||
- "8000:8000"
|
||||
environment:
|
||||
- DJANGO_SETTINGS_MODULE=network_inventory.settings
|
||||
- DJANGO_SETTINGS_MODULE=network_inventory.settings.local
|
||||
depends_on:
|
||||
- db
|
||||
|
|
|
@ -19,18 +19,6 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = 'kzx(i9^@*g^cgp(_3052%*1d%zyu^2z_@pgso5!_q@jb-j%4m='
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
|
||||
ALLOWED_HOSTS = [
|
||||
'localhost',
|
||||
'127.0.0.1',
|
||||
]
|
||||
|
||||
|
||||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
|
@ -75,16 +63,6 @@ TEMPLATES = [
|
|||
WSGI_APPLICATION = 'network_inventory.wsgi.application'
|
||||
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql',
|
||||
'NAME': 'postgres',
|
||||
'USER': 'postgres',
|
||||
'HOST': 'db', # set in docker-compose.yml
|
||||
'PORT': 5432 # default postgres port
|
||||
}
|
||||
}
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
from .base import *
|
||||
|
||||
ALLOWED_HOSTS = [
|
||||
'localhost',
|
||||
'127.0.0.1',
|
||||
]
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = 'development_key'
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql',
|
||||
'NAME': 'postgres',
|
||||
'USER': 'postgres',
|
||||
'HOST': 'db',
|
||||
'PORT': 5432,
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
from .base import *
|
||||
|
||||
ALLOWED_HOSTS = [
|
||||
'localhost',
|
||||
'127.0.0.1',
|
||||
]
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = 'development_key'
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
from .base import *
|
||||
|
||||
ALLOWED_HOSTS = [
|
||||
'inventory.2li.local',
|
||||
]
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = 'kzx(i9^@*g^cgp(_3052%*1d%zyu^2z_@pgso5!_q@jb-j%4m='
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = False
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql',
|
||||
'NAME': 'postgres',
|
||||
'USER': 'postgres',
|
||||
'HOST': 'db',
|
||||
'PORT': 5432,
|
||||
}
|
||||
}
|
||||
|
|
@ -2,7 +2,4 @@ wheel
|
|||
Django==2.2
|
||||
pyaml
|
||||
pytz
|
||||
psycopg2
|
||||
django-guardian
|
||||
pytest
|
||||
pytest-django
|
|
@ -0,0 +1,5 @@
|
|||
-r base.txt
|
||||
|
||||
pytest
|
||||
pytest-django
|
||||
psycopg2
|
|
@ -0,0 +1,6 @@
|
|||
-r base.txt
|
||||
|
||||
pytest
|
||||
pytest-django
|
||||
pytest-cov
|
||||
pep8
|
|
@ -0,0 +1,3 @@
|
|||
-r base.txt
|
||||
|
||||
psycopg2
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
cd network_inventory
|
||||
python manage.py migrate --settings=$1
|
||||
python manage.py loaddata inventory --settings=$1
|
||||
python manage.py shell -c "from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.create_superuser('admin', 'admin@example.com', 'password')" --settings=$1
|
||||
python manage.py runserver 0.0.0.0:8000 --settings=$1
|
3
setup.sh
3
setup.sh
|
@ -1,3 +0,0 @@
|
|||
docker-compose run web python manage.py migrate
|
||||
docker-compose run web python manage.py loaddata inventory
|
||||
docker-compose run web ./manage.py shell -c "from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.create_superuser('admin', 'admin@example.com', 'password')"
|
Loading…
Reference in New Issue