Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
aea72a62
Commit
aea72a62
authored
Mar 22, 2012
by
David Ormsbee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
matching settings2 to old settings -- fix template lookup
parent
2eedce01
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
21 deletions
+67
-21
settings2/README.txt
+1
-1
settings2/common.py
+50
-18
settings2/dev.py
+16
-2
No files found.
settings2/README.txt
View file @
aea72a62
Transitional for moving to new settings scheme.
Transitional for moving to new settings scheme.
To use:
To use:
django-admin runserver --settings=settings2.dev --pythonpath="."
django-admin
.py
runserver --settings=settings2.dev --pythonpath="."
settings2/common.py
View file @
aea72a62
...
@@ -67,10 +67,12 @@ MAKO_TEMPLATES = {}
...
@@ -67,10 +67,12 @@ MAKO_TEMPLATES = {}
MAKO_TEMPLATES
[
'course'
]
=
[
DATA_DIR
]
MAKO_TEMPLATES
[
'course'
]
=
[
DATA_DIR
]
MAKO_TEMPLATES
[
'sections'
]
=
[
DATA_DIR
/
'sections'
]
MAKO_TEMPLATES
[
'sections'
]
=
[
DATA_DIR
/
'sections'
]
MAKO_TEMPLATES
[
'custom_tags'
]
=
[
DATA_DIR
/
'custom_tags'
]
MAKO_TEMPLATES
[
'custom_tags'
]
=
[
DATA_DIR
/
'custom_tags'
]
MAKO_TEMPLATES
[
'main'
]
=
[
ENV_ROOT
/
'templates/
'
]
MAKO_TEMPLATES
[
'main'
]
=
[
PROJECT_ROOT
/
'templates'
,
DATA_DIR
/
'info
'
]
# FIXME: We're not checking this out in this location yet
# FIXME: We're not checking this out in this location yet
TEXTBOOK_DIR
=
ENV_ROOT
/
"books"
/
"circuits_agarwal_lang"
# TEXTBOOK_DIR = ENV_ROOT / "books" / "circuits_agarwal_lang" # What it should eventually be
TEXTBOOK_DIR
=
ENV_ROOT
/
"book_images"
# FIXME ???????? --
# FIXME ???????? --
# We should have separate S3 staged URLs in case we need to make changes to
# We should have separate S3 staged URLs in case we need to make changes to
...
@@ -88,7 +90,8 @@ STATIC_GRAB = False
...
@@ -88,7 +90,8 @@ STATIC_GRAB = False
DEV_CONTENT
=
True
DEV_CONTENT
=
True
# FIXME: Should we be doing this truncation?
# FIXME: Should we be doing this truncation?
TRACK_MAX_EVENT
=
5000
TRACK_MAX_EVENT
=
10000
DEBUG_TRACK_LOG
=
False
############################### DJANGO BUILT-INS ###############################
############################### DJANGO BUILT-INS ###############################
# Change DEBUG/TEMPLATE_DEBUG in your environment settings files, not here
# Change DEBUG/TEMPLATE_DEBUG in your environment settings files, not here
...
@@ -119,23 +122,27 @@ STATIC_ROOT = ENV_ROOT / "staticfiles" # FIXME: Should this and uploads be moved
...
@@ -119,23 +122,27 @@ STATIC_ROOT = ENV_ROOT / "staticfiles" # FIXME: Should this and uploads be moved
# FIXME: We should iterate through the courses we have, adding the static
# FIXME: We should iterate through the courses we have, adding the static
# contents for each of them. (Right now we just use symlinks.)
# contents for each of them. (Right now we just use symlinks.)
STATICFILES_DIRS
=
(
STATICFILES_DIRS
=
(
# FIXME: Need to add entries for book, data/images, etc.
# FIXME: Need to add entries for book, data/images, etc.
# PROJECT_ROOT / "static",
PROJECT_ROOT
/
"static"
,
ENV_ROOT
/
"static"
,
ASKBOT_ROOT
/
"askbot"
/
"skins"
,
ASKBOT_ROOT
/
"askbot"
/
"skins"
,
# Something like this will probably need to be enabled when we're really doing
# multiple courses.
# ("circuits", DATA_DIR / "images"),
# ("circuits", DATA_DIR / "images"),
# ("handouts", DATA_DIR / "handouts"),
# ("handouts", DATA_DIR / "handouts"),
# ("subs", DATA_DIR / "subs"),
# ("subs", DATA_DIR / "subs"),
# ("book", TEXTBOOK_DIR)
# ("book", TEXTBOOK_DIR)
)
)
# T
emplates
# T
his is where Django Template lookup is defined.
TEMPLATE_DIRS
=
(
TEMPLATE_DIRS
=
(
ENV_ROOT
/
"templates"
,
PROJECT_ROOT
/
"templates"
,
# PROJECT_ROOT / "templates",
DATA_DIR
/
"templates"
,
# DATA_DIR / "problems",
)
)
#'/Users/dave/Projects/mitx/mitx_all//data//templates', '/Users/dave/Projects/mitx/mitx_all//textbook/')
#path(u'/Users/dave/Projects/mitx/mitx_all/data/problems'))
TEMPLATE_CONTEXT_PROCESSORS
=
(
TEMPLATE_CONTEXT_PROCESSORS
=
(
'django.core.context_processors.request'
,
'django.core.context_processors.request'
,
'askbot.context.application_settings'
,
'askbot.context.application_settings'
,
...
@@ -149,7 +156,7 @@ TEMPLATE_CONTEXT_PROCESSORS = (
...
@@ -149,7 +156,7 @@ TEMPLATE_CONTEXT_PROCESSORS = (
DEFAULT_FILE_STORAGE
=
'django.core.files.storage.FileSystemStorage'
DEFAULT_FILE_STORAGE
=
'django.core.files.storage.FileSystemStorage'
MEDIA_ROOT
=
ENV_ROOT
/
"uploads"
MEDIA_ROOT
=
ENV_ROOT
/
"uploads"
MEDIA_URL
=
"/discussion/upfiles/"
MEDIA_URL
=
"/discussion/upfiles/"
FILE_UPLOAD_TEMP_DIR
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'tmp'
)
.
replace
(
'
\\
'
,
'/'
)
FILE_UPLOAD_TEMP_DIR
=
ENV_ROOT
/
"uploads"
FILE_UPLOAD_HANDLERS
=
(
FILE_UPLOAD_HANDLERS
=
(
'django.core.files.uploadhandler.MemoryFileUploadHandler'
,
'django.core.files.uploadhandler.MemoryFileUploadHandler'
,
'django.core.files.uploadhandler.TemporaryFileUploadHandler'
,
'django.core.files.uploadhandler.TemporaryFileUploadHandler'
,
...
@@ -166,13 +173,27 @@ USE_L10N = True
...
@@ -166,13 +173,27 @@ USE_L10N = True
# logger.
# logger.
pid
=
os
.
getpid
()
# So we can log which process is creating the log
pid
=
os
.
getpid
()
# So we can log which process is creating the log
hostname
=
platform
.
node
()
.
split
(
"."
)[
0
]
hostname
=
platform
.
node
()
.
split
(
"."
)[
0
]
LOG_DIR
=
"/tmp"
SYSLOG_ADDRESS
=
(
'syslog.m.i4x.org'
,
514
)
SYSLOG_ADDRESS
=
(
'syslog.m.i4x.org'
,
514
)
TRACKING_LOG_FILE
=
LOG_DIR
+
"/tracking_{0}.log"
.
format
(
pid
)
handlers
=
[
'console'
]
handlers
=
[
'console'
]
# FIXME: re-enable syslogger later
# FIXME: re-enable syslogger later
# if not DEBUG:
# if not DEBUG:
# handlers.append('syslogger')
# handlers.append('syslogger')
LOGGING_ENV
=
"dev"
# override this in different environments
# def register_loggers(syslog_addr, tracking_log_dir, logging_env):
# pid = os.getpid() # So we can log which process is creating the log
# hostname = platform.node().split(".")[0]
# SYSLOG_ADDRESS = ('syslog.m.i4x.org', 514)
# TRACKING_LOG_FILE = LOG_DIR + "/tracking_{0}.log".format(pid)
#
# handlers = ['console']
LOGGING
=
{
LOGGING
=
{
'version'
:
1
,
'version'
:
1
,
'disable_existing_loggers'
:
True
,
'disable_existing_loggers'
:
True
,
...
@@ -181,7 +202,8 @@ LOGGING = {
...
@@ -181,7 +202,8 @@ LOGGING = {
'format'
:
'
%(asctime)
s
%(levelname)
s
%(process)
d [
%(name)
s]
%(filename)
s:
%(lineno)
d -
%(message)
s'
,
'format'
:
'
%(asctime)
s
%(levelname)
s
%(process)
d [
%(name)
s]
%(filename)
s:
%(lineno)
d -
%(message)
s'
,
},
},
'syslog_format'
:
{
'syslog_format'
:
{
'format'
:
'[
%(name)
s]
%(levelname)
s ['
+
hostname
+
'
%(process)
d] [
%(filename)
s:
%(lineno)
d] -
%(message)
s'
,
'format'
:
'[
%(name)
s][env:'
+
LOGGING_ENV
+
']
%(levelname)
s ['
+
\
hostname
+
'
%(process)
d] [
%(filename)
s:
%(lineno)
d] -
%(message)
s'
,
},
},
'raw'
:
{
'raw'
:
{
'format'
:
'
%(message)
s'
,
'format'
:
'
%(message)
s'
,
...
@@ -189,7 +211,7 @@ LOGGING = {
...
@@ -189,7 +211,7 @@ LOGGING = {
},
},
'handlers'
:
{
'handlers'
:
{
'console'
:
{
'console'
:
{
'level'
:
'DEBUG'
,
'level'
:
'DEBUG'
if
DEBUG
else
'INFO'
,
'class'
:
'logging.StreamHandler'
,
'class'
:
'logging.StreamHandler'
,
'formatter'
:
'standard'
,
'formatter'
:
'standard'
,
'stream'
:
sys
.
stdout
,
'stream'
:
sys
.
stdout
,
...
@@ -206,6 +228,12 @@ LOGGING = {
...
@@ -206,6 +228,12 @@ LOGGING = {
'address'
:
SYSLOG_ADDRESS
,
'address'
:
SYSLOG_ADDRESS
,
'formatter'
:
'syslog_format'
,
'formatter'
:
'syslog_format'
,
},
},
'tracking'
:
{
'level'
:
'DEBUG'
,
'class'
:
'logging.handlers.WatchedFileHandler'
,
'filename'
:
TRACKING_LOG_FILE
,
'formatter'
:
'raw'
,
},
'mail_admins'
:
{
'mail_admins'
:
{
'level'
:
'ERROR'
,
'level'
:
'ERROR'
,
'class'
:
'django.utils.log.AdminEmailHandler'
,
'class'
:
'django.utils.log.AdminEmailHandler'
,
...
@@ -218,7 +246,7 @@ LOGGING = {
...
@@ -218,7 +246,7 @@ LOGGING = {
'level'
:
'INFO'
'level'
:
'INFO'
},
},
'tracking'
:
{
'tracking'
:
{
'handlers'
:
[
]
if
DEBUG
else
[
'syslogger'
],
# handlers
,
'handlers'
:
[
'tracking'
]
,
'level'
:
'DEBUG'
,
'level'
:
'DEBUG'
,
'propagate'
:
False
,
'propagate'
:
False
,
},
},
...
@@ -284,14 +312,16 @@ TEMPLATE_LOADERS = (
...
@@ -284,14 +312,16 @@ TEMPLATE_LOADERS = (
MIDDLEWARE_CLASSES
=
(
MIDDLEWARE_CLASSES
=
(
'util.middleware.ExceptionLoggingMiddleware'
,
'util.middleware.ExceptionLoggingMiddleware'
,
'django.middleware.cache.UpdateCacheMiddleware'
,
'django.middleware.common.CommonMiddleware'
,
'django.middleware.common.CommonMiddleware'
,
'django.contrib.sessions.middleware.SessionMiddleware'
,
'django.contrib.sessions.middleware.SessionMiddleware'
,
'django.middleware.csrf.CsrfViewMiddleware'
,
'django.middleware.csrf.CsrfViewMiddleware'
,
'django.contrib.auth.middleware.AuthenticationMiddleware'
,
#'django.contrib.auth.middleware.AuthenticationMiddleware',
'cache_toolbox.middleware.CacheBackedAuthenticationMiddleware'
,
'django.contrib.messages.middleware.MessageMiddleware'
,
'django.contrib.messages.middleware.MessageMiddleware'
,
'track.middleware.TrackMiddleware'
,
'track.middleware.TrackMiddleware'
,
'mitxmako.middleware.MakoMiddleware'
,
'mitxmako.middleware.MakoMiddleware'
,
# 'debug_toolbar.middleware.DebugToolbarMiddleware',
'askbot.middleware.anon_user.ConnectToSessionMessagesMiddleware'
,
'askbot.middleware.anon_user.ConnectToSessionMessagesMiddleware'
,
'askbot.middleware.forum_mode.ForumModeMiddleware'
,
'askbot.middleware.forum_mode.ForumModeMiddleware'
,
'askbot.middleware.cancel.CancelActionMiddleware'
,
'askbot.middleware.cancel.CancelActionMiddleware'
,
...
@@ -299,10 +329,11 @@ MIDDLEWARE_CLASSES = (
...
@@ -299,10 +329,11 @@ MIDDLEWARE_CLASSES = (
'askbot.middleware.view_log.ViewLogMiddleware'
,
'askbot.middleware.view_log.ViewLogMiddleware'
,
'askbot.middleware.spaceless.SpacelessMiddleware'
,
'askbot.middleware.spaceless.SpacelessMiddleware'
,
# 'askbot.middleware.pagesize.QuestionsPageSizeMiddleware',
# 'askbot.middleware.pagesize.QuestionsPageSizeMiddleware',
# 'debug_toolbar.middleware.DebugToolbarMiddleware',
)
)
################################### APPS #######################################
################################### APPS #######################################
def
installed_apps
():
def
installed_apps
(
extras
=
()
):
"""If you want to get a different set of INSTALLED_APPS out of this, you'll
"""If you want to get a different set of INSTALLED_APPS out of this, you'll
have to set ASKBOT_ENABLED and COURSEWARE_ENABLED to True/False and call
have to set ASKBOT_ENABLED and COURSEWARE_ENABLED to True/False and call
this method. We can't just take these as params because other pieces of the
this method. We can't just take these as params because other pieces of the
...
@@ -339,6 +370,7 @@ def installed_apps():
...
@@ -339,6 +370,7 @@ def installed_apps():
return
tuple
(
STANDARD_APPS
+
return
tuple
(
STANDARD_APPS
+
(
COURSEWARE_APPS
if
COURSEWARE_ENABLED
else
[])
+
(
COURSEWARE_APPS
if
COURSEWARE_ENABLED
else
[])
+
(
ASKBOT_APPS
if
ASKBOT_ENABLED
else
[]))
(
ASKBOT_APPS
if
ASKBOT_ENABLED
else
[])
+
list
(
extras
))
INSTALLED_APPS
=
installed_apps
()
INSTALLED_APPS
=
installed_apps
()
settings2/dev.py
View file @
aea72a62
...
@@ -17,7 +17,7 @@ DATABASES = {
...
@@ -17,7 +17,7 @@ DATABASES = {
SECRET_KEY
=
'85920908f28904ed733fe576320db18cabd7b6cd'
SECRET_KEY
=
'85920908f28904ed733fe576320db18cabd7b6cd'
DEBUG
=
True
DEBUG
=
True
TEMPLATE_DEBUG
=
Fals
e
TEMPLATE_DEBUG
=
Tru
e
# This is disabling ASKBOT, but not properly overwriting INSTALLED_APPS. ???
# This is disabling ASKBOT, but not properly overwriting INSTALLED_APPS. ???
# It's because our ASKBOT_ENABLED here is actually shadowing the real one.
# It's because our ASKBOT_ENABLED here is actually shadowing the real one.
...
@@ -25,4 +25,18 @@ TEMPLATE_DEBUG = False
...
@@ -25,4 +25,18 @@ TEMPLATE_DEBUG = False
# ASKBOT_ENABLED = True
# ASKBOT_ENABLED = True
# MITX_FEATURES['SAMPLE'] = True # Switch to this system so we get around the shadowing
# MITX_FEATURES['SAMPLE'] = True # Switch to this system so we get around the shadowing
#
#
# INSTALLED_APPS = installed_apps()
INSTALLED_APPS
=
installed_apps
(
extras
=
[
'debug_toolbar'
])
MIDDLEWARE_CLASSES
=
(
'debug_toolbar.middleware.DebugToolbarMiddleware'
,)
+
MIDDLEWARE_CLASSES
DEBUG_TOOLBAR_PANELS
=
(
'debug_toolbar.panels.version.VersionDebugPanel'
,
'debug_toolbar.panels.timer.TimerDebugPanel'
,
# 'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel',
'debug_toolbar.panels.headers.HeaderDebugPanel'
,
'debug_toolbar.panels.request_vars.RequestVarsDebugPanel'
,
'debug_toolbar.panels.sql.SQLDebugPanel'
,
'debug_toolbar.panels.signals.SignalDebugPanel'
,
'debug_toolbar.panels.logger.LoggingPanel'
,
# 'debug_toolbar.panels.profiling.ProfilingDebugPanel', # Lots of overhead
)
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