archive
This commit is contained in:
46
silverstrike/.Dockerfile
Executable file
46
silverstrike/.Dockerfile
Executable file
@@ -0,0 +1,46 @@
|
||||
FROM ubuntu:18.04 as builder
|
||||
|
||||
### SYS
|
||||
RUN export DEBIAN_FRONTEND=noninteractive; \
|
||||
apt -y update || true; \
|
||||
apt -y install tzdata; \
|
||||
ln -fs /usr/share/zoneinfo/America/Denver /etc/localtime; \
|
||||
dpkg-reconfigure --frontend noninteractive tzdata; \
|
||||
apt -y install \
|
||||
curl \
|
||||
rsync \
|
||||
cron \
|
||||
postgresql postgresql-contrib \
|
||||
&& mkdir -p /mnt/save
|
||||
|
||||
### APP
|
||||
RUN \
|
||||
apt install nginx postgresql uwsgi uwsgi-plugin-python3 python3-venv git
|
||||
|
||||
### POSTGRES
|
||||
RUN useradd -d /home/postgres -ms /bin/bash -g postgres -G sudo postgres
|
||||
USER postgres
|
||||
RUN service postgresql start && sleep 10 \
|
||||
&& psql --command "CREATE USER ss WITH SUPERUSER PASSWORD 'ss';" \
|
||||
&& createdb -O ss ss \
|
||||
&& psql --command "CREATE DATABASE silverstrikedb;" \
|
||||
&& psql --command "GRANT ALL PRIVILEGES ON DATABASE silverstrikedb TO ss;"
|
||||
USER root
|
||||
|
||||
### CRON BACKUPS
|
||||
RUN true \
|
||||
&& echo 'b=$(date +%Y%m%d%H%M%S) && mkdir -p /mnt/save/$b && pg_dump $DATABASE_URL --clean > /mnt/save/$b/pg.dump' > /backup.sh \
|
||||
&& echo 'b=$(find /mnt/save -type f | sort | tail -n 1); if [ -n "$b" ]; then echo restoring $b; psql $DATABASE_URL < "$b"; fi && service postgresql start;' > /restore.sh \
|
||||
&& echo '0 4,8,12,16,20 * * * bash /backup.sh >> /var/log/cronj.log 2>&1' > /etc/cron.d/backups \
|
||||
&& echo '' >> /etc/cron.d/backups \
|
||||
&& chmod 0644 /etc/cron.d/backups \
|
||||
&& touch /var/log/cronj.log
|
||||
|
||||
### FINAL
|
||||
ENV DATABASE_URL=postgres://ss:ss@localhost/silverstrikedb?sslmode=disable
|
||||
ENV SECRET_KEY=AimmBfzjdWcVN3rQs8YawbUowv5R8Eex
|
||||
ENV ALLOWED_HOSTS=*
|
||||
ENTRYPOINT \
|
||||
until psql $DATABASE_URL < /dev/null; do sleep 5; done \
|
||||
&& bash /restore.sh \
|
||||
&& sleep 5 && python manage.py migrate && exec uwsgi
|
||||
2
silverstrike/fork/.dockerignore
Executable file
2
silverstrike/fork/.dockerignore
Executable file
@@ -0,0 +1,2 @@
|
||||
Dockerfile
|
||||
**/*.sw*
|
||||
42
silverstrike/fork/Dockerfile
Executable file
42
silverstrike/fork/Dockerfile
Executable file
@@ -0,0 +1,42 @@
|
||||
FROM ubuntu:18.04
|
||||
|
||||
# Copy the code
|
||||
ADD . /code
|
||||
WORKDIR /code
|
||||
|
||||
# install deps
|
||||
RUN apt-get update && apt-get install -y gcc libmariadbclient-dev python3-dev python3-pip && \
|
||||
pip3 install --no-cache-dir -r requirements.txt && \
|
||||
apt-get remove -y gcc && apt-get autoremove -y
|
||||
|
||||
# configure django
|
||||
ENV DJANGO_SETTINGS_MODULE=settings
|
||||
|
||||
# configure uwsgi
|
||||
ENV UWSGI_WSGI_FILE=wsgi.py UWSGI_HTTP=:8000 UWSGI_MASTER=1 UWSGI_WORKERS=2 UWSGI_THREADS=8 UWSGI_UID=1000 UWSGI_GID=2000 UWSGI_LAZY_APPS=1 UWSGI_WSGI_ENV_BEHAVIOR=holy
|
||||
|
||||
# collect static files
|
||||
RUN python3 manage.py collectstatic
|
||||
|
||||
#### POSTGRES
|
||||
RUN \
|
||||
apt -y install \
|
||||
curl \
|
||||
rsync \
|
||||
cron \
|
||||
postgresql postgresql-contrib \
|
||||
sudo \
|
||||
&& mkdir -p /mnt/save \
|
||||
&& service postgresql start
|
||||
USER postgres
|
||||
RUN service postgresql start \
|
||||
&& psql --command "CREATE USER ss WITH SUPERUSER PASSWORD 'ss';" \
|
||||
&& psql --command "CREATE DATABASE silverstrikedb;" \
|
||||
&& psql --command "GRANT ALL PRIVILEGES ON DATABASE silverstrikedb TO ss;"
|
||||
USER root
|
||||
|
||||
ENV ALLOWED_HOSTS=*
|
||||
ENV DATABASE_URL=postgres://ss:ss@localhost/silverstrikedb
|
||||
ENV SECRET_KEY=AimmBfzjdWcVN3rQs8YawbUowv5R8Eex
|
||||
|
||||
CMD service postgresql start && (until psql $DATABASE_URL < /dev/null; do sleep 5; done) && python3 manage.py migrate && uwsgi
|
||||
21
silverstrike/fork/LICENSE
Executable file
21
silverstrike/fork/LICENSE
Executable file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017 - 2018 Simon Hanna
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
21
silverstrike/fork/docker-compose.yml
Executable file
21
silverstrike/fork/docker-compose.yml
Executable file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
version: "3.2"
|
||||
services:
|
||||
app:
|
||||
environment:
|
||||
- ALLOWED_HOSTS='*'
|
||||
- DATABASE_URL=postgres://silverstrike:secretpass@database/silverstrikedb
|
||||
- SECRET_KEY=PLprXpLzxemgLD57GPQQ84SBZdLVKFYg
|
||||
image: simhnna/silverstrike
|
||||
links:
|
||||
- database:database
|
||||
ports:
|
||||
- 8000:8000
|
||||
database:
|
||||
environment:
|
||||
POSTGRES_DB: silverstrikedb
|
||||
POSTGRES_USER: silverstrike
|
||||
POSTGRES_PASSWORD: secretpass
|
||||
image: postgres:10.3
|
||||
volumes:
|
||||
- ./silverstrikedb:/var/lib/postgresql/data
|
||||
22
silverstrike/fork/manage.py
Executable file
22
silverstrike/fork/manage.py
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python
|
||||
import os
|
||||
import sys
|
||||
|
||||
if __name__ == "__main__":
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
|
||||
try:
|
||||
from django.core.management import execute_from_command_line
|
||||
except ImportError:
|
||||
# The above import may fail for some other reason. Ensure that the
|
||||
# issue is really that Django is missing to avoid masking other
|
||||
# exceptions on Python 2.
|
||||
try:
|
||||
import django
|
||||
except ImportError:
|
||||
raise ImportError(
|
||||
"Couldn't import Django. Are you sure it's installed and "
|
||||
"available on your PYTHONPATH environment variable? Did you "
|
||||
"forget to activate a virtual environment?"
|
||||
)
|
||||
raise
|
||||
execute_from_command_line(sys.argv)
|
||||
BIN
silverstrike/fork/master.zip
Executable file
BIN
silverstrike/fork/master.zip
Executable file
Binary file not shown.
6
silverstrike/fork/requirements.txt
Executable file
6
silverstrike/fork/requirements.txt
Executable file
@@ -0,0 +1,6 @@
|
||||
silverstrike
|
||||
whitenoise
|
||||
uwsgi
|
||||
psycopg2-binary
|
||||
dj-database-url
|
||||
mysqlclient
|
||||
163
silverstrike/fork/settings.py
Executable file
163
silverstrike/fork/settings.py
Executable file
@@ -0,0 +1,163 @@
|
||||
"""
|
||||
Django settings for demo project.
|
||||
|
||||
Generated by 'django-admin startproject' using Django 1.10.3.
|
||||
|
||||
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
|
||||
|
||||
import dj_database_url
|
||||
|
||||
|
||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||
BASE_DIR = 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 = os.environ.get('SECRET_KEY', 'PLprXpLzxemgLD57GPQQ84SBZdLVKFYg')
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = False
|
||||
|
||||
ALLOWED_HOSTS = ['*']
|
||||
|
||||
SITE_ID = 1
|
||||
|
||||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.humanize',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'django.contrib.sites',
|
||||
'widget_tweaks',
|
||||
'silverstrike',
|
||||
'allauth',
|
||||
'allauth.account',
|
||||
'rest_framework',
|
||||
'rest_framework.authtoken'
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'whitenoise.middleware.WhiteNoiseMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.locale.LocaleMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'urls'
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [],
|
||||
'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 = 'wsgi.application'
|
||||
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases
|
||||
|
||||
DATABASES = {
|
||||
'default': dj_database_url.config(conn_max_age=600)
|
||||
}
|
||||
|
||||
|
||||
|
||||
# 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',
|
||||
},
|
||||
]
|
||||
|
||||
AUTHENTICATION_BACKENDS = (
|
||||
'django.contrib.auth.backends.ModelBackend',
|
||||
'allauth.account.auth_backends.AuthenticationBackend',
|
||||
)
|
||||
|
||||
|
||||
# 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/'
|
||||
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
|
||||
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
|
||||
|
||||
|
||||
LOGIN_REDIRECT_URL = 'index'
|
||||
LOGIN_URL = 'account_login'
|
||||
LOGOUT_URL = 'account_logout'
|
||||
ACCOUNT_LOGOUT_REDIRECT_URL = 'account_login'
|
||||
ACCOUNT_ADAPTER = 'signupadapter.SignupDisabledAdapter'
|
||||
|
||||
# Uncomment to prevent signup
|
||||
# ACCOUNT_ADAPTER = 'silverstrike.models.SignupDisabledAdapter'
|
||||
|
||||
REST_FRAMEWORK = {
|
||||
'DEFAULT_PERMISSION_CLASSES': [
|
||||
'rest_framework.permissions.IsAuthenticated'
|
||||
],
|
||||
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
|
||||
'PAGE_SIZE': 10,
|
||||
'DEFAULT_AUTHENTICATION_CLASSES': (
|
||||
'rest_framework.authentication.BasicAuthentication',
|
||||
'rest_framework.authentication.SessionAuthentication',
|
||||
'rest_framework.authentication.TokenAuthentication'
|
||||
)
|
||||
}
|
||||
|
||||
6
silverstrike/fork/signupadapter.py
Executable file
6
silverstrike/fork/signupadapter.py
Executable file
@@ -0,0 +1,6 @@
|
||||
from allauth.account.adapter import DefaultAccountAdapter
|
||||
|
||||
|
||||
class SignupDisabledAdapter(DefaultAccountAdapter):
|
||||
def is_open_for_signup(self, request):
|
||||
return False
|
||||
9
silverstrike/fork/urls.py
Executable file
9
silverstrike/fork/urls.py
Executable file
@@ -0,0 +1,9 @@
|
||||
from django.contrib import admin
|
||||
from django.urls import path, include
|
||||
from django.views.generic import RedirectView
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
path('', include('silverstrike.urls')),
|
||||
]
|
||||
16
silverstrike/fork/wsgi.py
Executable file
16
silverstrike/fork/wsgi.py
Executable file
@@ -0,0 +1,16 @@
|
||||
"""
|
||||
WSGI config for demo project.
|
||||
|
||||
It exposes the WSGI callable as a module-level variable named ``application``.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
|
||||
|
||||
application = get_wsgi_application()
|
||||
66
silverstrike/scratch/Dockerfile
Executable file
66
silverstrike/scratch/Dockerfile
Executable file
@@ -0,0 +1,66 @@
|
||||
FROM ubuntu:18.04 as builder
|
||||
|
||||
### SYS
|
||||
RUN export DEBIAN_FRONTEND=noninteractive; \
|
||||
apt -y update || true; \
|
||||
apt -y install tzdata; \
|
||||
ln -fs /usr/share/zoneinfo/America/Denver /etc/localtime; \
|
||||
dpkg-reconfigure --frontend noninteractive tzdata; \
|
||||
apt -y install \
|
||||
curl \
|
||||
rsync \
|
||||
cron \
|
||||
postgresql postgresql-contrib \
|
||||
&& mkdir -p /mnt/save
|
||||
|
||||
### POSTGRES
|
||||
RUN apt -y install sudo \
|
||||
&& service postgresql start
|
||||
USER postgres
|
||||
RUN service postgresql start \
|
||||
&& createuser www-data \
|
||||
&& createdb -O www-data silverstrikedb
|
||||
|
||||
#&& psql --command "CREATE USER ss WITH SUPERUSER PASSWORD 'ss';" \
|
||||
#&& psql --command "CREATE DATABASE silverstrikedb;" \
|
||||
#&& psql --command "GRANT ALL PRIVILEGES ON DATABASE silverstrikedb TO ss;"
|
||||
|
||||
USER root
|
||||
|
||||
### APP
|
||||
RUN \
|
||||
apt -y install nginx postgresql uwsgi uwsgi-plugin-python git python-pip python python-psycopg2 libpq-dev python-dev \
|
||||
&& pip install venv \
|
||||
&& mkdir -p /srv/webapps \
|
||||
&& cd /srv/webapps \
|
||||
&& git clone https://github.com/agstrike/production-project silverstrike \
|
||||
&& cd silverstrike \
|
||||
&& python -m venv env \
|
||||
&& . env/bin/activate \
|
||||
&& pip3 install silverstrike psycopg2 django
|
||||
COPY settings.py /srv/webapps/silverstrike/
|
||||
RUN \
|
||||
cd /srv/webapps/silverstrike \
|
||||
&& service postgresql start \
|
||||
&& python manage.py migrate \
|
||||
&& python manage.py collectstatic \
|
||||
&& ln -s /srv/webapps/silverstrike/uwsgi.ini /etc/uwsgi/apps-enabled/silverstrike.ini \
|
||||
&& service uwsgi start
|
||||
|
||||
### CRON BACKUPS
|
||||
RUN true \
|
||||
&& echo 'b=$(date +%Y%m%d%H%M%S) && mkdir -p /mnt/save/$b && pg_dump $DATABASE_URL --clean > /mnt/save/$b/pg.dump' > /backup.sh \
|
||||
&& echo 'b=$(find /mnt/save -type f | sort | tail -n 1); if [ -n "$b" ]; then echo restoring $b; psql $DATABASE_URL < "$b"; fi && service postgresql start;' > /restore.sh \
|
||||
&& echo '0 4,8,12,16,20 * * * bash /backup.sh >> /var/log/cronj.log 2>&1' > /etc/cron.d/backups \
|
||||
&& echo '' >> /etc/cron.d/backups \
|
||||
&& chmod 0644 /etc/cron.d/backups \
|
||||
&& touch /var/log/cronj.log
|
||||
|
||||
### FINAL
|
||||
ENV DATABASE_URL=postgres://www-data:password@localhost/silverstrikedb?sslmode=disable
|
||||
ENV SECRET_KEY=AimmBfzjdWcVN3rQs8YawbUowv5R8Eex
|
||||
ENV ALLOWED_HOSTS=*
|
||||
ENTRYPOINT \
|
||||
until psql $DATABASE_URL < /dev/null; do sleep 5; done \
|
||||
&& bash /restore.sh \
|
||||
&& sleep 5 && python manage.py migrate && exec uwsgi
|
||||
178
silverstrike/scratch/settings.py
Executable file
178
silverstrike/scratch/settings.py
Executable file
@@ -0,0 +1,178 @@
|
||||
"""
|
||||
Django settings for SilverStrike.
|
||||
|
||||
Generated by 'django-admin startproject' using Django 1.10.3.
|
||||
|
||||
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.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 = 'AimmBfzjdWcVN3rQs8YawbUowv5R8Eex'
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
|
||||
ALLOWED_HOSTS = [
|
||||
"192.168.0.86",
|
||||
"firefly2.scratch.com",
|
||||
"silverstrike.scratch.com",
|
||||
]
|
||||
|
||||
SITE_ID = 1
|
||||
|
||||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.humanize',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'django.contrib.sites',
|
||||
'widget_tweaks',
|
||||
'silverstrike',
|
||||
'allauth',
|
||||
'allauth.account',
|
||||
'allauth.socialaccount',
|
||||
'rest_framework',
|
||||
'rest_framework.authtoken',
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.locale.LocaleMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'urls'
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [],
|
||||
'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 = '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, 'db.sqlite3'),
|
||||
}
|
||||
#'default': {
|
||||
# 'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||
# 'NAME': 'silverstrikedb',
|
||||
# 'USER': 'www-data',
|
||||
# 'PASSWORD': 'password',
|
||||
#}
|
||||
#'default': {
|
||||
# 'ENGINE': 'django.db.backends.mysql',
|
||||
# 'NAME': 'silverstrikedb',
|
||||
# 'USER': 'silverstrike',
|
||||
# 'PASSWORD': 'password',
|
||||
#}
|
||||
}
|
||||
|
||||
|
||||
# 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',
|
||||
},
|
||||
]
|
||||
|
||||
AUTHENTICATION_BACKENDS = (
|
||||
'django.contrib.auth.backends.ModelBackend',
|
||||
'allauth.account.auth_backends.AuthenticationBackend',
|
||||
)
|
||||
|
||||
|
||||
# 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, 'public', 'static')
|
||||
|
||||
|
||||
LOGIN_REDIRECT_URL = 'index'
|
||||
LOGIN_URL = 'account_login'
|
||||
LOGOUT_URL = 'account_logout'
|
||||
ACCOUNT_LOGOUT_REDIRECT_URL = 'account_login'
|
||||
|
||||
ACCOUNT_ADAPTER = 'signupadapter.SignupDisabledAdapter'
|
||||
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
'filters': {
|
||||
'require_debug_true': {
|
||||
'()': 'django.utils.log.RequireDebugTrue',
|
||||
}
|
||||
},
|
||||
'handlers': {
|
||||
'console': {
|
||||
'level': 'DEBUG',
|
||||
'filters': ['require_debug_true'],
|
||||
'class': 'logging.StreamHandler',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1
silverstrike/scratch/try
Executable file
1
silverstrike/scratch/try
Executable file
@@ -0,0 +1 @@
|
||||
docker build -t bel/silverstrike:v0.0 -f Dockerfile . && docker run --rm -it --name ss -p 51131:8000 --entrypoint bash bel/silverstrike:v0.0
|
||||
Reference in New Issue
Block a user