Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework settings, add apps.py, preping for django 1.10 upgrade
- Loading branch information
Showing
9 changed files
with
170 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ | |
|
||
# Project | ||
/*.db | ||
/*.sqlite3 | ||
|
||
# Misc | ||
/.idea/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from __future__ import unicode_literals | ||
|
||
from django.apps import AppConfig | ||
|
||
|
||
class CoreConfig(AppConfig): | ||
name = 'core' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
import os | ||
|
||
from django.contrib.messages import constants as messages | ||
|
||
|
||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | ||
|
||
# SECURITY WARNING: keep the secret key used in production secret! | ||
SECRET_KEY = 'REPLACE-ME' | ||
|
||
# SECURITY WARNING: don't run with debug turned on in production! | ||
DEBUG = True | ||
|
||
# SECURITY WARNING: use your actual domain name in production! | ||
ALLOWED_HOSTS = ['*'] | ||
|
||
# Application definition | ||
|
||
INSTALLED_APPS = [ | ||
'django.contrib.admin', | ||
'django.contrib.auth', | ||
'django.contrib.contenttypes', | ||
'django.contrib.sessions', | ||
'django.contrib.messages', | ||
'django.contrib.staticfiles', | ||
'taggit', | ||
'compressor', | ||
'django_images', | ||
'pinry.core', | ||
'pinry.users', | ||
] | ||
|
||
ROOT_URLCONF = 'pinry.urls' | ||
|
||
MIDDLEWARE_CLASSES = [ | ||
'django.middleware.security.SecurityMiddleware', | ||
'django.contrib.sessions.middleware.SessionMiddleware', | ||
'django.middleware.common.CommonMiddleware', | ||
'django.contrib.auth.middleware.AuthenticationMiddleware', | ||
'django.contrib.messages.middleware.MessageMiddleware', | ||
'django.middleware.clickjacking.XFrameOptionsMiddleware', | ||
'pinry.users.middleware.Public', | ||
] | ||
|
||
TEMPLATES = [ | ||
{ | ||
'BACKEND': 'django.template.backends.django.DjangoTemplates', | ||
'DIRS': [os.path.join(BASE_DIR, 'pinry/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', | ||
], | ||
}, | ||
}, | ||
] | ||
|
||
STATICFILES_FINDERS = [ | ||
'django.contrib.staticfiles.finders.FileSystemFinder', | ||
'django.contrib.staticfiles.finders.AppDirectoriesFinder', | ||
'compressor.finders.CompressorFinder', | ||
] | ||
|
||
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'pinry/static')] | ||
|
||
STATIC_ROOT = os.path.join(BASE_DIR, 'static') | ||
|
||
MEDIA_ROOT = os.path.join(STATIC_ROOT, 'media') | ||
|
||
WSGI_APPLICATION = 'pinry.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'), | ||
} | ||
} | ||
|
||
# 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/' | ||
|
||
MEDIA_URL = '/static/media/' | ||
|
||
# Set to False to disable people from creating new accounts. | ||
ALLOW_NEW_REGISTRATIONS = False | ||
|
||
# Set to False to force users to login before seeing any pins. | ||
PUBLIC = True | ||
|
||
AUTHENTICATION_BACKENDS = [ | ||
'pinry.users.auth.backends.CombinedAuthBackend', | ||
'django.contrib.auth.backends.ModelBackend', | ||
] | ||
|
||
LOGIN_URL = '/login/' | ||
|
||
LOGIN_REDIRECT_URL = '/' | ||
|
||
MESSAGE_TAGS = { | ||
messages.WARNING: 'alert alert-warning', | ||
messages.ERROR: 'alert alert-danger', | ||
messages.SUCCESS: 'alert alert-success', | ||
messages.INFO: 'alert alert-info', | ||
} | ||
|
||
API_LIMIT_PER_PAGE = 50 | ||
|
||
IMAGE_PATH = 'pinry.core.utils.upload_path' | ||
|
||
IMAGE_SIZES = { | ||
'thumbnail': {'size': [240, 0]}, | ||
'standard': {'size': [600, 0]}, | ||
'square': {'crop': True, 'size': [125, 125]}, | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from __future__ import unicode_literals | ||
|
||
from django.apps import AppConfig | ||
|
||
|
||
class UsersConfig(AppConfig): | ||
name = 'users' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters