summaryrefslogtreecommitdiffstats
path: root/askbot/setup_templates
diff options
context:
space:
mode:
authorAdolfo Fitoria <adolfo.fitoria@gmail.com>2012-08-02 13:47:01 -0600
committerAdolfo Fitoria <adolfo.fitoria@gmail.com>2012-08-02 13:47:01 -0600
commit4f6a78f465de5b439ece14ffea79351572dbb75d (patch)
treea77b7949c4a16cd7225d95ca91e75245f9097c1e /askbot/setup_templates
parenta303250bfd22f80c90a3bcc7f5ceb8b06e8bdbb1 (diff)
parent2a9fd69d2f53bff4130fc67badced33b52b4aa2b (diff)
downloadaskbot-4f6a78f465de5b439ece14ffea79351572dbb75d.tar.gz
askbot-4f6a78f465de5b439ece14ffea79351572dbb75d.tar.bz2
askbot-4f6a78f465de5b439ece14ffea79351572dbb75d.zip
Merge branch 'master' into django1.4
Conflicts: askbot/feed.py
Diffstat (limited to 'askbot/setup_templates')
-rw-r--r--askbot/setup_templates/settings.py34
-rw-r--r--askbot/setup_templates/settings.py.mustache36
-rw-r--r--askbot/setup_templates/urls.py5
3 files changed, 50 insertions, 25 deletions
diff --git a/askbot/setup_templates/settings.py b/askbot/setup_templates/settings.py
index 9e847eba..632c4e70 100644
--- a/askbot/setup_templates/settings.py
+++ b/askbot/setup_templates/settings.py
@@ -3,11 +3,13 @@ import os.path
import logging
import sys
import askbot
+import site
#this line is added so that we can import pre-packaged askbot dependencies
-sys.path.append(os.path.join(os.path.dirname(askbot.__file__), 'deps'))
+ASKBOT_ROOT = os.path.abspath(os.path.dirname(askbot.__file__))
+site.addsitedir(os.path.join(ASKBOT_ROOT, 'deps'))
-DEBUG = False#set to True to enable debugging
+DEBUG = True#set to True to enable debugging
TEMPLATE_DEBUG = False#keep false when debugging jinja2 templates
INTERNAL_IPS = ('127.0.0.1',)
@@ -68,14 +70,17 @@ LANGUAGE_CODE = 'en'
# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
-ASKBOT_FILE_UPLOAD_DIR = os.path.join(os.path.dirname(__file__), 'askbot', 'upfiles')
+MEDIA_ROOT = os.path.join(os.path.dirname(__file__), 'askbot', 'upfiles')
+MEDIA_URL = '/upfiles/'#url to uploaded media
+STATIC_URL = '/m/'#url to project static files
PROJECT_ROOT = os.path.dirname(__file__)
+STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')#path to files collected by collectstatic
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
-ADMIN_MEDIA_PREFIX = '/admin/media/'
+ADMIN_MEDIA_PREFIX = STATIC_URL + 'admin/'#must be this value
# Make up some unique string, and don't share it with anybody.
SECRET_KEY = 'sdljdfjkldsflsdjkhsjkldgjlsdgfs s '
@@ -93,6 +98,7 @@ TEMPLATE_LOADERS = (
MIDDLEWARE_CLASSES = (
#'django.middleware.gzip.GZipMiddleware',
+ #'askbot.middleware.locale.LocaleMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
#'django.middleware.cache.UpdateCacheMiddleware',
'django.middleware.common.CommonMiddleware',
@@ -103,7 +109,6 @@ MIDDLEWARE_CLASSES = (
#below is askbot stuff for this tuple
'askbot.middleware.anon_user.ConnectToSessionMessagesMiddleware',
'askbot.middleware.forum_mode.ForumModeMiddleware',
- 'askbot.middleware.pagesize.QuestionsPageSizeMiddleware',
'askbot.middleware.cancel.CancelActionMiddleware',
'django.middleware.transaction.TransactionMiddleware',
#'debug_toolbar.middleware.DebugToolbarMiddleware',
@@ -131,7 +136,7 @@ DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
#TEMPLATE_DIRS = (,) #template have no effect in askbot, use the variable below
-#ASKBOT_EXTRA_SKIN_DIR = #path to your private skin collection
+#ASKBOT_EXTRA_SKINS_DIR = #path to your private skin collection
#take a look here http://askbot.org/en/question/207/
TEMPLATE_CONTEXT_PROCESSORS = (
@@ -149,6 +154,7 @@ INSTALLED_APPS = (
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
+ 'django.contrib.staticfiles',
#all of these are needed for the askbot
'django.contrib.admin',
@@ -167,9 +173,6 @@ INSTALLED_APPS = (
'djkombu',
'followit',
#'avatar',#experimental use git clone git://github.com/ericflo/django-avatar.git$
- #requires setting of MEDIA_ROOT and MEDIA_URL
- #values of which can be the same as ASKBOT_FILE_UPLOAD_DIR and ASKBOT_UPLOADED_FILES_URL,
- #respectively
)
@@ -178,10 +181,12 @@ INSTALLED_APPS = (
CACHE_BACKEND = 'locmem://'
#needed for django-keyedcache
CACHE_TIMEOUT = 6000
+#sets a special timeout for livesettings if you want to make them different
+LIVESETTINGS_CACHE_TIMEOUT = CACHE_TIMEOUT
CACHE_PREFIX = 'askbot' #make this unique
CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True
#If you use memcache you may want to uncomment the following line to enable memcached based sessions
-#SESSION_ENGINE = 'django.contrib.sessions.backends.cache_db'
+#SESSION_ENGINE = 'django.contrib.sessions.backends.cached_db'
AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend',
@@ -209,7 +214,6 @@ LOGIN_URL = '/%s%s%s' % (ASKBOT_URL,_('account/'),_('signin/'))
LOGIN_REDIRECT_URL = ASKBOT_URL #adjust if needed
#note - it is important that upload dir url is NOT translated!!!
#also, this url must not have the leading slash
-ASKBOT_UPLOADED_FILES_URL = '%s%s' % (ASKBOT_URL, 'upfiles/')
ALLOW_UNICODE_SLUGS = False
ASKBOT_USE_STACKEXCHANGE_URLS = False #mimic url scheme of stackexchange
@@ -221,4 +225,10 @@ import djcelery
djcelery.setup_loader()
CSRF_COOKIE_NAME = 'askbot_csrf'
-CSRF_COOKIE_DOMAIN = ''#enter domain name here - e.g. example.com
+#enter domain name here - e.g. example.com
+#CSRF_COOKIE_DOMAIN = ''
+
+STATICFILES_DIRS = ( os.path.join(ASKBOT_ROOT, 'skins'),)
+
+RECAPTCHA_USE_SSL = True
+
diff --git a/askbot/setup_templates/settings.py.mustache b/askbot/setup_templates/settings.py.mustache
index 7a9f2a19..c827ac8e 100644
--- a/askbot/setup_templates/settings.py.mustache
+++ b/askbot/setup_templates/settings.py.mustache
@@ -3,11 +3,13 @@ import os.path
import logging
import sys
import askbot
+import site
#this line is added so that we can import pre-packaged askbot dependencies
-sys.path.append(os.path.join(os.path.dirname(askbot.__file__), 'deps'))
+ASKBOT_ROOT = os.path.abspath(os.path.dirname(askbot.__file__))
+site.addsitedir(os.path.join(ASKBOT_ROOT, 'deps'))
-DEBUG = False#set to True to enable debugging
+DEBUG = True#set to True to enable debugging
TEMPLATE_DEBUG = False#keep false when debugging jinja2 templates
INTERNAL_IPS = ('127.0.0.1',)
@@ -70,16 +72,19 @@ SITE_ID = 1
USE_I18N = True
LANGUAGE_CODE = 'en'
-# Absolute path to the directory that holds media.
+# Absolute path to the directory that holds uploaded media
# Example: "/home/media/media.lawrence.com/"
-ASKBOT_FILE_UPLOAD_DIR = os.path.join(os.path.dirname(__file__), 'askbot', 'upfiles')
+MEDIA_ROOT = os.path.join(os.path.dirname(__file__), 'askbot', 'upfiles')
+MEDIA_URL = '/upfiles/'
+STATIC_URL = '/m/'#this must be different from MEDIA_URL
PROJECT_ROOT = os.path.dirname(__file__)
+STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
-ADMIN_MEDIA_PREFIX = '/admin/media/'
+ADMIN_MEDIA_PREFIX = STATIC_URL + 'admin/'
# Make up some unique string, and don't share it with anybody.
SECRET_KEY = 'sdljdfjkldsflsdjkhsjkldgjlsdgfs s '
@@ -96,6 +101,7 @@ TEMPLATE_LOADERS = (
MIDDLEWARE_CLASSES = (
#'django.middleware.gzip.GZipMiddleware',
+ #'askbot.middleware.locale.LocaleMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
#'django.middleware.cache.UpdateCacheMiddleware',
'django.middleware.common.CommonMiddleware',
@@ -106,7 +112,6 @@ MIDDLEWARE_CLASSES = (
#below is askbot stuff for this tuple
'askbot.middleware.anon_user.ConnectToSessionMessagesMiddleware',
'askbot.middleware.forum_mode.ForumModeMiddleware',
- 'askbot.middleware.pagesize.QuestionsPageSizeMiddleware',
'askbot.middleware.cancel.CancelActionMiddleware',
'django.middleware.transaction.TransactionMiddleware',
#'debug_toolbar.middleware.DebugToolbarMiddleware',
@@ -134,7 +139,7 @@ DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
#TEMPLATE_DIRS = (,) #template have no effect in askbot, use the variable below
-#ASKBOT_EXTRA_SKIN_DIR = #path to your private skin collection
+#ASKBOT_EXTRA_SKINS_DIR = #path to your private skin collection
#take a look here http://askbot.org/en/question/207/
TEMPLATE_CONTEXT_PROCESSORS = (
@@ -152,6 +157,7 @@ INSTALLED_APPS = (
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
+ {{ staticfiles_app }}
#all of these are needed for the askbot
'django.contrib.admin',
@@ -170,9 +176,6 @@ INSTALLED_APPS = (
'djkombu',
'followit',
#'avatar',#experimental use git clone git://github.com/ericflo/django-avatar.git$
- #requires setting of MEDIA_ROOT and MEDIA_URL
- #values of which can be the same as ASKBOT_FILE_UPLOAD_DIR and ASKBOT_UPLOADED_FILES_URL,
- #respectively
)
@@ -181,10 +184,12 @@ INSTALLED_APPS = (
CACHE_BACKEND = 'locmem://'
#needed for django-keyedcache
CACHE_TIMEOUT = 6000
+#sets a special timeout for livesettings if you want to make them different
+LIVESETTINGS_CACHE_TIMEOUT = CACHE_TIMEOUT
CACHE_PREFIX = 'askbot' #make this unique
CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True
#If you use memcache you may want to uncomment the following line to enable memcached based sessions
-#SESSION_ENGINE = 'django.contrib.sessions.backends.cache_db'
+#SESSION_ENGINE = 'django.contrib.sessions.backends.cached_db'
AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend',
@@ -212,7 +217,6 @@ LOGIN_URL = '/%s%s%s' % (ASKBOT_URL,_('account/'),_('signin/'))
LOGIN_REDIRECT_URL = ASKBOT_URL #adjust, if needed
#note - it is important that upload dir url is NOT translated!!!
#also, this url must not have the leading slash
-ASKBOT_UPLOADED_FILES_URL = '%s%s' % (ASKBOT_URL, 'upfiles/')
ALLOW_UNICODE_SLUGS = False
ASKBOT_USE_STACKEXCHANGE_URLS = False #mimic url scheme of stackexchange
@@ -225,4 +229,10 @@ djcelery.setup_loader()
DOMAIN_NAME = '{{domain_name}}'
CSRF_COOKIE_NAME = '{{domain_name}}_csrf'
-CSRF_COOKIE_DOMAIN = DOMAIN_NAME
+#https://docs.djangoproject.com/en/1.3/ref/contrib/csrf/
+#CSRF_COOKIE_DOMAIN = DOMAIN_NAME
+
+STATIC_ROOT = os.path.join(PROJECT_ROOT, "static")
+STATICFILES_DIRS = (os.path.join(ASKBOT_ROOT, 'skins'),)
+
+RECAPTCHA_USE_SSL = True
diff --git a/askbot/setup_templates/urls.py b/askbot/setup_templates/urls.py
index 2ec69cf0..8c92f6d1 100644
--- a/askbot/setup_templates/urls.py
+++ b/askbot/setup_templates/urls.py
@@ -14,6 +14,11 @@ urlpatterns = patterns('',
(r'^settings/', include('askbot.deps.livesettings.urls')),
(r'^followit/', include('followit.urls')),
(r'^robots.txt$', include('robots.urls')),
+ url( # TODO: replace with django.conf.urls.static ?
+ r'^%s(?P<path>.*)$' % settings.MEDIA_URL[1:],
+ 'django.views.static.serve',
+ {'document_root': settings.MEDIA_ROOT.replace('\\','/')},
+ ),
)
if 'rosetta' in settings.INSTALLED_APPS: