Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
John James
whats-open
Commits
8d64c384
Unverified
Commit
8d64c384
authored
Apr 02, 2017
by
David Haynes
🙆
Browse files
refactor: Settings cleaned up a bit
- remove commented out items Signed-off-by:
David Haynes
<
dhaynes3@gmu.edu
>
parent
b7dd94fa
Changes
4
Hide whitespace changes
Inline
Side-by-side
whats_open/website/views.py
View file @
8d64c384
...
...
@@ -55,25 +55,8 @@ class OpenTimeViewSet(viewsets.ModelViewSet):
queryset
=
OpenTime
.
objects
.
all
()
serializer_class
=
OpenTimeSerializer
#def facility_grid(request):
# """Display the facilities in a grid. Main page."""
# if 'sort' in request.GET:
# if request.GET['sort'] == 'location':
# # Display the grid by location (instead of listing alphabetically)
# pass # Not implemented yet
# return render_to_response('facility_grid.html',
# context_instance=RequestContext(request))
def
gen_etag
(
request
):
return
hashlib
.
sha1
(
str
(
OpenTime
.
objects
.
all
())).
hexdigest
()
def
gen_last_modified
(
request
):
return
TimeStampedModel
.
objects
.
all
().
order_by
(
'-last_modified'
)[
0
].
last_modified
#@condition(etag_func=gen_etag, last_modified_func=gen_last_modified)
#def ajax_schedule_data(request):
# # Wrapping up in an object to avoid possible CSRF attack on top-level
# # arrays in JSON objects
# return HttpResponse(json.dumps({'data': export_data()}, indent=4),
# content_type="application/json")
whats_open/whats_open/settings/base.py
View file @
8d64c384
""""Base Django settings for whats_open."""
import
os
import
sys
from
os.path
import
abspath
,
basename
,
dirname
,
join
,
normpath
from
sys
import
path
...
...
@@ -19,16 +20,6 @@ SITE_NAME = basename(DJANGO_ROOT)
path
.
append
(
DJANGO_ROOT
)
########## END PATH CONFIGURATION
########## DEBUG CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG
=
False
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
TEMPLATE_DEBUG
=
DEBUG
########## END DEBUG CONFIGURATION
########## MANAGER CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#admins
# Insert a ('Name', 'Email') inside ADMINS tuple
...
...
@@ -124,7 +115,6 @@ ADMIN_MEDIA_PREFIX = '/static/admin/'
STATICFILES_FINDERS
=
(
'django.contrib.staticfiles.finders.FileSystemFinder'
,
'django.contrib.staticfiles.finders.AppDirectoriesFinder'
,
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
########## END STATIC FILE CONFIGURATION
...
...
@@ -178,8 +168,6 @@ TEMPLATES = [
'django.template.loaders.filesystem.Loader'
,
'django.template.loaders.app_directories.Loader'
,
],
# https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
'debug'
:
DEBUG
}
}
]
...
...
@@ -227,7 +215,7 @@ CACHE_MIDDLEWARE_KEY_PREFIX = ''
########## APP CONFIGURATION
DJANGO
_APPS
=
(
INSTALLED
_APPS
=
(
# Default Django apps:
'django.contrib.auth'
,
'django.contrib.contenttypes'
,
...
...
@@ -236,24 +224,15 @@ DJANGO_APPS = (
'django.contrib.messages'
,
'django.contrib.staticfiles'
,
# Useful template tags:
# 'django.contrib.humanize',
# Admin panel and documentation:
'django.contrib.admin'
,
'django.contrib.admindocs'
,
)
# Apps specific for this project go here.
LOCAL_APPS
=
(
# Apps specific for this project go here.
'website'
,
#'guardian',
'rest_framework'
,
)
# See: https://docs.djangoproject.com/en/dev/ref/settings/#installed-apps
INSTALLED_APPS
=
DJANGO_APPS
+
LOCAL_APPS
########## END APP CONFIGURATION
...
...
@@ -294,7 +273,12 @@ LOGGING = {
'level'
:
'ERROR'
,
'filters'
:
[
'require_debug_false'
],
'class'
:
'django.utils.log.AdminEmailHandler'
}
},
'console'
:
{
'level'
:
'INFO'
,
'class'
:
'logging.StreamHandler'
,
'stream'
:
sys
.
stdout
},
},
'loggers'
:
{
'django.request'
:
{
...
...
@@ -302,19 +286,12 @@ LOGGING = {
'level'
:
'ERROR'
,
'propagate'
:
True
,
},
'django'
:
{
'handlers'
:
[
'console'
],
'level'
:
'INFO'
,
'propogate'
:
True
},
}
}
########## END LOGGING CONFIGURATION
########## MANAGEMENT CONFIGURATION
#CAS_GATEWAY=True
#ANONYMOUS_USER_ID = -1
#AUTHENTICATION_BACKENDS = (
# 'django.contrib.auth.backends.ModelBackend', # this is default
# 'cas.middleware.CASMiddleware',
# #'guardian.backends.ObjectPermissionBackend',
#)
#
#LOGIN_URL='/management/login/'
#LOGIN_REDIRECT='/management/'
########## END MANAGEMENT CONFIGURATION
########## END LOGGING CONFIGURATION
whats_open/whats_open/settings/local.py
View file @
8d64c384
...
...
@@ -2,8 +2,6 @@
from
__future__
import
absolute_import
from
os.path
import
join
,
normpath
from
.base
import
*
...
...
@@ -12,28 +10,6 @@ from .base import *
DEBUG
=
True
########## END DEBUG CONFIGURATION
########## EMAIL CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-backend
EMAIL_BACKEND
=
'django.core.mail.backends.console.EmailBackend'
########## END EMAIL CONFIGURATION
########## DATABASE CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#databases
DATABASES
=
{
'default'
:
{
'ENGINE'
:
'django.db.backends.sqlite3'
,
'NAME'
:
normpath
(
join
(
DJANGO_ROOT
,
'database/database.db'
)),
'USER'
:
''
,
'PASSWORD'
:
''
,
'HOST'
:
''
,
'PORT'
:
''
,
}
}
########## END DATABASE CONFIGURATION
########## CACHE CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#caches
CACHES
=
{
...
...
whats_open/whats_open/settings/production.py
View file @
8d64c384
"""Production settings and globals."""
from
__future__
import
absolute_import
# Future Imports
from
__future__
import
(
absolute_import
,
division
,
print_function
,
unicode_literals
)
from
os
import
environ
...
...
@@ -24,45 +26,10 @@ def get_env_setting(setting):
ALLOWED_HOSTS
=
[
'*'
]
########## END HOST CONFIGURATION
########## EMAIL CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-backend
EMAIL_BACKEND
=
'django.core.mail.backends.smtp.EmailBackend'
# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-host
EMAIL_HOST
=
environ
.
get
(
'EMAIL_HOST'
,
'smtp.gmail.com'
)
# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-host-password
EMAIL_HOST_PASSWORD
=
environ
.
get
(
'EMAIL_HOST_PASSWORD'
,
''
)
# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-host-user
EMAIL_HOST_USER
=
environ
.
get
(
'EMAIL_HOST_USER'
,
'your_email@example.com'
)
# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-port
EMAIL_PORT
=
environ
.
get
(
'EMAIL_PORT'
,
587
)
# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-subject-prefix
EMAIL_SUBJECT_PREFIX
=
'[%s] '
%
SITE_NAME
# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-use-tls
EMAIL_USE_TLS
=
True
# See: https://docs.djangoproject.com/en/dev/ref/settings/#server-email
SERVER_EMAIL
=
EMAIL_HOST_USER
########## END EMAIL CONFIGURATION
########## DATABASE CONFIGURATION
DATABASES
=
{
'default'
:
{
'ENGINE'
:
'django.db.backends.sqlite3'
,
'NAME'
:
normpath
(
join
(
DJANGO_ROOT
,
'database.db'
)),
'USER'
:
''
,
'PASSWORD'
:
''
,
'HOST'
:
''
,
'PORT'
:
''
,
}
}
########## END DATABASE CONFIGURATION
########## DEBUG CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG
=
False
########## END DEBUG CONFIGURATION
########## CACHE CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#caches
...
...
@@ -73,7 +40,6 @@ CACHES = {
}
########## END CACHE CONFIGURATION
########## SECRET CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
SECRET_KEY
=
get_env_setting
(
'SECRET_KEY'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment