diff --git a/ansible/deploy.yaml b/ansible/deploy.yaml index 7aaea533fb6df5ae920cccc1da388ca3d7f68bbd..910b7aa223e0f6ac1c8aeef098f65372d3df3203 100644 --- a/ansible/deploy.yaml +++ b/ansible/deploy.yaml @@ -71,18 +71,18 @@ django_manage: command: "collectstatic" app_path: "/home/{{ deploy_user_name }}/iPPIDB/ippisite" - settings: "ippisite.{{ ansible_nodename }}_settings" + settings: "ippisite.{{ ansible_hostname }}_settings" - name: create mod_wsgi configuration django_manage: command: "runmodwsgi --setup-only --port=80 --user ippidb --group wheel --server-root=/etc/ippidb-80" app_path: "/home/{{ deploy_user_name }}/iPPIDB/ippisite" - settings: "ippisite.{{ ansible_nodename }}_settings" + settings: "ippisite.{{ ansible_hostname }}_settings" - name: create or update database become_user: "{{ deploy_user_name }}" django_manage: command: "migrate" app_path: "/home/{{ deploy_user_name }}/iPPIDB/ippisite" - settings: "ippisite.{{ ansible_nodename }}_settings" + settings: "ippisite.{{ ansible_hostname }}_settings" # FIXME: this should obviously be removed before switching to prod. env. - name: restrict access to the web server to specific IPs lineinfile: dest=/etc/ippidb-80/httpd.conf diff --git a/ippisite/ippisite/hub16_settings.py b/ippisite/ippisite/hub16_settings.py new file mode 100644 index 0000000000000000000000000000000000000000..0c5ded83f643efa049c10c177f58c81b3ed2456b --- /dev/null +++ b/ippisite/ippisite/hub16_settings.py @@ -0,0 +1,142 @@ +""" +Django settings for ippisite project. + +Generated by 'django-admin startproject' using Django 1.10.5. + +For more information on this file, see +https://docs.djangoproject.com/en/1.10/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/1.10/ref/settings/ +""" + +import os + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +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/1.10/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = '&qc$2x5p&!qwvu2r=)sjp*jgg8a7ss97g8lwpennmu(q9ty4o$' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = False + +SHOW_TOOLBAR_CALLBACK = True + +ALLOWED_HOSTS = ["*"] +#ALLOWED_HOSTS = ["127.0.0.1","localhost",] + +INTERNAL_IPS= ["127.0.0.1","localhost",] + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'django_extensions', + 'bootstrap3', + 'ippidb', + 'formtools', + 'debug_toolbar', + 'mod_wsgi.server' +] + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', + 'debug_toolbar.middleware.DebugToolbarMiddleware', +] + +ROOT_URLCONF = 'ippisite.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [os.path.join(BASE_DIR, 'templates')], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'ippisite.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/1.10/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'hub16_db.sqlite3'), + } +} + + +# Password validation +# https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/1.10/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/1.10/howto/static-files/ + +STATIC_URL = '/static/' + +STATIC_ROOT = os.path.join(BASE_DIR, 'static_root') + +# required to use django-extensions to draw database diagram +# to do so type +#$ ./manage.py graph_models -a > db.dot +#$ dot db.dot -T png -odb.png +GRAPH_MODELS = { + 'all_applications': True, + 'group_models': True, +}