Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Chad Smith
committed
Jan 3, 2017
1 parent
2a56705
commit f699fb1
Showing
6 changed files
with
140 additions
and
187 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
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 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 |
---|---|---|
@@ -1,164 +1,128 @@ | ||
# Django settings for tutorial project. | ||
""" | ||
Django settings for tutorial project. | ||
DEBUG = True | ||
TEMPLATE_DEBUG = DEBUG | ||
Generated by 'django-admin startproject' using Django 1.10.2. | ||
ADMINS = ( | ||
# ('Your Name', 'your_email@example.com'), | ||
) | ||
For more information on this file, see | ||
https://docs.djangoproject.com/en/1.10/topics/settings/ | ||
MANAGERS = ADMINS | ||
For the full list of settings and their values, see | ||
https://docs.djangoproject.com/en/1.10/ref/settings/ | ||
""" | ||
|
||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.sqlite3', # Or use an alternate database backend. | ||
'NAME': 'tmp.db', # Path to sqlite3 database file. | ||
'USER': '', # Not used with sqlite3. | ||
'PASSWORD': '', # Not used with sqlite3. | ||
'HOST': '', # Set to empty string for localhost. Not used with sqlite3. | ||
'PORT': '', # Set to empty string for default. Not used with sqlite3. | ||
} | ||
} | ||
import os | ||
|
||
# Local time zone for this installation. Choices can be found here: | ||
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name | ||
# although not all choices may be available on all operating systems. | ||
# In a Windows environment this must be set to your system time zone. | ||
TIME_ZONE = 'America/Chicago' | ||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) | ||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | ||
|
||
# Language code for this installation. All choices can be found here: | ||
# http://www.i18nguy.com/unicode/language-identifiers.html | ||
LANGUAGE_CODE = 'en-us' | ||
|
||
SITE_ID = 1 | ||
# Quick-start development settings - unsuitable for production | ||
# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/ | ||
|
||
# If you set this to False, Django will make some optimizations so as not | ||
# to load the internationalization machinery. | ||
USE_I18N = True | ||
# SECURITY WARNING: keep the secret key used in production secret! | ||
SECRET_KEY = 'us%!@&39o250e79)l!4*0ac4oquo+^nm83vp#y%mw9i$7)i&fy' | ||
|
||
# If you set this to False, Django will not format dates, numbers and | ||
# calendars according to the current locale. | ||
USE_L10N = True | ||
# SECURITY WARNING: don't run with debug turned on in production! | ||
DEBUG = True | ||
|
||
# If you set this to False, Django will not use timezone-aware datetimes. | ||
USE_TZ = True | ||
ALLOWED_HOSTS = [] | ||
|
||
# Absolute filesystem path to the directory that will hold user-uploaded files. | ||
# Example: "/home/media/media.lawrence.com/media/" | ||
MEDIA_ROOT = '' | ||
|
||
# URL that handles the media served from MEDIA_ROOT. Make sure to use a | ||
# trailing slash. | ||
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/" | ||
MEDIA_URL = '' | ||
# Application definition | ||
|
||
# Absolute path to the directory static files should be collected to. | ||
# Don't put anything in this directory yourself; store your static files | ||
# in apps' "static/" subdirectories and in STATICFILES_DIRS. | ||
# Example: "/home/media/media.lawrence.com/static/" | ||
STATIC_ROOT = '' | ||
INSTALLED_APPS = [ | ||
'django.contrib.admin', | ||
'django.contrib.auth', | ||
'django.contrib.contenttypes', | ||
'django.contrib.sessions', | ||
'django.contrib.messages', | ||
'django.contrib.staticfiles', | ||
'rest_framework', | ||
] | ||
|
||
# URL prefix for static files. | ||
# Example: "http://media.lawrence.com/static/" | ||
STATIC_URL = '/static/' | ||
REST_FRAMEWORK = { | ||
'DEFAULT_PERMISSION_CLASSES': [ | ||
'rest_framework.permissions.IsAdminUser', | ||
], | ||
'PAGE_SIZE': 10 | ||
} | ||
|
||
# Additional locations of static files | ||
STATICFILES_DIRS = ( | ||
# Put strings here, like "/home/html/static" or "C:/www/django/static". | ||
# Always use forward slashes, even on Windows. | ||
# Don't forget to use absolute paths, not relative paths. | ||
) | ||
|
||
# List of finder classes that know how to find static files in | ||
# various locations. | ||
STATICFILES_FINDERS = ( | ||
'django.contrib.staticfiles.finders.FileSystemFinder', | ||
'django.contrib.staticfiles.finders.AppDirectoriesFinder', | ||
# 'django.contrib.staticfiles.finders.DefaultStorageFinder', | ||
) | ||
|
||
# Make this unique, and don't share it with anybody. | ||
SECRET_KEY = '98s9du5ruv!j%shx0udb#uz1g@v^xl65zm1l-_5%8cs6%c*qm$' | ||
|
||
# List of callables that know how to import templates from various sources. | ||
TEMPLATE_LOADERS = ( | ||
'django.template.loaders.filesystem.Loader', | ||
'django.template.loaders.app_directories.Loader', | ||
# 'django.template.loaders.eggs.Loader', | ||
) | ||
|
||
MIDDLEWARE_CLASSES = ( | ||
'django.middleware.common.CommonMiddleware', | ||
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', | ||
# Uncomment the next line for simple clickjacking protection: | ||
# 'django.middleware.clickjacking.XFrameOptionsMiddleware', | ||
) | ||
'django.middleware.clickjacking.XFrameOptionsMiddleware', | ||
] | ||
|
||
ROOT_URLCONF = 'tutorial.urls' | ||
|
||
# Python dotted path to the WSGI application used by Django's runserver. | ||
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 = 'tutorial.wsgi.application' | ||
|
||
TEMPLATE_DIRS = ( | ||
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". | ||
# Always use forward slashes, even on Windows. | ||
# Don't forget to use absolute paths, not relative paths. | ||
) | ||
|
||
INSTALLED_APPS = ( | ||
'django.contrib.auth', | ||
'django.contrib.contenttypes', | ||
'django.contrib.sessions', | ||
'django.contrib.sites', | ||
'django.contrib.messages', | ||
'django.contrib.staticfiles', | ||
# Uncomment the next line to enable the admin: | ||
# 'django.contrib.admin', | ||
# Uncomment the next line to enable admin documentation: | ||
# 'django.contrib.admindocs', | ||
'rest_framework', | ||
'snippets', | ||
) | ||
|
||
# A sample logging configuration. The only tangible logging | ||
# performed by this configuration is to send an email to | ||
# the site admins on every HTTP 500 error when DEBUG=False. | ||
# See http://docs.djangoproject.com/en/dev/topics/logging for | ||
# more details on how to customize your logging configuration. | ||
LOGGING = { | ||
'version': 1, | ||
'disable_existing_loggers': False, | ||
'filters': { | ||
'require_debug_false': { | ||
'()': 'django.utils.log.RequireDebugFalse' | ||
} | ||
}, | ||
'handlers': { | ||
'mail_admins': { | ||
'level': 'ERROR', | ||
'filters': ['require_debug_false'], | ||
'class': 'django.utils.log.AdminEmailHandler' | ||
} | ||
}, | ||
'loggers': { | ||
'django.request': { | ||
'handlers': ['mail_admins'], | ||
'level': 'ERROR', | ||
'propagate': True, | ||
}, | ||
# 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'), | ||
} | ||
} | ||
|
||
REST_FRAMEWORK = { | ||
'PAGE_SIZE': 10, | ||
} | ||
|
||
import os | ||
if os.environ.get('HEROKU'): # heroku config:set HEROKU=1 | ||
import dj_database_url | ||
DATABASES['default'] = dj_database_url.config() | ||
# 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', | ||
}, | ||
] | ||
|
||
LOGIN_REDIRECT_URL = '/' | ||
|
||
# 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/' |
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 |
---|---|---|
@@ -1,12 +1,21 @@ | ||
from snippets import views | ||
from django.conf.urls import patterns, url, include | ||
from rest_framework.routers import DefaultRouter | ||
"""tutorial URL Configuration | ||
router = DefaultRouter() | ||
This comment has been minimized.
Sorry, something went wrong. |
||
router.register(r'snippets', views.SnippetViewSet) | ||
router.register(r'users', views.UserViewSet) | ||
The `urlpatterns` list routes URLs to views. For more information please see: | ||
https://docs.djangoproject.com/en/1.10/topics/http/urls/ | ||
Examples: | ||
Function views | ||
1. Add an import: from my_app import views | ||
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') | ||
Class-based views | ||
1. Add an import: from other_app.views import Home | ||
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') | ||
Including another URLconf | ||
1. Import the include() function: from django.conf.urls import url, include | ||
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) | ||
""" | ||
from django.conf.urls import url | ||
from django.contrib import admin | ||
|
||
urlpatterns = patterns('', | ||
url(r'^', include(router.urls)), | ||
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')) | ||
) | ||
urlpatterns = [ | ||
url(r'^admin/', admin.site.urls), | ||
] |
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 |
---|---|---|
@@ -1,28 +1,16 @@ | ||
""" | ||
WSGI config for tutorial project. | ||
This module contains the WSGI application used by Django's development server | ||
and any production WSGI deployments. It should expose a module-level variable | ||
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover | ||
this application via the ``WSGI_APPLICATION`` setting. | ||
Usually you will have the standard Django WSGI application here, but it also | ||
might make sense to replace the whole Django WSGI application with a custom one | ||
that later delegates to the Django one. For example, you could introduce WSGI | ||
middleware here, or combine a Django application with an application of another | ||
framework. | ||
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", "tutorial.settings") | ||
|
||
# This application object is used by any WSGI server configured to use this | ||
# file. This includes Django's development server, if the WSGI_APPLICATION | ||
# setting points here. | ||
from django.core.wsgi import get_wsgi_application | ||
application = get_wsgi_application() | ||
|
||
# Apply WSGI middleware here. | ||
# from helloworld.wsgi import HelloWorldApplication | ||
# application = HelloWorldApplication(application) |
2 comments
on commit f699fb1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any way to leave the older version around for reference? not all of us are using django 1.10
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could tag the versions, perhaps, although we've not been comprehensive about issuing a new version with each Django release.
I think you deleted a little too much!