summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--askbot/deployment/__init__.py233
-rw-r--r--askbot/deployment/path_utils.py63
-rw-r--r--askbot/deployment/template_loader.py13
-rw-r--r--askbot/doc/source/initial-configuration.rst32
-rw-r--r--askbot/setup_templates/settings.py6
-rw-r--r--askbot/setup_templates/settings.py.mustache217
-rw-r--r--askbot_requirements.txt1
-rw-r--r--setup.py1
8 files changed, 488 insertions, 78 deletions
diff --git a/askbot/deployment/__init__.py b/askbot/deployment/__init__.py
index 3f04e39d..c20e168f 100644
--- a/askbot/deployment/__init__.py
+++ b/askbot/deployment/__init__.py
@@ -2,6 +2,7 @@
module for deploying askbot
"""
import os.path
+from optparse import OptionParser
from askbot.utils import console
from askbot.deployment import messages
from askbot.deployment import path_utils
@@ -13,52 +14,121 @@ def askbot_setup():
or gives hints on how to add askbot to an existing
Django project
"""
- #ask
- print messages.DEPLOY_PREAMBLE
+ parser = OptionParser(usage="%prog [options]")
- directory = None #directory where to put stuff
- create_new = False #create new django project or not
- where_to_deploy_msg = messages.WHERE_TO_DEPLOY
- while directory is None:
+ parser.add_option("-v", "--verbose",
+ dest="verbosity",
+ type="int",
+ default=1,
+ help="verbosity level available values 0, 1, 2."
+ )
- directory = raw_input(where_to_deploy_msg + ' ')
+ parser.add_option("-n", "--dir-name",
+ dest="name",
+ default=None,
+ help="Directory where you want to install."
+ )
- where_to_deploy_msg = messages.WHERE_TO_DEPLOY_QUIT
+ parser.add_option("-d", "--db-name",
+ dest="database_name",
+ default=None,
+ help="The database name"
+ )
- directory = os.path.normpath(directory)
- directory = os.path.abspath(directory)
+ parser.add_option("-u", "--db-user",
+ dest="database_user",
+ default=None,
+ help="The database user"
+ )
- if os.path.isfile(directory):
- print messages.CANT_INSTALL_INTO_FILE % {'path':directory}
- directory = None
- continue
+ parser.add_option("-p", "--db-password",
+ dest="database_password",
+ default=None,
+ help="the database password"
+ )
- if path_utils.can_create_path(directory):
- if os.path.exists(directory):
- if path_utils.path_is_clean_for_django(directory):
- if path_utils.has_existing_django_project(directory):
- message = messages.SHOULD_ADD_APP_HERE % \
- {
- 'path': directory
- }
- should_add_app = console.choice_dialog(
- message,
- choices = ['yes','no'],
- invalid_phrase = messages.INVALID_INPUT
- )
- if should_add_app == 'yes':
- assert(create_new == False)
+ parser.add_option("--domain",
+ dest="domain_name",
+ default=None,
+ help="the domain name of the instance"
+ )
+
+ parser.add_option("--append-settings",
+ dest="local_settings",
+ default='',
+ help="Extra settings file to append custom settings"
+ )
+
+ parser.add_option("--force",
+ dest="force",
+ action='store_true',
+ help="Force overwrite settings.py file"
+ )
+
+
+ (options, args) = parser.parse_args()
+ #ask
+ if options.verbosity >= 1:
+ print messages.DEPLOY_PREAMBLE
+
+ directory = options.name #directory where to put stuff
+ create_new = False #create new django project or not
+ where_to_deploy_msg = messages.WHERE_TO_DEPLOY
+
+ if directory == None:
+ while directory is None:
+ where_to_deploy_msg = messages.WHERE_TO_DEPLOY_QUIT
+ directory = raw_input(where_to_deploy_msg + ' ')
+ directory = check_directory(directory, options)
+ if not directory:
+ continue
+
+ if path_utils.can_create_path(directory):
+ if os.path.exists(directory):
+ if path_utils.path_is_clean_for_django(directory):
+ if path_utils.has_existing_django_project(directory):
+ message = messages.SHOULD_ADD_APP_HERE % \
+ {
+ 'path': directory
+ }
+ should_add_app = console.choice_dialog(
+ message,
+ choices = ['yes','no'],
+ invalid_phrase = messages.INVALID_INPUT
+ )
+ if should_add_app == 'yes':
+ assert(create_new == False)
+ if path_utils.dir_name_acceptable(directory):
+ break
+ else:
+ print messages.format_msg_bad_dir_name(directory)
+ directory = None
+ continue
+ else:
+ directory = None
+ continue
+ else:
+ assert(directory != None)
if path_utils.dir_name_acceptable(directory):
+ create_new = True
break
else:
print messages.format_msg_bad_dir_name(directory)
directory = None
continue
- else:
- directory = None
- continue
else:
- assert(directory != None)
+ print messages.format_msg_dir_unclean_django(directory)
+ directory = None
+ continue
+ else:
+ #creates dir
+ message = messages.format_msg_create(directory)
+ should_create_new = console.choice_dialog(
+ message,
+ choices = ['yes','no'],
+ invalid_phrase = messages.INVALID_INPUT
+ )
+ if should_create_new == 'yes':
if path_utils.dir_name_acceptable(directory):
create_new = True
break
@@ -66,38 +136,85 @@ def askbot_setup():
print messages.format_msg_bad_dir_name(directory)
directory = None
continue
- else:
- print messages.format_msg_dir_unclean_django(directory)
- directory = None
- continue
- else:
- message = messages.format_msg_create(directory)
- should_create_new = console.choice_dialog(
- message,
- choices = ['yes','no'],
- invalid_phrase = messages.INVALID_INPUT
- )
- if should_create_new == 'yes':
- if path_utils.dir_name_acceptable(directory):
- create_new = True
- break
else:
- print messages.format_msg_bad_dir_name(directory)
directory = None
continue
+ else:
+ print messages.format_msg_dir_not_writable(directory)
+ directory = None
+ continue
+
+ deploy_askbot(directory, create_new, options)
+ else:
+ directory = check_directory(directory, options)
+ create_new = True
+ if directory==None:
+ raise Exception("the directory you choosed is invalid")
+ #TODO middle steps!
+ if path_utils.can_create_path(directory):
+ if os.path.exists(directory):
+ if path_utils.path_is_clean_for_django(directory):
+ if path_utils.has_existing_django_project(directory):
+ if options.verbosity >= 1:
+ print "Integrating askbot to your current app"
+ create_new=False
+ else:
+ assert(directory != None)
+ if path_utils.dir_name_acceptable(directory):
+ pass
+ else:
+ raise Exception(messages.format_msg_bad_dir_name(directory))
+ else:
+ raise Exception(messages.format_msg_dir_unclean_django(directory))
+ else:
+ if path_utils.dir_name_acceptable(directory):
+ pass
else:
- directory = None
- continue
+ raise Exception(messages.format_msg_bad_dir_name(directory))
else:
- print messages.format_msg_dir_not_writable(directory)
- directory = None
- continue
+ raise Exception(messages.format_msg_dir_not_writable(directory))
+
+ deploy_askbot(directory, create_new, options)
+
+#separated all the directory creation process to make it more useful
+def deploy_askbot(directory, create_new, options):
+ '''function that copies the templates'''
help_file = path_utils.get_path_to_help_file()
+ context = {'database_name': options.database_name,
+ 'database_password': options.database_password,
+ 'database_user': options.database_user,
+ 'domain_name': options.domain_name,
+ 'local_settings': options.local_settings,
+ }
+ for key in context.keys():
+ if context[key] == None:
+ input_message = 'Please enter a value for %s:' % (key.replace('_', ' '))
+ new_value = raw_input(input_message)
+ context[key] = new_value
+
+ if options.force:
+ create_new = options.force
+
if create_new:
path_utils.create_path(directory)
- path_utils.deploy_into(directory, new_project = True)
- print messages.HOW_TO_DEPLOY_NEW % {'help_file': help_file}
+ path_utils.deploy_into(directory, new_project = True,
+ verbosity = options.verbosity, context = context)
+ if options.verbosity >= 1:
+ print messages.HOW_TO_DEPLOY_NEW % {'help_file': help_file}
else:
- path_utils.deploy_into(directory, new_project = False)
- print messages.HOW_TO_ADD_ASKBOT_TO_DJANGO % {'help_file': help_file}
+ path_utils.deploy_into(directory, new_project = False,
+ verbosity = options.verbosity, context = context)
+ if options.verbosity >= 1:
+ print messages.HOW_TO_ADD_ASKBOT_TO_DJANGO % {'help_file': help_file}
+
+def check_directory(directory, options):
+ directory = os.path.normpath(directory)
+ directory = os.path.abspath(directory)
+
+ if os.path.isfile(directory):
+ directory = None
+ if options.verbosity >= 1:
+ print messages.CANT_INSTALL_INTO_FILE % {'path':directory}
+
+ return directory
diff --git a/askbot/deployment/path_utils.py b/askbot/deployment/path_utils.py
index 6ad9fc99..676f8bf8 100644
--- a/askbot/deployment/path_utils.py
+++ b/askbot/deployment/path_utils.py
@@ -1,5 +1,5 @@
"""utilities in addition to os.path
-that
+that
* help to test existing paths on usability for the installation
* create necessary directories
* install deployment files
@@ -11,6 +11,7 @@ import re
import glob
import shutil
import imp
+from askbot.deployment.template_loader import SettingsTemplate
def split_at_break_point(directory):
"""splits directory path into two pieces
@@ -47,7 +48,7 @@ def directory_is_writable(directory):
def can_create_path(directory):
- """returns True if user can write file into
+ """returns True if user can write file into
directory even if it does not exist yet
and False otherwise
"""
@@ -123,24 +124,31 @@ def get_path_to_help_file():
"""returns path to the main plain text help file"""
return os.path.join(SOURCE_DIR, 'doc', 'INSTALL')
-def deploy_into(directory, new_project = None):
+def deploy_into(directory, new_project = None, verbosity=1, context=None):
"""will copy necessary files into the directory
"""
assert(new_project is not None)
if new_project:
- copy_files = ('__init__.py', 'settings.py', 'manage.py', 'urls.py')
+ copy_files = ('__init__.py', 'manage.py', 'urls.py')
blank_files = ('__init__.py', 'manage.py')
- print 'Copying files: '
+ if verbosity >=1:
+ print 'Copying files: '
for file_name in copy_files:
src = os.path.join(SOURCE_DIR, 'setup_templates', file_name)
if os.path.exists(os.path.join(directory, file_name)):
if file_name in blank_files:
continue
else:
- print '* %s' % file_name,
- print "- you already have one, please add contents of %s" % src
+ if file_name == 'urls.py' and new_project:
+ #overwrite urls.py
+ shutil.copy(src, directory)
+ else:
+ if verbosity >=1:
+ print '* %s' % file_name,
+ print "- you already have one, please add contents of %s" % src
else:
- print '* %s ' % file_name
+ if verbosity >=1:
+ print '* %s ' % file_name
shutil.copy(src, directory)
#copy log directory
src = os.path.join(SOURCE_DIR, 'setup_templates', 'log')
@@ -148,7 +156,29 @@ def deploy_into(directory, new_project = None):
create_path(log_dir)
touch(os.path.join(log_dir, 'askbot.log'))
- print ''
+ #creating settings file from template
+ if verbosity>=1:
+ print "Creating settings file"
+ settings_contents = SettingsTemplate(context).render()
+ settings_path = os.path.join(directory, 'settings.py')
+ if os.path.exists(settings_path) and new_project==False:
+ if verbosity>=1:
+ print "* you already have a settings file please merge the contents"
+ else:
+ settings_file = open(settings_path, 'w+')
+ settings_file.write(settings_contents)
+ #Grab the file!
+ if os.path.exists(context['local_settings']):
+ local_settings = open(context['local_settings'], 'r').read()
+ settings_file.write('\n')
+ settings_file.write(local_settings)
+
+ settings_file.close()
+ if verbosity>=1:
+ print "settings file created"
+
+ if verbosity >=1:
+ print ''
app_dir = os.path.join(directory, 'askbot')
copy_dirs = ('doc', 'cron', 'upfiles')
@@ -158,17 +188,22 @@ def deploy_into(directory, new_project = None):
dst = os.path.join(app_dir, dir_name)
if os.path.abspath(src) != os.path.abspath(dst):
if dirs_copied == 0:
- print 'copying directories: ',
- print '* ' + dir_name
+ if verbosity >=1:
+ print 'copying directories: ',
+ if verbosity >=1:
+ print '* ' + dir_name
if os.path.exists(dst):
if os.path.isdir(dst):
- print 'Directory %s not empty - skipped' % dst
+ if verbosity >=1:
+ print 'Directory %s not empty - skipped' % dst
else:
- print 'File %s already exists - skipped' % dst
+ if verbosity >=1:
+ print 'File %s already exists - skipped' % dst
continue
shutil.copytree(src, dst)
dirs_copied += 1
- print ''
+ if verbosity >=1:
+ print ''
def dir_name_acceptable(directory):
"""True if directory is not taken by another python module"""
diff --git a/askbot/deployment/template_loader.py b/askbot/deployment/template_loader.py
new file mode 100644
index 00000000..fe7c11e6
--- /dev/null
+++ b/askbot/deployment/template_loader.py
@@ -0,0 +1,13 @@
+import os
+import pystache
+
+SOURCE_DIR = os.path.dirname(os.path.dirname(__file__))
+
+class SettingsTemplate(pystache.View):
+ '''Class for settings'''
+
+ template_path = os.path.join(SOURCE_DIR, 'setup_templates')
+ template_name = "settings.py"
+
+ def __init__(self, context, **kwargs):
+ super(SettingsTemplate, self).__init__(context=context, **kwargs)
diff --git a/askbot/doc/source/initial-configuration.rst b/askbot/doc/source/initial-configuration.rst
index 0cd2c033..340324a1 100644
--- a/askbot/doc/source/initial-configuration.rst
+++ b/askbot/doc/source/initial-configuration.rst
@@ -29,10 +29,38 @@ There may be an error message; ignore it.
`askbot-setup` adds those files to the directory you select (and some more things specific to Askbot).
+.. versionadded:: 0.7.24
+ `askbot-setup` also have command line arguments such as folder name(name), database name, database password and database user also added verbosity support.
+ You can also specify a local settings file to append it's contents to the deployment settings file.
+
+ +----------------------------------+------------------------------------------------------------+
+ | Parameter | Purpose |
+ +==================================+============================================================+
+ | -n <NAME> | Name of the instance, this is the name that the |
+ | | folder will use. |
+ +----------------------------------+------------------------------------------------------------+
+ | -d <DATABASE_NAME> | The database name that the instance will use. |
+ +----------------------------------+------------------------------------------------------------+
+ | -u <DATABASE_USER> | The database user that the instance will use. |
+ +----------------------------------+------------------------------------------------------------+
+ | -p <DATABASE_PASSWORD> | The database password for the user. |
+ +----------------------------------+------------------------------------------------------------+
+ | --domain=<DOMAIN_NAME> | Domain name for the application. |
+ +----------------------------------+------------------------------------------------------------+
+ | --append-settings=<SETTINGS_FILE>| Allows to append a setting file content to the |
+ | | settings file, the parameter is the file to use. |
+ +----------------------------------+------------------------------------------------------------+
+
+
+.. note::
+
+ `askbot-setup` command line arguments detail parameter is available when you type: askbot-setup --h.
Note that if you already have a Django site you will not want to use `askbot-setup`, because you don't want to just overwrite your existing settings.py. See below for instructions.
-Another thing you have to do if you are creating a brand new Django project is edit the file `settings.py`_. At the very minimum, you will need to provide the correct values to::
+Another thing you have to do if you are creating a brand new Django project is edit the file `settings.py`_. At the very minimum, you will need to provide the correct values to some settings.
+
+All values must be enclosed in single quotes, as shown below::
DATABASE_ENGINE = '' #e.g. 'mysql'
DATABASE_NAME = '' #name of the database you created, e.g. 'askbot'.
@@ -40,8 +68,6 @@ Another thing you have to do if you are creating a brand new Django project is e
DATABASE_PASSWORD = '' #password to the database
CSRF_COOKIE_DOMAIN = ''#e.g. 'example.com' or 'askbot.example.com' (localhost/IP address for tests)
-All values must be enclosed in single quotes, as shown above.
-
.. note::
The files settings.py_ and urls.py_ may also need to be touched up
diff --git a/askbot/setup_templates/settings.py b/askbot/setup_templates/settings.py
index a97402aa..83fe9997 100644
--- a/askbot/setup_templates/settings.py
+++ b/askbot/setup_templates/settings.py
@@ -40,7 +40,7 @@ EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
#go to the site's live settings and enable the feature
#"Email settings" -> "allow asking by email"
#
-# WARNING: command post_emailed_questions DELETES all
+# WARNING: command post_emailed_questions DELETES all
# emails from the mailbox each time
# do not use your personal mail box here!!!
#
@@ -78,7 +78,7 @@ PROJECT_ROOT = os.path.dirname(__file__)
ADMIN_MEDIA_PREFIX = '/admin/media/'
# Make up some unique string, and don't share it with anybody.
-SECRET_KEY = 'sdljdfjkldsflsdjkhsjkldgjlsdgfs s '
+SECRET_KEY = 'sdljdfjkldsflsdjkhsjkldgjlsdgfs s '
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
@@ -116,7 +116,7 @@ ROOT_URLCONF = os.path.basename(os.path.dirname(__file__)) + '.urls'
#UPLOAD SETTINGS
FILE_UPLOAD_TEMP_DIR = os.path.join(
- os.path.dirname(__file__),
+ os.path.dirname(__file__),
'tmp'
).replace('\\','/')
diff --git a/askbot/setup_templates/settings.py.mustache b/askbot/setup_templates/settings.py.mustache
new file mode 100644
index 00000000..ad954734
--- /dev/null
+++ b/askbot/setup_templates/settings.py.mustache
@@ -0,0 +1,217 @@
+## Django settings for ASKBOT enabled project.
+import os.path
+import logging
+import sys
+import askbot
+
+#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'))
+
+DEBUG = False#set to True to enable debugging
+TEMPLATE_DEBUG = False#keep false when debugging jinja2 templates
+INTERNAL_IPS = ('127.0.0.1',)
+
+ADMINS = (
+ ('Your Name', 'your_email@domain.com'),
+)
+
+MANAGERS = ADMINS
+
+DATABASE_ENGINE = 'postgresql_psycopg2' # only postgres (>8.3) and mysql are supported so far others have not been tested yet
+DATABASE_NAME = '{{database_name}}' # Or path to database file if using sqlite3.
+DATABASE_USER = '{{database_user}}' # Not used with sqlite3.
+DATABASE_PASSWORD = '{{database_password}}' # Not used with sqlite3.
+DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
+DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
+
+#outgoing mail server settings
+SERVER_EMAIL = ''
+DEFAULT_FROM_EMAIL = ''
+EMAIL_HOST_USER = ''
+EMAIL_HOST_PASSWORD = ''
+EMAIL_SUBJECT_PREFIX = ''
+EMAIL_HOST=''
+EMAIL_PORT=''
+EMAIL_USE_TLS=False
+EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
+
+#incoming mail settings
+#after filling out these settings - please
+#go to the site's live settings and enable the feature
+#"Email settings" -> "allow asking by email"
+#
+# WARNING: command post_emailed_questions DELETES all
+# emails from the mailbox each time
+# do not use your personal mail box here!!!
+#
+IMAP_HOST = ''
+IMAP_HOST_USER = ''
+IMAP_HOST_PASSWORD = ''
+IMAP_PORT = ''
+IMAP_USE_TLS = False
+
+# 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.
+# On Unix systems, a value of None will cause Django to use the same
+# timezone as the operating system.
+# If running in a Windows environment this must be set to the same as your
+# system time zone.
+TIME_ZONE = 'America/Chicago'
+
+SITE_ID = 1
+
+# If you set this to False, Django will make some optimizations so as not
+# to load the internationalization machinery.
+USE_I18N = True
+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')
+
+PROJECT_ROOT = os.path.dirname(__file__)
+
+# 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/'
+
+# Make up some unique string, and don't share it with anybody.
+SECRET_KEY = 'sdljdfjkldsflsdjkhsjkldgjlsdgfs s '
+
+# List of callables that know how to import templates from various sources.
+TEMPLATE_LOADERS = (
+ 'django.template.loaders.filesystem.load_template_source',
+ 'django.template.loaders.app_directories.load_template_source',
+ #below is askbot stuff for this tuple
+ 'askbot.skins.loaders.filesystem_load_template_source',
+ #'django.template.loaders.eggs.load_template_source',
+)
+
+
+MIDDLEWARE_CLASSES = (
+ #'django.middleware.gzip.GZipMiddleware',
+ 'django.contrib.sessions.middleware.SessionMiddleware',
+ #'django.middleware.cache.UpdateCacheMiddleware',
+ 'django.middleware.common.CommonMiddleware',
+ #'django.middleware.cache.FetchFromCacheMiddleware',
+ 'django.contrib.auth.middleware.AuthenticationMiddleware',
+ #'django.middleware.sqlprint.SqlPrintingMiddleware',
+
+ #below is askbot stuff for this tuple
+ 'askbot.middleware.anon_user.ConnectToSessionMessagesMiddleware',
+ 'askbot.middleware.pagesize.QuestionsPageSizeMiddleware',
+ 'askbot.middleware.cancel.CancelActionMiddleware',
+ 'django.middleware.transaction.TransactionMiddleware',
+ #'debug_toolbar.middleware.DebugToolbarMiddleware',
+ 'askbot.middleware.view_log.ViewLogMiddleware',
+ 'askbot.middleware.spaceless.SpacelessMiddleware',
+)
+
+
+ROOT_URLCONF = os.path.basename(os.path.dirname(__file__)) + '.urls'
+
+
+#UPLOAD SETTINGS
+FILE_UPLOAD_TEMP_DIR = os.path.join(
+ os.path.dirname(__file__),
+ 'tmp'
+ ).replace('\\','/')
+
+FILE_UPLOAD_HANDLERS = (
+ 'django.core.files.uploadhandler.MemoryFileUploadHandler',
+ 'django.core.files.uploadhandler.TemporaryFileUploadHandler',
+)
+ASKBOT_ALLOWED_UPLOAD_FILE_TYPES = ('.jpg', '.jpeg', '.gif', '.bmp', '.png', '.tiff')
+ASKBOT_MAX_UPLOAD_FILE_SIZE = 1024 * 1024 #result in bytes
+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
+#take a look here http://askbot.org/en/question/207/
+
+TEMPLATE_CONTEXT_PROCESSORS = (
+ 'django.core.context_processors.request',
+ 'askbot.context.application_settings',
+ #'django.core.context_processors.i18n',
+ 'askbot.user_messages.context_processors.user_messages',#must be before auth
+ 'django.core.context_processors.auth', #this is required for admin
+ 'django.core.context_processors.csrf', #necessary for csrf protection
+)
+
+
+INSTALLED_APPS = (
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+ 'django.contrib.sessions',
+ 'django.contrib.sites',
+
+ #all of these are needed for the askbot
+ 'django.contrib.admin',
+ 'django.contrib.humanize',
+ 'django.contrib.sitemaps',
+ #'debug_toolbar',
+ 'askbot',
+ 'askbot.deps.django_authopenid',
+ #'askbot.importers.stackexchange', #se loader
+ 'south',
+ 'askbot.deps.livesettings',
+ 'keyedcache',
+ 'robots',
+ 'django_countries',
+ 'djcelery',
+ 'djkombu',
+ 'followit',
+ #'avatar',#experimental use git clone git://github.com/ericflo/django-avatar.git$
+ #requires setting of MEDIA_ROOT and MEDIA_URL
+)
+
+
+#setup memcached for production use!
+#see http://docs.djangoproject.com/en/1.1/topics/cache/ for details
+CACHE_BACKEND = 'locmem://'
+#needed for django-keyedcache
+CACHE_TIMEOUT = 6000
+CACHE_PREFIX = 'askbot' #make this unique
+#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'
+
+AUTHENTICATION_BACKENDS = (
+ 'django.contrib.auth.backends.ModelBackend',
+ 'askbot.deps.django_authopenid.backends.AuthBackend',
+)
+
+#logging settings
+LOG_FILENAME = 'askbot.log'
+logging.basicConfig(
+ filename=os.path.join(os.path.dirname(__file__), 'log', LOG_FILENAME),
+ level=logging.CRITICAL,
+ format='%(pathname)s TIME: %(asctime)s MSG: %(filename)s:%(funcName)s:%(lineno)d %(message)s',
+)
+
+###########################
+#
+# this will allow running your forum with url like http://site.com/forum
+#
+# ASKBOT_URL = 'forum/'
+#
+ASKBOT_URL = '' #no leading slash, default = '' empty string
+_ = lambda v:v #fake translation function for the login url
+LOGIN_URL = '/%s%s%s' % (ASKBOT_URL,_('account/'),_('signin/'))
+#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
+
+#Celery Settings
+BROKER_BACKEND = "djkombu.transport.DatabaseTransport"
+CELERY_ALWAYS_EAGER = True
+
+import djcelery
+djcelery.setup_loader()
+
+CSRF_COOKIE_NAME = '{{domain_name}}_scrf'
+CSRF_COOKIE_DOMAIN = '{{domain_name}}'#enter domain name here - e.g. example.com
diff --git a/askbot_requirements.txt b/askbot_requirements.txt
index a1d3b603..fc11d9d1 100644
--- a/askbot_requirements.txt
+++ b/askbot_requirements.txt
@@ -16,3 +16,4 @@ django-kombu==0.9.2
django-followit
django-recaptcha-works
python-openid
+pystache==0.3.1
diff --git a/setup.py b/setup.py
index 71ed2abb..253f9db9 100644
--- a/setup.py
+++ b/setup.py
@@ -25,6 +25,7 @@ install_requires = [
'django-followit',
'django-recaptcha-works',
'python-openid',
+ 'pystache==0.3.1',
]
import askbot