Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
aea72a62
Commit
aea72a62
authored
13 years ago
by
David Ormsbee
Browse files
Options
Downloads
Patches
Plain Diff
matching settings2 to old settings -- fix template lookup
parent
2eedce01
Loading
Loading
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
settings2/README.txt
+1
-1
1 addition, 1 deletion
settings2/README.txt
settings2/common.py
+50
-18
50 additions, 18 deletions
settings2/common.py
settings2/dev.py
+16
-2
16 additions, 2 deletions
settings2/dev.py
with
67 additions
and
21 deletions
settings2/README.txt
+
1
−
1
View file @
aea72a62
Transitional for moving to new settings scheme.
To use:
django-admin runserver --settings=settings2.dev --pythonpath="."
django-admin
.py
runserver --settings=settings2.dev --pythonpath="."
This diff is collapsed.
Click to expand it.
settings2/common.py
+
50
−
18
View file @
aea72a62
...
...
@@ -67,10 +67,12 @@ MAKO_TEMPLATES = {}
MAKO_TEMPLATES
[
'
course
'
]
=
[
DATA_DIR
]
MAKO_TEMPLATES
[
'
sections
'
]
=
[
DATA_DIR
/
'
sections
'
]
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
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 ???????? --
# We should have separate S3 staged URLs in case we need to make changes to
...
...
@@ -88,7 +90,8 @@ STATIC_GRAB = False
DEV_CONTENT
=
True
# FIXME: Should we be doing this truncation?
TRACK_MAX_EVENT
=
5000
TRACK_MAX_EVENT
=
10000
DEBUG_TRACK_LOG
=
False
############################### DJANGO BUILT-INS ###############################
# 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
# FIXME: We should iterate through the courses we have, adding the static
# contents for each of them. (Right now we just use symlinks.)
STATICFILES_DIRS
=
(
# FIXME: Need to add entries for book, data/images, etc.
# PROJECT_ROOT / "static",
ENV_ROOT
/
"
static
"
,
# FIXME: Need to add entries for book, data/images, etc.
PROJECT_ROOT
/
"
static
"
,
ASKBOT_ROOT
/
"
askbot
"
/
"
skins
"
,
# Something like this will probably need to be enabled when we're really doing
# multiple courses.
# ("circuits", DATA_DIR / "images"),
# ("handouts", DATA_DIR / "handouts"),
# ("subs", DATA_DIR / "subs"),
# ("book", TEXTBOOK_DIR)
)
# T
emplates
# T
his is where Django Template lookup is defined.
TEMPLATE_DIRS
=
(
ENV_ROOT
/
"
templates
"
,
# PROJECT_ROOT / "templates",
# DATA_DIR / "problems",
PROJECT_ROOT
/
"
templates
"
,
DATA_DIR
/
"
templates
"
,
)
#'/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
=
(
'
django.core.context_processors.request
'
,
'
askbot.context.application_settings
'
,
...
...
@@ -149,7 +156,7 @@ TEMPLATE_CONTEXT_PROCESSORS = (
DEFAULT_FILE_STORAGE
=
'
django.core.files.storage.FileSystemStorage
'
MEDIA_ROOT
=
ENV_ROOT
/
"
uploads
"
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
=
(
'
django.core.files.uploadhandler.MemoryFileUploadHandler
'
,
'
django.core.files.uploadhandler.TemporaryFileUploadHandler
'
,
...
...
@@ -166,13 +173,27 @@ USE_L10N = True
# logger.
pid
=
os
.
getpid
()
# So we can log which process is creating the log
hostname
=
platform
.
node
().
split
(
"
.
"
)[
0
]
LOG_DIR
=
"
/tmp
"
SYSLOG_ADDRESS
=
(
'
syslog.m.i4x.org
'
,
514
)
TRACKING_LOG_FILE
=
LOG_DIR
+
"
/tracking_{0}.log
"
.
format
(
pid
)
handlers
=
[
'
console
'
]
# FIXME: re-enable syslogger later
# if not DEBUG:
# 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
=
{
'
version
'
:
1
,
'
disable_existing_loggers
'
:
True
,
...
...
@@ -181,7 +202,8 @@ LOGGING = {
'
format
'
:
'
%(asctime)s %(levelname)s %(process)d [%(name)s] %(filename)s:%(lineno)d - %(message)s
'
,
},
'
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
'
:
{
'
format
'
:
'
%(message)s
'
,
...
...
@@ -189,7 +211,7 @@ LOGGING = {
},
'
handlers
'
:
{
'
console
'
:
{
'
level
'
:
'
DEBUG
'
,
'
level
'
:
'
DEBUG
'
if
DEBUG
else
'
INFO
'
,
'
class
'
:
'
logging.StreamHandler
'
,
'
formatter
'
:
'
standard
'
,
'
stream
'
:
sys
.
stdout
,
...
...
@@ -206,6 +228,12 @@ LOGGING = {
'
address
'
:
SYSLOG_ADDRESS
,
'
formatter
'
:
'
syslog_format
'
,
},
'
tracking
'
:
{
'
level
'
:
'
DEBUG
'
,
'
class
'
:
'
logging.handlers.WatchedFileHandler
'
,
'
filename
'
:
TRACKING_LOG_FILE
,
'
formatter
'
:
'
raw
'
,
},
'
mail_admins
'
:
{
'
level
'
:
'
ERROR
'
,
'
class
'
:
'
django.utils.log.AdminEmailHandler
'
,
...
...
@@ -218,7 +246,7 @@ LOGGING = {
'
level
'
:
'
INFO
'
},
'
tracking
'
:
{
'
handlers
'
:
[
]
if
DEBUG
else
[
'
syslogger
'
],
# handlers
,
'
handlers
'
:
[
'
tracking
'
]
,
'
level
'
:
'
DEBUG
'
,
'
propagate
'
:
False
,
},
...
...
@@ -284,14 +312,16 @@ TEMPLATE_LOADERS = (
MIDDLEWARE_CLASSES
=
(
'
util.middleware.ExceptionLoggingMiddleware
'
,
'
django.middleware.cache.UpdateCacheMiddleware
'
,
'
django.middleware.common.CommonMiddleware
'
,
'
django.contrib.sessions.middleware.SessionMiddleware
'
,
'
django.middleware.csrf.CsrfViewMiddleware
'
,
'
django.contrib.auth.middleware.AuthenticationMiddleware
'
,
#'django.contrib.auth.middleware.AuthenticationMiddleware',
'
cache_toolbox.middleware.CacheBackedAuthenticationMiddleware
'
,
'
django.contrib.messages.middleware.MessageMiddleware
'
,
'
track.middleware.TrackMiddleware
'
,
'
mitxmako.middleware.MakoMiddleware
'
,
# 'debug_toolbar.middleware.DebugToolbarMiddleware',
'
askbot.middleware.anon_user.ConnectToSessionMessagesMiddleware
'
,
'
askbot.middleware.forum_mode.ForumModeMiddleware
'
,
'
askbot.middleware.cancel.CancelActionMiddleware
'
,
...
...
@@ -299,10 +329,11 @@ MIDDLEWARE_CLASSES = (
'
askbot.middleware.view_log.ViewLogMiddleware
'
,
'
askbot.middleware.spaceless.SpacelessMiddleware
'
,
# 'askbot.middleware.pagesize.QuestionsPageSizeMiddleware',
# 'debug_toolbar.middleware.DebugToolbarMiddleware',
)
################################### APPS #######################################
def
installed_apps
():
def
installed_apps
(
extras
=
()
):
"""
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
this method. We can
'
t just take these as params because other pieces of the
...
...
@@ -339,6 +370,7 @@ def installed_apps():
return
tuple
(
STANDARD_APPS
+
(
COURSEWARE_APPS
if
COURSEWARE_ENABLED
else
[])
+
(
ASKBOT_APPS
if
ASKBOT_ENABLED
else
[]))
(
ASKBOT_APPS
if
ASKBOT_ENABLED
else
[])
+
list
(
extras
))
INSTALLED_APPS
=
installed_apps
()
This diff is collapsed.
Click to expand it.
settings2/dev.py
+
16
−
2
View file @
aea72a62
...
...
@@ -17,7 +17,7 @@ DATABASES = {
SECRET_KEY
=
'
85920908f28904ed733fe576320db18cabd7b6cd
'
DEBUG
=
True
TEMPLATE_DEBUG
=
Fals
e
TEMPLATE_DEBUG
=
Tru
e
# This is disabling ASKBOT, but not properly overwriting INSTALLED_APPS. ???
# It's because our ASKBOT_ENABLED here is actually shadowing the real one.
...
...
@@ -25,4 +25,18 @@ TEMPLATE_DEBUG = False
# ASKBOT_ENABLED = True
# 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
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment