diff --git a/share/templates/conf/django/files/settings.1.9.jinja2 b/share/templates/conf/django/files/settings.1.9.jinja2 new file mode 100644 index 0000000..be1fd74 --- /dev/null +++ b/share/templates/conf/django/files/settings.1.9.jinja2 @@ -0,0 +1,138 @@ +""" +Django settings for {{ project_name }} project. + +Generated by 'django-admin startproject' using Django 1.9.4. + +For more information on this file, see +https://docs.djangoproject.com/en/1.9/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/1.9/ref/settings/ +""" + +import os +import sys + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +# BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +PROJECT_ROOT = os.path.abspath(os.path.join(BASE_DIR, os.pardir)) + +# +# add the directory that has the intialize.py module which contains the +# get_config function definition which will pull out all the configuraiton +# infomration for the settings file + +sys.path.insert(0, os.path.join( + PROJECT_ROOT, 'usr', 'bin', 'fabric', 'modules')) + +# +# add an "apps" directory to this project, which is where all the apps +# ought to be in the first place. + +sys.path.insert(0, os.path.join(BASE_DIR, 'apps')) + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = '{{ secret_key }}' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', +] + +MIDDLEWARE_CLASSES = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = '{{ project_name }}.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [os.path.join(PROJECT_ROOT, '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 = '{{ project_name }}.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/1.9/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + } +} + + +# Password validation +# https://docs.djangoproject.com/en/1.9/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.9/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.9/howto/static-files/ + +STATIC_URL = '/static/' diff --git a/share/templates/conf/django/files/settings.2.1.jinja2 b/share/templates/conf/django/files/settings.2.1.jinja2 new file mode 100644 index 0000000..a771b3c --- /dev/null +++ b/share/templates/conf/django/files/settings.2.1.jinja2 @@ -0,0 +1,140 @@ +""" +Django settings for {{ project_name }} project. + +Generated by 'django-admin startproject' using Django 2.1.2. + +For more information on this file, see +https://docs.djangoproject.com/en/2.1/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/2.1/ref/settings/ +""" + +import os +import sys + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +PROJECT_ROOT = os.path.abspath(os.path.join(BASE_DIR, os.pardir)) + +# +# add the directory that has the intialize.py module which contains the +# get_config function definition which will pull out all the configuraiton +# infomration for the settings file + +sys.path.insert(0, os.path.join( + PROJECT_ROOT, 'usr', 'bin', 'fabric')) + +# +# add an "apps" directory to this project, which is where all the apps +# ought to be in the first place. + +sys.path.insert(0, os.path.join(BASE_DIR, 'apps')) + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = '{{ secret_key }}' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', +] + +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', +] + +ROOT_URLCONF = '{{ project_name }}.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [os.path.join(PROJECT_ROOT, '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 = '{{ project_name }}.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/2.1/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + } +} + + +# Password validation +# https://docs.djangoproject.com/en/2.1/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/2.1/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/2.1/howto/static-files/ + +STATIC_URL = '/static/' +MEDIA_URL = '/media/' diff --git a/share/templates/conf/django/files/settings.jinja2 b/share/templates/conf/django/files/settings.jinja2 index a771b3c..869cec5 100644 --- a/share/templates/conf/django/files/settings.jinja2 +++ b/share/templates/conf/django/files/settings.jinja2 @@ -1,13 +1,13 @@ """ Django settings for {{ project_name }} project. -Generated by 'django-admin startproject' using Django 2.1.2. +Generated by 'django-admin startproject' using Django 4.2.1. For more information on this file, see -https://docs.djangoproject.com/en/2.1/topics/settings/ +https://docs.djangoproject.com/en/4.2/topics/settings/ For the full list of settings and their values, see -https://docs.djangoproject.com/en/2.1/ref/settings/ +https://docs.djangoproject.com/en/4.2/ref/settings/ """ import os @@ -32,7 +32,7 @@ sys.path.insert(0, os.path.join( sys.path.insert(0, os.path.join(BASE_DIR, 'apps')) # Quick-start development settings - unsuitable for production -# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/ +# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '{{ secret_key }}' @@ -86,7 +86,7 @@ WSGI_APPLICATION = '{{ project_name }}.wsgi.application' # Database -# https://docs.djangoproject.com/en/2.1/ref/settings/#databases +# https://docs.djangoproject.com/en/4.2/ref/settings/#databases DATABASES = { 'default': { @@ -97,7 +97,7 @@ DATABASES = { # Password validation -# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators +# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { @@ -120,7 +120,7 @@ AUTH_PASSWORD_VALIDATORS = [ # Internationalization -# https://docs.djangoproject.com/en/2.1/topics/i18n/ +# https://docs.djangoproject.com/en/4.2/topics/i18n/ LANGUAGE_CODE = 'en-us' @@ -134,7 +134,12 @@ USE_TZ = True # Static files (CSS, JavaScript, Images) -# https://docs.djangoproject.com/en/2.1/howto/static-files/ +# https://docs.djangoproject.com/en/4.2/howto/static-files/ STATIC_URL = '/static/' MEDIA_URL = '/media/' + +# Default primary key field type +# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field + +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' diff --git a/share/templates/conf/django/files/settings18.jinja2 b/share/templates/conf/django/files/settings18.jinja2 new file mode 100644 index 0000000..75c5cdb --- /dev/null +++ b/share/templates/conf/django/files/settings18.jinja2 @@ -0,0 +1,125 @@ +""" +Django settings for {{ project_name }} project. + +Generated by 'django-admin startproject' using Django 1.8.3. + +For more information on this file, see +https://docs.djangoproject.com/en/1.8/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/1.8/ref/settings/ +""" + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +import os +import sys + +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +PROJECT_ROOT = os.path.abspath(os.path.join(BASE_DIR, os.pardir)) + +# +# add the directory that has the intialize.py module which contains the +# get_config function definition which will pull out all the configuraiton +# infomration for the settings file + +sys.path.insert(0, os.path.join( + PROJECT_ROOT, 'scripts', 'tools', 'fabric', 'modules')) + +# +# add an "apps" directory to this project, which is where all the apps +# ought to be in the first place. + +sys.path.insert(0, os.path.join(BASE_DIR, 'apps')) + +# +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/ + +# +# SECURITY WARNING: keep the secret key used in production secret! + +SECRET_KEY = '{{ secret_key }}' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = ( + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.sites', + 'django.contrib.staticfiles', + + 'polls', +) + + +MIDDLEWARE_CLASSES = ( + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', + 'django.middleware.security.SecurityMiddleware', +) + +ROOT_URLCONF = '{{ project_name }}.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [os.path.join(PROJECT_ROOT, '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 = '{{ project_name }}.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/1.8/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + } +} + + +# Internationalization +# https://docs.djangoproject.com/en/1.8/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.8/howto/static-files/ + +STATIC_URL = '/static/' +MEDIA_URL = '/media/' + diff --git a/share/templates/conf/gunicorn/files/settings.2.1.jinja2 b/share/templates/conf/gunicorn/files/settings.2.1.jinja2 new file mode 100644 index 0000000..a771b3c --- /dev/null +++ b/share/templates/conf/gunicorn/files/settings.2.1.jinja2 @@ -0,0 +1,140 @@ +""" +Django settings for {{ project_name }} project. + +Generated by 'django-admin startproject' using Django 2.1.2. + +For more information on this file, see +https://docs.djangoproject.com/en/2.1/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/2.1/ref/settings/ +""" + +import os +import sys + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +PROJECT_ROOT = os.path.abspath(os.path.join(BASE_DIR, os.pardir)) + +# +# add the directory that has the intialize.py module which contains the +# get_config function definition which will pull out all the configuraiton +# infomration for the settings file + +sys.path.insert(0, os.path.join( + PROJECT_ROOT, 'usr', 'bin', 'fabric')) + +# +# add an "apps" directory to this project, which is where all the apps +# ought to be in the first place. + +sys.path.insert(0, os.path.join(BASE_DIR, 'apps')) + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = '{{ secret_key }}' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', +] + +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', +] + +ROOT_URLCONF = '{{ project_name }}.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [os.path.join(PROJECT_ROOT, '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 = '{{ project_name }}.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/2.1/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + } +} + + +# Password validation +# https://docs.djangoproject.com/en/2.1/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/2.1/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/2.1/howto/static-files/ + +STATIC_URL = '/static/' +MEDIA_URL = '/media/' diff --git a/share/templates/conf/gunicorn/files/settings.jinja2 b/share/templates/conf/gunicorn/files/settings.jinja2 index a771b3c..869cec5 100644 --- a/share/templates/conf/gunicorn/files/settings.jinja2 +++ b/share/templates/conf/gunicorn/files/settings.jinja2 @@ -1,13 +1,13 @@ """ Django settings for {{ project_name }} project. -Generated by 'django-admin startproject' using Django 2.1.2. +Generated by 'django-admin startproject' using Django 4.2.1. For more information on this file, see -https://docs.djangoproject.com/en/2.1/topics/settings/ +https://docs.djangoproject.com/en/4.2/topics/settings/ For the full list of settings and their values, see -https://docs.djangoproject.com/en/2.1/ref/settings/ +https://docs.djangoproject.com/en/4.2/ref/settings/ """ import os @@ -32,7 +32,7 @@ sys.path.insert(0, os.path.join( sys.path.insert(0, os.path.join(BASE_DIR, 'apps')) # Quick-start development settings - unsuitable for production -# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/ +# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '{{ secret_key }}' @@ -86,7 +86,7 @@ WSGI_APPLICATION = '{{ project_name }}.wsgi.application' # Database -# https://docs.djangoproject.com/en/2.1/ref/settings/#databases +# https://docs.djangoproject.com/en/4.2/ref/settings/#databases DATABASES = { 'default': { @@ -97,7 +97,7 @@ DATABASES = { # Password validation -# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators +# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { @@ -120,7 +120,7 @@ AUTH_PASSWORD_VALIDATORS = [ # Internationalization -# https://docs.djangoproject.com/en/2.1/topics/i18n/ +# https://docs.djangoproject.com/en/4.2/topics/i18n/ LANGUAGE_CODE = 'en-us' @@ -134,7 +134,12 @@ USE_TZ = True # Static files (CSS, JavaScript, Images) -# https://docs.djangoproject.com/en/2.1/howto/static-files/ +# https://docs.djangoproject.com/en/4.2/howto/static-files/ STATIC_URL = '/static/' MEDIA_URL = '/media/' + +# Default primary key field type +# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field + +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' diff --git a/share/templates/conf/nginx/files/ssl_socket.jinja2 b/share/templates/conf/nginx/files/ssl_socket.jinja2 new file mode 100644 index 0000000..3195c7b --- /dev/null +++ b/share/templates/conf/nginx/files/ssl_socket.jinja2 @@ -0,0 +1,76 @@ + +upstream app_server_{{ extended_name }} { + # fail_timeout=0 means we always retry an upstream even if it failed + # to return a good HTTP response + + # for UNIX domain socket setups + server unix:/tmp/gunicorn.{{ extended_name }}.sock fail_timeout=0; + + # for a TCP configuration + # server 192.168.0.7:8000 fail_timeout=0; + # server {{django_host}}:{{django_port}} fail_timeout=0; +} + +server { + server_name .{{server_name}} + + charset utf-8; + + client_max_body_size 4G; + + access_log {{access_log}}; + error_log {{error_log}}; + + location /media { + alias {{ server_media_dynamic }}; + } + + location /static/debug_toolbar { + alias {{virtualenv_sitepackages}}/debug_toolbar/static/debug_toolbar; + } + + location /static { + alias {{ server_media_static}}; + } + + location / { + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto https; + proxy_set_header Host $http_host; + proxy_redirect off; + + if (!-f $request_filename) { + proxy_pass http://app_server_{{extended_name}}; + break; + } + + } + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root html; + } + + listen 443 ssl; # managed by Certbot + ssl_certificate /etc/letsencrypt/live/{{server_name}}/fullchain.pem; # managed by Certbot + ssl_certificate_key /etc/letsencrypt/live/{{server_name}}/privkey.pem; # managed by Certbot + include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot + ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot + +} + + +server { + if ($host = {{server_name}}) { + return 301 https://$host$request_uri; + } # managed by Certbot + + + listen {{port}}; + server_name .{{server_name}} + + charset utf-8; + return 404; # managed by Certbot + + +}