This commit is contained in:
Michael Kelly 2015-12-22 14:00:41 -08:00
Коммит 432e55aae4
7 изменённых файлов: 138 добавлений и 0 удалений

5
.gitignore поставляемый Normal file
Просмотреть файл

@ -0,0 +1,5 @@
.env
db.sqlite3
.DS_Store
/static/
/media/

11
manage.py Executable file
Просмотреть файл

@ -0,0 +1,11 @@
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "normandy.settings")
os.environ.setdefault('DJANGO_CONFIGURATION', 'Development')
from configurations.management import execute_from_command_line
execute_from_command_line(sys.argv)

0
normandy/__init__.py Normal file
Просмотреть файл

98
normandy/settings.py Normal file
Просмотреть файл

@ -0,0 +1,98 @@
import os
from configurations import Configuration, values
class Core(Configuration):
"""Settings that will never change per-environment."""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# 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 = 'normandy.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 = 'normandy.wsgi.application'
# Internationalization
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = False
USE_L10N = False
USE_TZ = True
# Static files (CSS, JavaScript, Images)
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
class Base(Core):
"""Settings that may change per-environment, some with defaults."""
SECRET_KEY = values.SecretValue()
DEBUG = values.BooleanValue(False)
ALLOWED_HOSTS = values.ListValue([])
DATABASES = values.DatabaseURLValue('sqlite:///db.sqlite3')
# Password validation
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',
},
]
class Development(Base):
"""Settings for local development."""
DOTENV = '.env'
SECRET_KEY = values.Value('not a secret')
DEBUG = values.BooleanValue(True)
AUTH_PASSWORD_VALIDATORS = values.ListValue([])
class Production(Base):
"""Settings for the production environment."""
STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'

7
normandy/urls.py Normal file
Просмотреть файл

@ -0,0 +1,7 @@
from django.conf.urls import url
from django.contrib import admin
urlpatterns = [
url(r'^admin/', admin.site.urls),
]

11
normandy/wsgi.py Normal file
Просмотреть файл

@ -0,0 +1,11 @@
import os
from configurations.wsgi import get_wsgi_application
from whitenoise.django import DjangoWhiteNoise
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "normandy.settings")
os.environ.setdefault('DJANGO_CONFIGURATION', 'Production')
application = DjangoWhiteNoise(get_wsgi_application())

6
requirements.txt Normal file
Просмотреть файл

@ -0,0 +1,6 @@
dj-database-url==0.3.0
Django==1.9
https://github.com/jazzband/django-configurations/archive/afb057f33bc27311b448832fb9eede8935faec87.zip#egg=django-configurations==0.9dev
wheel==0.24.0
whitenoise==2.0.6
psycopg2==2.6.1