initial commit
This commit is contained in:
commit
a774dd5818
|
@ -0,0 +1,48 @@
|
|||
# Define: askbot::site
|
||||
#
|
||||
# This class installs the Ruby based bundler command and compiles
|
||||
# the Sass files of a custom theme. The theme must contain a
|
||||
# proper Gemfile to define compass version and dependencies.
|
||||
#
|
||||
# Actions:
|
||||
# - Install Ruby / Compass
|
||||
# - Compile Sass files into Css stylesheets
|
||||
#
|
||||
define askbot::compass(
|
||||
) {
|
||||
# add ruby, bundler packages if not defined somewhere else
|
||||
if ! defined(Package['rubygems']) {
|
||||
package { 'rubygems':
|
||||
ensure => present,
|
||||
}
|
||||
}
|
||||
|
||||
if ! defined(Package['bundler']) {
|
||||
package { 'bundler':
|
||||
ensure => latest,
|
||||
provider => gem,
|
||||
require => Package['rubygems'],
|
||||
}
|
||||
}
|
||||
|
||||
# install bundle requirements in Gemfiles, compile Sass
|
||||
exec { "theme-bundle-install-${name}":
|
||||
cwd => "/srv/askbot-sites/${name}/themes",
|
||||
path => ['/bin', '/usr/bin', '/sbin', '/usr/sbin', '/usr/local/bin'],
|
||||
logoutput => on_failure,
|
||||
command => 'bundle install',
|
||||
require => Package['bundler'],
|
||||
refreshonly => true,
|
||||
}
|
||||
|
||||
exec { "theme-bundle-compile-${name}":
|
||||
cwd => "/srv/askbot-sites/${name}/themes",
|
||||
path => ['/bin', '/usr/bin', '/sbin', '/usr/sbin', '/usr/local/bin'],
|
||||
logoutput => on_failure,
|
||||
command => 'bundle exec compass compile',
|
||||
require => Exec["theme-bundle-install-${name}"],
|
||||
refreshonly => true,
|
||||
notify => Exec["askbot-static-generate-${name}"],
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
# Class: askbot
|
||||
#
|
||||
# This class installs Askbot and main dependencies, like
|
||||
# postgresql or mysql driver, and other django libraries.
|
||||
# (django-redis-cache, django-haystack, pysolr, stopforumspam)
|
||||
#
|
||||
# Parameters:
|
||||
# - $db_provider: database provider (mysql | pgsql)
|
||||
# - $askbot_version: pip package version of askbot
|
||||
# - $redis_enabled: set to true if askbot using redis for cache
|
||||
#
|
||||
# Actions:
|
||||
# - Install Askbot
|
||||
# - Install Askbot dependencies
|
||||
#
|
||||
class askbot (
|
||||
$db_provider = 'mysql',
|
||||
$askbot_version = '0.7.50',
|
||||
$redis_enabled = false,
|
||||
) {
|
||||
include apache::mod::wsgi
|
||||
|
||||
case $db_provider {
|
||||
'mysql': {
|
||||
$package_deps = [ 'python-pip', 'python-dev', 'python-mysqldb' ]
|
||||
}
|
||||
'pgsql': {
|
||||
$package_deps = [ 'python-pip', 'python-dev', 'python-psycopg2' ]
|
||||
}
|
||||
default: {
|
||||
fail("Unsupported database provider: ${db_provider}")
|
||||
}
|
||||
}
|
||||
|
||||
package { $package_deps:
|
||||
ensure => present,
|
||||
}
|
||||
|
||||
if $redis_enabled {
|
||||
package { 'django-redis-cache':
|
||||
ensure => present,
|
||||
provider => 'pip',
|
||||
before => Package['askbot'],
|
||||
}
|
||||
}
|
||||
|
||||
package { [ 'django-haystack', 'pysolr' ]:
|
||||
ensure => present,
|
||||
provider => 'pip',
|
||||
before => Package['askbot'],
|
||||
}
|
||||
|
||||
package { 'stopforumspam':
|
||||
ensure => present,
|
||||
provider => 'pip',
|
||||
before => Package['askbot'],
|
||||
}
|
||||
|
||||
package { 'askbot':
|
||||
ensure => $askbot_version,
|
||||
provider => 'pip',
|
||||
require => Package[$package_deps],
|
||||
}
|
||||
|
||||
file { '/srv/askbot-sites':
|
||||
ensure => directory,
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0755',
|
||||
}
|
||||
}
|
|
@ -0,0 +1,285 @@
|
|||
# Class: askbot::site
|
||||
#
|
||||
# This class installs an Askbot site.
|
||||
#
|
||||
# Parameters:
|
||||
# - $slot_name: slot name under /srv/askbot-sites
|
||||
# (Notice: don't use ask as a slot name)
|
||||
# - $www_group: group name for web writeable directories like upfiles and log
|
||||
# - $www_user: user name for web process
|
||||
# - $askbot_debug: set to true to enable askbot debug mode
|
||||
#
|
||||
# Custom askbot theme settings:
|
||||
# - $custom_theme_enabled: set to true to enable custom themes, default: false
|
||||
# - $custom_theme_name: name of custom theme set to default
|
||||
#
|
||||
# Redis configuration:
|
||||
# - $redis_enabled: set to true to use redis as cache backend
|
||||
# - $redis_prefix: redis key prefix (required for multi-site setups)
|
||||
# - $redis_port: port of redis service
|
||||
# - $redis_max_memory: memory allocation for redis
|
||||
# - $redis_bind: bind address of redis service
|
||||
# - $redis_password: password required for redis connection
|
||||
#
|
||||
# SSL Settings:
|
||||
# - $site_ssl_enabled: set to true for SSL based vhost
|
||||
# - $site_ssl_cert_file_contents: x509 certificate in pem format
|
||||
# - $site_ssl_key_file_contents: the key of site certificate in pem format
|
||||
# - $site_ssl_chain_file_contents: the issuer certs of site cert (optional)
|
||||
# - $site_ssl_cert_file: file name of site certificate
|
||||
# - $site_ssl_key_file: file name of the site certificate's key file
|
||||
# - $site_ssl_chain_file: file name of the issuer certificates
|
||||
#
|
||||
# Email configuration:
|
||||
# - $smtp_host: hostname of smtp service used for email sending
|
||||
# - $smtp_port: port of smtp service
|
||||
#
|
||||
# Database provider and connection details:
|
||||
# - $db_provider: database provider (mysql or pgsql)
|
||||
# - $db_name: database name
|
||||
# - $db_user: user name required for db connection
|
||||
# - $db_password: password required for db connection
|
||||
# - $db_host: database host
|
||||
#
|
||||
# Actions:
|
||||
# - Install an Askbot site
|
||||
# - Sync and migrate database schema
|
||||
# - Install askbot-celeryd daemon
|
||||
# - Setup log rotatation for application logs
|
||||
#
|
||||
define askbot::site (
|
||||
$www_user = 'www-data',
|
||||
$www_group = 'www-data',
|
||||
$slot_name = 'slot0',
|
||||
$custom_theme_enabled = false,
|
||||
$custom_theme_name = undef,
|
||||
$askbot_debug = false,
|
||||
$redis_enabled = false,
|
||||
$redis_prefix = 'askbot',
|
||||
$redis_port = undef,
|
||||
$redis_max_memory = undef,
|
||||
$redis_bind = undef,
|
||||
$redis_password = undef,
|
||||
$site_ssl_enabled = false,
|
||||
$site_ssl_cert_file_contents = undef,
|
||||
$site_ssl_key_file_contents = undef,
|
||||
$site_ssl_chain_file_contents = undef,
|
||||
$site_ssl_cert_file = '',
|
||||
$site_ssl_key_file = '',
|
||||
$site_ssl_chain_file = '',
|
||||
$smtp_host = 'localhost',
|
||||
$smtp_port = '25',
|
||||
$db_provider = 'mysql',
|
||||
$db_name = undef,
|
||||
$db_user = undef,
|
||||
$db_password = undef,
|
||||
$db_host = 'localhost',
|
||||
) {
|
||||
# ensure askbot base class is included
|
||||
if ! defined(Class['askbot']) {
|
||||
fail('You must include the askbot base class before using any askbot defined resources')
|
||||
}
|
||||
|
||||
case $db_provider {
|
||||
'mysql': {
|
||||
$db_engine = 'django.db.backends.mysql'
|
||||
}
|
||||
'pgsql': {
|
||||
$db_engine = 'django.db.backends.postgresql_psycopg2'
|
||||
}
|
||||
default: {
|
||||
fail("Unsupported database provider: ${db_provider}")
|
||||
}
|
||||
}
|
||||
|
||||
$askbot_site_root = "/srv/askbot-sites/${slot_name}"
|
||||
|
||||
# ssl certificates
|
||||
if $site_ssl_enabled == true {
|
||||
|
||||
include apache::ssl
|
||||
|
||||
# site x509 certificate
|
||||
if $site_ssl_cert_file_contents != '' {
|
||||
file { $site_ssl_cert_file:
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0640',
|
||||
content => $site_ssl_cert_file_contents,
|
||||
before => Apache::Vhost[$name],
|
||||
}
|
||||
}
|
||||
|
||||
# site ssl key
|
||||
if $site_ssl_key_file_contents != '' {
|
||||
file { $site_ssl_key_file:
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0640',
|
||||
content => $site_ssl_key_file_contents,
|
||||
before => Apache::Vhost[$name],
|
||||
}
|
||||
}
|
||||
|
||||
# site ca certificates file
|
||||
if $site_ssl_chain_file_contents != '' {
|
||||
file { $site_ssl_chain_file:
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0640',
|
||||
content => $site_ssl_chain_file_contents,
|
||||
before => Apache::Vhost[$name],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# site directory layout
|
||||
if ! defined(File[$askbot_site_root]) {
|
||||
file { $askbot_site_root:
|
||||
ensure => directory,
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0755',
|
||||
}
|
||||
}
|
||||
|
||||
file { "${askbot_site_root}/log":
|
||||
ensure => directory,
|
||||
owner => 'root',
|
||||
group => $www_group,
|
||||
mode => '0775',
|
||||
require => File[$askbot_site_root],
|
||||
}
|
||||
|
||||
# if not exists, create empty log file with
|
||||
# www-data group write access
|
||||
file { "${askbot_site_root}/log/askbot.log":
|
||||
ensure => present,
|
||||
replace => 'no',
|
||||
owner => 'root',
|
||||
group => $www_group,
|
||||
mode => '0664',
|
||||
require => File["${askbot_site_root}/log"],
|
||||
}
|
||||
|
||||
file { "${askbot_site_root}/upfiles":
|
||||
ensure => directory,
|
||||
owner => 'root',
|
||||
group => $www_group,
|
||||
mode => '0775',
|
||||
require => File[$askbot_site_root],
|
||||
}
|
||||
|
||||
file { "${askbot_site_root}/static":
|
||||
ensure => directory,
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0755',
|
||||
require => File[$askbot_site_root],
|
||||
}
|
||||
|
||||
file { "${askbot_site_root}/config":
|
||||
ensure => directory,
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0755',
|
||||
require => File[$askbot_site_root],
|
||||
}
|
||||
|
||||
# askbot setup_templates
|
||||
# copy template files from askbot's setup_templates into site config
|
||||
$setup_templates = [ '__init__.py', 'manage.py', 'urls.py', 'django.wsgi']
|
||||
askbot::template_file { $setup_templates:
|
||||
template_path => '/usr/local/lib/python2.7/dist-packages/askbot/setup_templates',
|
||||
dest_dir => "${askbot_site_root}/config",
|
||||
require => File["${askbot_site_root}/config"],
|
||||
}
|
||||
|
||||
# askbot settings
|
||||
file { "${askbot_site_root}/config/settings.py":
|
||||
ensure => present,
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0644',
|
||||
content => template('askbot/settings.py.erb'),
|
||||
require => File["${askbot_site_root}/config"],
|
||||
}
|
||||
|
||||
# post-configuration
|
||||
Exec {
|
||||
path => ['/bin', '/usr/bin', '/sbin', '/usr/sbin'],
|
||||
logoutput => on_failure,
|
||||
}
|
||||
|
||||
$post_config_dependency = [
|
||||
File["${askbot_site_root}/static"],
|
||||
File["${askbot_site_root}/log"],
|
||||
Askbot::Template_file[ $setup_templates ],
|
||||
File["${askbot_site_root}/config/settings.py"],
|
||||
Package['askbot'],
|
||||
]
|
||||
|
||||
exec { "askbot-static-generate-${slot_name}":
|
||||
cwd => "${askbot_site_root}/config",
|
||||
command => 'python manage.py collectstatic --noinput',
|
||||
require => $post_config_dependency,
|
||||
subscribe => File["${askbot_site_root}/config/settings.py"],
|
||||
refreshonly => true,
|
||||
}
|
||||
|
||||
exec { "askbot-syncdb-${slot_name}":
|
||||
cwd => "${askbot_site_root}/config",
|
||||
command => 'python manage.py syncdb --noinput',
|
||||
require => $post_config_dependency,
|
||||
subscribe => File["${askbot_site_root}/config/settings.py"],
|
||||
refreshonly => true,
|
||||
}
|
||||
|
||||
exec { "askbot-migrate-${slot_name}":
|
||||
cwd => "${askbot_site_root}/config",
|
||||
command => 'python manage.py migrate --noinput',
|
||||
require => Exec["askbot-syncdb-${slot_name}"],
|
||||
subscribe => File["${askbot_site_root}/config/settings.py"],
|
||||
refreshonly => true,
|
||||
notify => [ Service['httpd'], Service['askbot-celeryd'] ],
|
||||
}
|
||||
|
||||
apache::vhost { $name:
|
||||
port => 80,
|
||||
priority => 10,
|
||||
docroot => $askbot_site_root,
|
||||
require => Exec["askbot-migrate-${slot_name}"],
|
||||
template => 'askbot/askbot.vhost.erb',
|
||||
}
|
||||
|
||||
file { '/etc/init/askbot-celeryd.conf':
|
||||
ensure => present,
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0644',
|
||||
content => template('askbot/celeryd.upstart.conf.erb'),
|
||||
require => Exec["askbot-migrate-${slot_name}"],
|
||||
}
|
||||
|
||||
service { 'askbot-celeryd':
|
||||
ensure => running,
|
||||
enable => true,
|
||||
hasrestart => true,
|
||||
require => File['/etc/init/askbot-celeryd.conf'],
|
||||
}
|
||||
|
||||
include logrotate
|
||||
logrotate::file { "askbot-${slot_name}.log":
|
||||
log => "${askbot_site_root}/askbot.log",
|
||||
options => [
|
||||
'compress',
|
||||
'copytruncate',
|
||||
'missingok',
|
||||
'rotate 7',
|
||||
'daily',
|
||||
'notifempty',
|
||||
],
|
||||
require => [ Service['httpd'], File["${askbot_site_root}/log/askbot.log"] ],
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
# Define: askbot::template_file
|
||||
#
|
||||
# Define a setup_templates file, cloned from a template
|
||||
# directory.
|
||||
#
|
||||
# Parameters:
|
||||
# - $template_path: root directory of setup_templates.
|
||||
# - $dest_dir: destination directory of target files.
|
||||
#
|
||||
define askbot::template_file (
|
||||
$template_path = undef,
|
||||
$dest_dir = undef,
|
||||
) {
|
||||
file { "${dest_dir}/${name}":
|
||||
ensure => present,
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0644',
|
||||
source => "${template_path}/${name}",
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
# ************************************
|
||||
# Askbot vhost template
|
||||
# Managed by Puppet
|
||||
# ************************************
|
||||
|
||||
WSGIRestrictStdout On
|
||||
WSGIRestrictSignal Off
|
||||
|
||||
NameVirtualHost <%= @vhost_name %>:80
|
||||
<VirtualHost <%= @vhost_name %>:80>
|
||||
<% if @site_ssl_enabled %>
|
||||
ServerName <%= @srvname %>
|
||||
Redirect / https://<%= @srvname %>/
|
||||
</VirtualHost>
|
||||
|
||||
NameVirtualHost <%= @vhost_name %>:443
|
||||
<VirtualHost <%= @vhost_name %>:443>
|
||||
SSLEngine on
|
||||
SSLProtocol All -SSLv2 -SSLv3
|
||||
SSLCertificateFile <%= @site_ssl_cert_file %>
|
||||
SSLCertificateKeyFile <%= @site_ssl_key_file %>
|
||||
<% if @site_ssl_chain_file_contents %>
|
||||
SSLCertificateChainFile <%= @site_ssl_chain_file %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
ServerName <%= @srvname %>
|
||||
# DocumentRoot <%= @docroot %>
|
||||
|
||||
# media files
|
||||
Alias /m/ <%= @docroot %>/static/
|
||||
<Directory <%= @docroot %>/static/>
|
||||
Order deny,allow
|
||||
Allow from all
|
||||
</Directory>
|
||||
|
||||
# uploaded files
|
||||
Alias /upfiles/ <%= @docroot %>/upfiles/
|
||||
<Directory <%= @docroot %>/upfiles/>
|
||||
Order deny,allow
|
||||
Allow from all
|
||||
</Directory>
|
||||
|
||||
# wsgi daemon
|
||||
WSGIDaemonProcess askbot user=<%= @www_user %> group=<%= @www_group %> maximum-requests=1000 display-name=askbot processes=2 threads=1 shutdown-timeout=10 python-path=<%= @docroot %>
|
||||
|
||||
WSGIScriptAlias / <%= @docroot %>/config/django.wsgi
|
||||
|
||||
<Location />
|
||||
WSGIProcessGroup askbot
|
||||
Order deny,allow
|
||||
Allow from all
|
||||
</Location>
|
||||
|
||||
ErrorLog /var/log/apache2/<%= @name %>_error.log
|
||||
LogLevel warn
|
||||
CustomLog /var/log/apache2/<%= @name %>_access.log combined
|
||||
ServerSignature Off
|
||||
</VirtualHost>
|
|
@ -0,0 +1,12 @@
|
|||
description "Askbot celeryd service"
|
||||
author "Marton Kiss <marton.kiss@gmail.com>"
|
||||
|
||||
start on runlevel [2345]
|
||||
stop on runlevel [016]
|
||||
|
||||
kill timeout 30
|
||||
respawn
|
||||
script
|
||||
chdir /srv/askbot-sites/<%= @slot_name %>/config
|
||||
exec su -s /bin/sh -c 'exec "$0" "$@"' www-data -- /usr/bin/python manage.py celeryd -c 5 --maxtasksperchild=1000 --time-limit=30
|
||||
end script
|
|
@ -0,0 +1,416 @@
|
|||
## Django settings for ASKBOT enabled project.
|
||||
import os.path
|
||||
import logging
|
||||
import sys
|
||||
import askbot
|
||||
import site
|
||||
|
||||
#this line is added so that we can import pre-packaged askbot dependencies
|
||||
ASKBOT_ROOT = os.path.abspath(os.path.dirname(askbot.__file__))
|
||||
site.addsitedir(os.path.join(ASKBOT_ROOT, 'deps'))
|
||||
|
||||
DEBUG = <%if @askbot_debug %>True<%else%>False<%end%> # set to True to enable debugging
|
||||
TEMPLATE_DEBUG = False # keep false when debugging jinja2 templates
|
||||
INTERNAL_IPS = ('127.0.0.1',)
|
||||
ALLOWED_HOSTS = ['*',]#change this for better security on your site
|
||||
|
||||
ADMINS = (
|
||||
('Your Name', 'your_email@domain.com'),
|
||||
)
|
||||
|
||||
MANAGERS = ADMINS
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': '<%= @db_engine %>', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
|
||||
'NAME': '<%= @db_name %>', # Or path to database file if using sqlite3.
|
||||
'USER': '<%= @db_user %>', # Not used with sqlite3.
|
||||
'PASSWORD': '<%= @db_password %>', # Not used with sqlite3.
|
||||
'HOST': '<%= @db_host %>', # Set to empty string for localhost. Not used with sqlite3.
|
||||
'PORT': '', # Set to empty string for default. Not used with sqlite3.
|
||||
'TEST_CHARSET': 'utf8', # Setting the character set and collation to utf-8
|
||||
'TEST_COLLATION': 'utf8_general_ci', # is necessary for MySQL tests to work properly.
|
||||
}
|
||||
}
|
||||
|
||||
#outgoing mail server settings
|
||||
SERVER_EMAIL = 'openstack@ask.openstack.org'
|
||||
DEFAULT_FROM_EMAIL = 'openstack@ask.openstack.org'
|
||||
EMAIL_HOST_USER = ''
|
||||
EMAIL_HOST_PASSWORD = ''
|
||||
EMAIL_SUBJECT_PREFIX = ''
|
||||
EMAIL_HOST='<%= @smtp_host %>'
|
||||
EMAIL_PORT='<%= @smtp_port %>'
|
||||
EMAIL_USE_TLS=False
|
||||
#EMAIL_BACKEND = 'django.core.mail.backends.dummy.EmailBackend'
|
||||
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 uploaded media
|
||||
# Example: "/home/media/media.lawrence.com/"
|
||||
#MEDIA_ROOT = os.path.join(os.path.dirname(__file__), 'askbot', 'upfiles')
|
||||
MEDIA_ROOT = '/srv/askbot-sites/<%= @slot_name%>/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 = STATIC_URL + 'admin/'
|
||||
|
||||
# Make up some unique string, and don't share it with anybody.
|
||||
SECRET_KEY = '44fb9b7219e3743bffabb6861cbc9a28'
|
||||
|
||||
# List of callables that know how to import templates from various sources.
|
||||
TEMPLATE_LOADERS = (
|
||||
'askbot.skins.loaders.Loader',
|
||||
'django.template.loaders.app_directories.Loader',
|
||||
'django.template.loaders.filesystem.Loader',
|
||||
#'django.template.loaders.eggs.load_template_source',
|
||||
)
|
||||
|
||||
|
||||
MIDDLEWARE_CLASSES = (
|
||||
#'django.middleware.gzip.GZipMiddleware',
|
||||
#'askbot.middleware.locale.LocaleMiddleware',
|
||||
'django.middleware.locale.LocaleMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
#'django.middleware.cache.UpdateCacheMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
#'django.middleware.cache.FetchFromCacheMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'stopforumspam.middleware.StopForumSpamMiddleware',
|
||||
#'django.middleware.sqlprint.SqlPrintingMiddleware',
|
||||
|
||||
#below is askbot stuff for this tuple
|
||||
'askbot.middleware.anon_user.ConnectToSessionMessagesMiddleware',
|
||||
'askbot.middleware.forum_mode.ForumModeMiddleware',
|
||||
'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_SKINS_DIR = #path to your private skin collection
|
||||
#take a look here http://askbot.org/en/question/207/
|
||||
|
||||
<% if @custom_theme_enabled %>
|
||||
ASKBOT_EXTRA_SKINS_DIR = '<%= @askbot_site_root %>/themes'
|
||||
<% end %>
|
||||
|
||||
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.contrib.auth.context_processors.auth', #this is required for the admin app
|
||||
'django.core.context_processors.csrf', #necessary for csrf protection
|
||||
)
|
||||
|
||||
|
||||
INSTALLED_APPS = (
|
||||
'longerusername',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.sites',
|
||||
'django.contrib.staticfiles',
|
||||
|
||||
#all of these are needed for the askbot
|
||||
'django.contrib.admin',
|
||||
'django.contrib.humanize',
|
||||
'django.contrib.sitemaps',
|
||||
'django.contrib.messages',
|
||||
#'debug_toolbar',
|
||||
#Optional, to enable haystack search
|
||||
'haystack',
|
||||
'compressor',
|
||||
'askbot',
|
||||
'askbot.deps.django_authopenid',
|
||||
#'askbot.importers.stackexchange', #se loader
|
||||
'south',
|
||||
'askbot.deps.livesettings',
|
||||
'keyedcache',
|
||||
'robots',
|
||||
'django_countries',
|
||||
'djcelery',
|
||||
'djkombu',
|
||||
'followit',
|
||||
'tinymce',
|
||||
'group_messaging',
|
||||
#'avatar',#experimental use git clone git://github.com/ericflo/django-avatar.git$
|
||||
)
|
||||
|
||||
|
||||
#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
|
||||
#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.cached_db'
|
||||
|
||||
<% if @redis_enabled %>
|
||||
CACHES = {
|
||||
'default': {
|
||||
'BACKEND': 'redis_cache.RedisCache',
|
||||
'LOCATION': '<%= @redis_bind %>:<%= @redis_port %>',
|
||||
'KEY_PREFIX': '<%= @redis_prefix %>', #make unique same as db
|
||||
'OPTIONS': {
|
||||
'DB': 1,
|
||||
'PASSWORD': '<%= @redis_password %>',
|
||||
# 'PARSER_CLASS': 'redis.connection.HiredisParser'
|
||||
}
|
||||
}
|
||||
}
|
||||
<%end%>
|
||||
|
||||
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('<%= @askbot_site_root %>/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
|
||||
ASKBOT_TRANSLATE_URL = False #translate specific URLs
|
||||
_ = lambda v:v #fake translation function for the login url
|
||||
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
|
||||
ALLOW_UNICODE_SLUGS = False
|
||||
ASKBOT_USE_STACKEXCHANGE_URLS = False #mimic url scheme of stackexchange
|
||||
|
||||
#Celery Settings
|
||||
BROKER_TRANSPORT = "djkombu.transport.DatabaseTransport"
|
||||
CELERY_ALWAYS_EAGER = False
|
||||
|
||||
import djcelery
|
||||
djcelery.setup_loader()
|
||||
DOMAIN_NAME = ''
|
||||
|
||||
CSRF_COOKIE_NAME = '_csrf'
|
||||
#https://docs.djangoproject.com/en/1.3/ref/contrib/csrf/
|
||||
#CSRF_COOKIE_DOMAIN = DOMAIN_NAME
|
||||
|
||||
STATIC_ROOT = os.path.join(PROJECT_ROOT, "static")
|
||||
STATIC_ROOT = '<%= @askbot_site_root %>/static'
|
||||
STATICFILES_DIRS = (
|
||||
('default/media', os.path.join(ASKBOT_ROOT, 'media')),
|
||||
<% if @custom_theme_enabled %>'<%= @askbot_site_root %>/themes',<% end %>
|
||||
)
|
||||
STATICFILES_FINDERS = (
|
||||
'django.contrib.staticfiles.finders.FileSystemFinder',
|
||||
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
||||
'compressor.finders.CompressorFinder',
|
||||
)
|
||||
|
||||
RECAPTCHA_USE_SSL = True
|
||||
|
||||
#HAYSTACK_SETTINGS
|
||||
ENABLE_HAYSTACK_SEARCH = False
|
||||
#Uncomment for multilingual setup:
|
||||
#HAYSTACK_ROUTERS = ['askbot.search.haystack.routers.LanguageRouter',]
|
||||
|
||||
#Uncomment if you use haystack
|
||||
#More info in http://django-haystack.readthedocs.org/en/latest/settings.html
|
||||
#HAYSTACK_CONNECTIONS = {
|
||||
# 'default': {
|
||||
# 'ENGINE': 'haystack.backends.simple_backend.SimpleEngine',
|
||||
# }
|
||||
#}
|
||||
|
||||
#HAYSTACK_SETTINGS
|
||||
ENABLE_HAYSTACK_SEARCH = True
|
||||
|
||||
HAYSTACK_ROUTERS = ['askbot.search.haystack.routers.LanguageRouter',]
|
||||
|
||||
HAYSTACK_CONNECTIONS = {
|
||||
'default': {
|
||||
'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
|
||||
'URL': 'http://127.0.0.1:8983/solr'
|
||||
},
|
||||
'default_en': {
|
||||
'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
|
||||
'URL': 'http://127.0.0.1:8983/solr/core-en'
|
||||
},
|
||||
'default_zh': {
|
||||
'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
|
||||
'URL': 'http://127.0.0.1:8983/solr/core-zh'
|
||||
},
|
||||
}
|
||||
|
||||
HAYSTACK_SIGNAL_PROCESSOR = 'askbot.search.haystack.signals.AskbotRealtimeSignalProcessor'
|
||||
|
||||
|
||||
|
||||
TINYMCE_COMPRESSOR = True
|
||||
TINYMCE_SPELLCHECKER = False
|
||||
TINYMCE_JS_ROOT = os.path.join(STATIC_ROOT, 'default/media/js/tinymce/')
|
||||
#TINYMCE_JS_URL = STATIC_URL + 'default/media/js/tinymce/tiny_mce.js'
|
||||
TINYMCE_DEFAULT_CONFIG = {
|
||||
'plugins': 'askbot_imageuploader,askbot_attachment',
|
||||
'convert_urls': False,
|
||||
'theme': 'advanced',
|
||||
'content_css': STATIC_URL + 'default/media/style/tinymce/content.css',
|
||||
'force_br_newlines': True,
|
||||
'force_p_newlines': False,
|
||||
'forced_root_block': '',
|
||||
'mode' : 'textareas',
|
||||
'oninit': "TinyMCE.onInitHook",
|
||||
'plugins': 'askbot_imageuploader,askbot_attachment',
|
||||
'theme_advanced_toolbar_location' : 'top',
|
||||
'theme_advanced_toolbar_align': 'left',
|
||||
'theme_advanced_buttons1': 'bold,italic,underline,|,bullist,numlist,|,undo,redo,|,link,unlink,askbot_imageuploader,askbot_attachment',
|
||||
'theme_advanced_buttons2': '',
|
||||
'theme_advanced_buttons3' : '',
|
||||
'theme_advanced_path': False,
|
||||
'theme_advanced_resizing': True,
|
||||
'theme_advanced_resize_horizontal': False,
|
||||
'theme_advanced_statusbar_location': 'bottom',
|
||||
'width': '730',
|
||||
'height': '250'
|
||||
}
|
||||
|
||||
<%if @custom_theme_name %>
|
||||
LIVESETTINGS_OPTIONS = {
|
||||
1: {
|
||||
'DB': True,
|
||||
'SETTINGS': {
|
||||
'GENERAL_SKIN_SETTINGS': {
|
||||
'ASKBOT_DEFAULT_SKIN': '<%= @custom_theme_name %>',
|
||||
'SHOW_LOGO': True
|
||||
},
|
||||
'LOGIN_PROVIDERS': {
|
||||
'SIGNIN_MOZILLA_PERSONA_ENABLED': False,
|
||||
'SIGNIN_ALWAYS_SHOW_LOCAL_LOGIN': False,
|
||||
'SIGNIN_LOCAL_ENABLED': False,
|
||||
'SIGNIN_AOL_ENABLED': False,
|
||||
'SIGNIN_LIVEJOURNAL_ENABLED': False,
|
||||
'SIGNIN_VERISIGN_ENABLED': False,
|
||||
'SIGNIN_IDENTI.CA_ENABLED': False,
|
||||
'SIGNIN_WORDPRESS_ENABLED': False,
|
||||
'SIGNIN_CLAIMID_ENABLED': False,
|
||||
'SIGNIN_TECHNORATI_ENABLED': False,
|
||||
'SIGNIN_TWITTER_ENABLED': False,
|
||||
'SIGNIN_VIDOOP_ENABLED': False,
|
||||
'SIGNIN_BLOGGER_ENABLED': False,
|
||||
'SIGNIN_LINKEDIN_ENABLED': False,
|
||||
'SIGNIN_FLICKR_ENABLED': False,
|
||||
'SIGNIN_FACEBOOK_ENABLED': False,
|
||||
'SIGNIN_LAUNCHPAD_ENABLED': True,
|
||||
'SIGNIN_OPENID_ENABLED': False
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
<%end%>
|
||||
|
||||
#delayed notifications, time in seconds, 15 mins by default
|
||||
NOTIFICATION_DELAY_TIME = 60 * 15
|
||||
|
||||
GROUP_MESSAGING = {
|
||||
'BASE_URL_GETTER_FUNCTION': 'askbot.models.user_get_profile_url',
|
||||
'BASE_URL_PARAMS': {'section': 'messages', 'sort': 'inbox'}
|
||||
}
|
||||
|
||||
ASKBOT_MULTILINGUAL = True
|
||||
|
||||
LANGUAGES = (
|
||||
('en', 'English'),
|
||||
('zh', 'Chinese'),
|
||||
)
|
||||
COUNTRY_CODES = {
|
||||
'en': 'us',
|
||||
'zh': 'cn',
|
||||
}
|
||||
|
||||
ASKBOT_CSS_DEVEL = False
|
||||
if 'ASKBOT_CSS_DEVEL' in locals() and ASKBOT_CSS_DEVEL == True:
|
||||
COMPRESS_PRECOMPILERS = (
|
||||
('text/less', 'lessc {infile} {outfile}'),
|
||||
)
|
||||
|
||||
COMPRESS_JS_FILTERS = []
|
||||
COMPRESS_PARSER = 'compressor.parser.HtmlParser'
|
||||
JINJA2_EXTENSIONS = ('compressor.contrib.jinja2ext.CompressorExtension',)
|
||||
|
||||
# Use syncdb for tests instead of South migrations. Without this, some tests
|
||||
# fail spuriously in MySQL.
|
||||
SOUTH_TESTS_MIGRATE = False
|
||||
|
||||
VERIFIER_EXPIRE_DAYS = 3
|
|
@ -0,0 +1,176 @@
|
|||
<?xml version="1.0" ?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<schema name="default" version="1.4">
|
||||
<types>
|
||||
<fieldtype name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>
|
||||
<fieldType name="boolean" class="solr.BoolField" sortMissingLast="true" omitNorms="true"/>
|
||||
<fieldtype name="binary" class="solr.BinaryField"/>
|
||||
|
||||
<!-- Numeric field types that manipulate the value into
|
||||
a string value that isn't human-readable in its internal form,
|
||||
but with a lexicographic ordering the same as the numeric ordering,
|
||||
so that range queries work correctly. -->
|
||||
<fieldType name="int" class="solr.TrieIntField" precisionStep="0" omitNorms="true" sortMissingLast="true" positionIncrementGap="0"/>
|
||||
<fieldType name="float" class="solr.TrieFloatField" precisionStep="0" omitNorms="true" sortMissingLast="true" positionIncrementGap="0"/>
|
||||
<fieldType name="long" class="solr.TrieLongField" precisionStep="0" omitNorms="true" sortMissingLast="true" positionIncrementGap="0"/>
|
||||
<fieldType name="double" class="solr.TrieDoubleField" precisionStep="0" omitNorms="true" sortMissingLast="true" positionIncrementGap="0"/>
|
||||
|
||||
<fieldType name="tint" class="solr.TrieIntField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/>
|
||||
<fieldType name="tfloat" class="solr.TrieFloatField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/>
|
||||
<fieldType name="tlong" class="solr.TrieLongField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/>
|
||||
<fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/>
|
||||
|
||||
<fieldType name="date" class="solr.TrieDateField" omitNorms="true" precisionStep="0" positionIncrementGap="0"/>
|
||||
<!-- A Trie based date field for faster date range queries and date faceting. -->
|
||||
<fieldType name="tdate" class="solr.TrieDateField" omitNorms="true" precisionStep="6" positionIncrementGap="0"/>
|
||||
|
||||
<fieldType name="point" class="solr.PointType" dimension="2" subFieldSuffix="_d"/>
|
||||
<fieldType name="location" class="solr.LatLonType" subFieldSuffix="_coordinate"/>
|
||||
<fieldtype name="geohash" class="solr.GeoHashField"/>
|
||||
|
||||
<fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
|
||||
<analyzer type="index">
|
||||
|
||||
<tokenizer class="solr.SmartChineseSentenceTokenizerFactory"/>
|
||||
<filter class="solr.SmartChineseWordTokenFilterFactory"/>
|
||||
<filter class="solr.LowerCaseFilterFactory"/>
|
||||
<!-- <filter class="solr.PositionFilterFactory" /> -->
|
||||
|
||||
</analyzer>
|
||||
<analyzer type="query">
|
||||
|
||||
<tokenizer class="solr.SmartChineseSentenceTokenizerFactory"/>
|
||||
<filter class="solr.SmartChineseWordTokenFilterFactory"/>
|
||||
<filter class="solr.LowerCaseFilterFactory"/>
|
||||
<!-- <filter class="solr.PositionFilterFactory" /> -->
|
||||
|
||||
</analyzer>
|
||||
</fieldType>
|
||||
|
||||
<fieldType name="text_en" class="solr.TextField" positionIncrementGap="100">
|
||||
<analyzer type="index">
|
||||
<tokenizer class="solr.StandardTokenizerFactory"/>
|
||||
<filter class="solr.StopFilterFactory"
|
||||
ignoreCase="true"
|
||||
words="stopwords_en.txt"
|
||||
enablePositionIncrements="true"
|
||||
/>
|
||||
<filter class="solr.LowerCaseFilterFactory"/>
|
||||
<filter class="solr.EnglishPossessiveFilterFactory"/>
|
||||
<filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
|
||||
<!-- Optionally you may want to use this less aggressive stemmer instead of PorterStemFilterFactory:
|
||||
<filter class="solr.EnglishMinimalStemFilterFactory"/>
|
||||
-->
|
||||
<filter class="solr.PorterStemFilterFactory"/>
|
||||
</analyzer>
|
||||
<analyzer type="query">
|
||||
<tokenizer class="solr.StandardTokenizerFactory"/>
|
||||
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
|
||||
<filter class="solr.StopFilterFactory"
|
||||
ignoreCase="true"
|
||||
words="stopwords_en.txt"
|
||||
enablePositionIncrements="true"
|
||||
/>
|
||||
<filter class="solr.LowerCaseFilterFactory"/>
|
||||
<filter class="solr.EnglishPossessiveFilterFactory"/>
|
||||
<filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
|
||||
<!-- Optionally you may want to use this less aggressive stemmer instead of PorterStemFilterFactory:
|
||||
<filter class="solr.EnglishMinimalStemFilterFactory"/>
|
||||
-->
|
||||
<filter class="solr.PorterStemFilterFactory"/>
|
||||
</analyzer>
|
||||
</fieldType>
|
||||
|
||||
<fieldType name="text_ws" class="solr.TextField" positionIncrementGap="100">
|
||||
<analyzer>
|
||||
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
|
||||
</analyzer>
|
||||
</fieldType>
|
||||
|
||||
<fieldType name="ngram" class="solr.TextField" >
|
||||
<analyzer type="index">
|
||||
<tokenizer class="solr.KeywordTokenizerFactory"/>
|
||||
<filter class="solr.LowerCaseFilterFactory"/>
|
||||
<filter class="solr.NGramFilterFactory" minGramSize="3" maxGramSize="15" />
|
||||
</analyzer>
|
||||
<analyzer type="query">
|
||||
<tokenizer class="solr.KeywordTokenizerFactory"/>
|
||||
<filter class="solr.LowerCaseFilterFactory"/>
|
||||
</analyzer>
|
||||
</fieldType>
|
||||
|
||||
<fieldType name="edge_ngram" class="solr.TextField" positionIncrementGap="1">
|
||||
<analyzer type="index">
|
||||
<tokenizer class="solr.WhitespaceTokenizerFactory" />
|
||||
<filter class="solr.LowerCaseFilterFactory" />
|
||||
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
|
||||
<filter class="solr.EdgeNGramFilterFactory" minGramSize="2" maxGramSize="15" side="front" />
|
||||
</analyzer>
|
||||
<analyzer type="query">
|
||||
<tokenizer class="solr.WhitespaceTokenizerFactory" />
|
||||
<filter class="solr.LowerCaseFilterFactory" />
|
||||
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
|
||||
</analyzer>
|
||||
</fieldType>
|
||||
</types>
|
||||
|
||||
<fields>
|
||||
<!-- general -->
|
||||
<field name="id" type="string" indexed="true" stored="true" multiValued="false" required="true"/>
|
||||
<field name="django_ct" type="string" indexed="true" stored="true" multiValued="false"/>
|
||||
<field name="django_id" type="string" indexed="true" stored="true" multiValued="false"/>
|
||||
|
||||
<dynamicField name="*_i" type="int" indexed="true" stored="true"/>
|
||||
<dynamicField name="*_s" type="string" indexed="true" stored="true"/>
|
||||
<dynamicField name="*_l" type="long" indexed="true" stored="true"/>
|
||||
<dynamicField name="*_t" type="text_en" indexed="true" stored="true"/>
|
||||
<dynamicField name="*_b" type="boolean" indexed="true" stored="true"/>
|
||||
<dynamicField name="*_f" type="float" indexed="true" stored="true"/>
|
||||
<dynamicField name="*_d" type="double" indexed="true" stored="true"/>
|
||||
<dynamicField name="*_dt" type="date" indexed="true" stored="true"/>
|
||||
<dynamicField name="*_p" type="location" indexed="true" stored="true"/>
|
||||
<dynamicField name="*_coordinate" type="tdouble" indexed="true" stored="false"/>
|
||||
|
||||
|
||||
<field name="thread_id" type="long" indexed="true" stored="true" multiValued="false" />
|
||||
|
||||
<field name="author" type="text_en" indexed="true" stored="true" multiValued="false" />
|
||||
|
||||
<field name="text" type="text_en" indexed="true" stored="true" multiValued="false" />
|
||||
|
||||
<field name="post_text" type="text_en" indexed="true" stored="true" multiValued="false" />
|
||||
|
||||
<field name="tags" type="text_en" indexed="true" stored="true" multiValued="true" />
|
||||
|
||||
<field name="title" type="text_en" indexed="true" stored="true" multiValued="false" />
|
||||
|
||||
<!-- required by solr 4 -->
|
||||
<field name="_version_" type="long" indexed="true" stored="true"/>
|
||||
|
||||
</fields>
|
||||
|
||||
<!-- field to use to determine and enforce document uniqueness. -->
|
||||
<uniqueKey>id</uniqueKey>
|
||||
|
||||
<!-- field for the QueryParser to use when an explicit fieldname is absent -->
|
||||
<defaultSearchField>text</defaultSearchField>
|
||||
|
||||
<!-- SolrQueryParser configuration: defaultOperator="AND|OR" -->
|
||||
<solrQueryParser defaultOperator="AND"/>
|
||||
</schema>
|
|
@ -0,0 +1,174 @@
|
|||
<?xml version="1.0" ?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<schema name="default" version="1.4">
|
||||
<types>
|
||||
<fieldtype name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>
|
||||
<fieldType name="boolean" class="solr.BoolField" sortMissingLast="true" omitNorms="true"/>
|
||||
<fieldtype name="binary" class="solr.BinaryField"/>
|
||||
|
||||
<!-- Numeric field types that manipulate the value into
|
||||
a string value that isn't human-readable in its internal form,
|
||||
but with a lexicographic ordering the same as the numeric ordering,
|
||||
so that range queries work correctly. -->
|
||||
<fieldType name="int" class="solr.TrieIntField" precisionStep="0" omitNorms="true" sortMissingLast="true" positionIncrementGap="0"/>
|
||||
<fieldType name="float" class="solr.TrieFloatField" precisionStep="0" omitNorms="true" sortMissingLast="true" positionIncrementGap="0"/>
|
||||
<fieldType name="long" class="solr.TrieLongField" precisionStep="0" omitNorms="true" sortMissingLast="true" positionIncrementGap="0"/>
|
||||
<fieldType name="double" class="solr.TrieDoubleField" precisionStep="0" omitNorms="true" sortMissingLast="true" positionIncrementGap="0"/>
|
||||
|
||||
<fieldType name="tint" class="solr.TrieIntField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/>
|
||||
<fieldType name="tfloat" class="solr.TrieFloatField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/>
|
||||
<fieldType name="tlong" class="solr.TrieLongField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/>
|
||||
<fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/>
|
||||
|
||||
<fieldType name="date" class="solr.TrieDateField" omitNorms="true" precisionStep="0" positionIncrementGap="0"/>
|
||||
<!-- A Trie based date field for faster date range queries and date faceting. -->
|
||||
<fieldType name="tdate" class="solr.TrieDateField" omitNorms="true" precisionStep="6" positionIncrementGap="0"/>
|
||||
|
||||
<fieldType name="point" class="solr.PointType" dimension="2" subFieldSuffix="_d"/>
|
||||
<fieldType name="location" class="solr.LatLonType" subFieldSuffix="_coordinate"/>
|
||||
<fieldtype name="geohash" class="solr.GeoHashField"/>
|
||||
|
||||
<fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
|
||||
<analyzer type="index">
|
||||
|
||||
<tokenizer class="solr.StandardTokenizerFactory"/>
|
||||
<filter class="solr.LowerCaseFilterFactory"/>
|
||||
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" />
|
||||
|
||||
</analyzer>
|
||||
<analyzer type="query">
|
||||
|
||||
<tokenizer class="solr.StandardTokenizerFactory"/>
|
||||
<filter class="solr.LowerCaseFilterFactory"/>
|
||||
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" />
|
||||
|
||||
</analyzer>
|
||||
</fieldType>
|
||||
|
||||
<fieldType name="text_en" class="solr.TextField" positionIncrementGap="100">
|
||||
<analyzer type="index">
|
||||
<tokenizer class="solr.StandardTokenizerFactory"/>
|
||||
<filter class="solr.StopFilterFactory"
|
||||
ignoreCase="true"
|
||||
words="stopwords_en.txt"
|
||||
enablePositionIncrements="true"
|
||||
/>
|
||||
<filter class="solr.LowerCaseFilterFactory"/>
|
||||
<filter class="solr.EnglishPossessiveFilterFactory"/>
|
||||
<filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
|
||||
<!-- Optionally you may want to use this less aggressive stemmer instead of PorterStemFilterFactory:
|
||||
<filter class="solr.EnglishMinimalStemFilterFactory"/>
|
||||
-->
|
||||
<filter class="solr.PorterStemFilterFactory"/>
|
||||
</analyzer>
|
||||
<analyzer type="query">
|
||||
<tokenizer class="solr.StandardTokenizerFactory"/>
|
||||
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
|
||||
<filter class="solr.StopFilterFactory"
|
||||
ignoreCase="true"
|
||||
words="stopwords_en.txt"
|
||||
enablePositionIncrements="true"
|
||||
/>
|
||||
<filter class="solr.LowerCaseFilterFactory"/>
|
||||
<filter class="solr.EnglishPossessiveFilterFactory"/>
|
||||
<filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
|
||||
<!-- Optionally you may want to use this less aggressive stemmer instead of PorterStemFilterFactory:
|
||||
<filter class="solr.EnglishMinimalStemFilterFactory"/>
|
||||
-->
|
||||
<filter class="solr.PorterStemFilterFactory"/>
|
||||
</analyzer>
|
||||
</fieldType>
|
||||
|
||||
<fieldType name="text_ws" class="solr.TextField" positionIncrementGap="100">
|
||||
<analyzer>
|
||||
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
|
||||
</analyzer>
|
||||
</fieldType>
|
||||
|
||||
<fieldType name="ngram" class="solr.TextField" >
|
||||
<analyzer type="index">
|
||||
<tokenizer class="solr.KeywordTokenizerFactory"/>
|
||||
<filter class="solr.LowerCaseFilterFactory"/>
|
||||
<filter class="solr.NGramFilterFactory" minGramSize="3" maxGramSize="15" />
|
||||
</analyzer>
|
||||
<analyzer type="query">
|
||||
<tokenizer class="solr.KeywordTokenizerFactory"/>
|
||||
<filter class="solr.LowerCaseFilterFactory"/>
|
||||
</analyzer>
|
||||
</fieldType>
|
||||
|
||||
<fieldType name="edge_ngram" class="solr.TextField" positionIncrementGap="1">
|
||||
<analyzer type="index">
|
||||
<tokenizer class="solr.WhitespaceTokenizerFactory" />
|
||||
<filter class="solr.LowerCaseFilterFactory" />
|
||||
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
|
||||
<filter class="solr.EdgeNGramFilterFactory" minGramSize="2" maxGramSize="15" side="front" />
|
||||
</analyzer>
|
||||
<analyzer type="query">
|
||||
<tokenizer class="solr.WhitespaceTokenizerFactory" />
|
||||
<filter class="solr.LowerCaseFilterFactory" />
|
||||
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
|
||||
</analyzer>
|
||||
</fieldType>
|
||||
</types>
|
||||
|
||||
<fields>
|
||||
<!-- general -->
|
||||
<field name="id" type="string" indexed="true" stored="true" multiValued="false" required="true"/>
|
||||
<field name="django_ct" type="string" indexed="true" stored="true" multiValued="false"/>
|
||||
<field name="django_id" type="string" indexed="true" stored="true" multiValued="false"/>
|
||||
|
||||
<dynamicField name="*_i" type="int" indexed="true" stored="true"/>
|
||||
<dynamicField name="*_s" type="string" indexed="true" stored="true"/>
|
||||
<dynamicField name="*_l" type="long" indexed="true" stored="true"/>
|
||||
<dynamicField name="*_t" type="text_en" indexed="true" stored="true"/>
|
||||
<dynamicField name="*_b" type="boolean" indexed="true" stored="true"/>
|
||||
<dynamicField name="*_f" type="float" indexed="true" stored="true"/>
|
||||
<dynamicField name="*_d" type="double" indexed="true" stored="true"/>
|
||||
<dynamicField name="*_dt" type="date" indexed="true" stored="true"/>
|
||||
<dynamicField name="*_p" type="location" indexed="true" stored="true"/>
|
||||
<dynamicField name="*_coordinate" type="tdouble" indexed="true" stored="false"/>
|
||||
|
||||
|
||||
<field name="thread_id" type="long" indexed="true" stored="true" multiValued="false" />
|
||||
|
||||
<field name="author" type="text_en" indexed="true" stored="true" multiValued="false" />
|
||||
|
||||
<field name="text" type="text_en" indexed="true" stored="true" multiValued="false" />
|
||||
|
||||
<field name="post_text" type="text_en" indexed="true" stored="true" multiValued="false" />
|
||||
|
||||
<field name="tags" type="text_en" indexed="true" stored="true" multiValued="true" />
|
||||
|
||||
<field name="title" type="text_en" indexed="true" stored="true" multiValued="false" />
|
||||
|
||||
<!-- required by solr 4 -->
|
||||
<field name="_version_" type="long" indexed="true" stored="true"/>
|
||||
|
||||
</fields>
|
||||
|
||||
<!-- field to use to determine and enforce document uniqueness. -->
|
||||
<uniqueKey>id</uniqueKey>
|
||||
|
||||
<!-- field for the QueryParser to use when an explicit fieldname is absent -->
|
||||
<defaultSearchField>text</defaultSearchField>
|
||||
|
||||
<!-- SolrQueryParser configuration: defaultOperator="AND|OR" -->
|
||||
<solrQueryParser defaultOperator="AND"/>
|
||||
</schema>
|
Loading…
Reference in New Issue