--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/Puppet_Readme.md Wed Oct 01 13:14:55 2014 +0200
@@ -0,0 +1,169 @@
+# Puppet provisioning ReadMe
+
+This document will describe how to set up a Puppet-provisioned Vagrant VM ready for development, as well as the inner working of the provisioning.
+
+## How to use:
+
+### Requirements:
+- Oracle VirtualBox 4.3.12
+- Vagrant 1.6.5
+- Mercurial (to get the source code of the project)
+- Git (to clone the required subrepositories if necessary)
+
+NOTE: Make sure your git and mercurial pulls are set to clone the file "as-is", especially if you're on Windows, due to all kind of line ending problems that can occur if you don't.
+
+### Installing
+
+Once you have installed VirtualBox and Vagrant on your machine, pull the mercurial repository in a directory of your choice (we'll refer to it as /root/ from now on). Check if you have the following directories in /root/dev/modules:
+
+- apt
+- concat
+- elasticsearch
+- postgresql
+- stdlib
+- sysconfig
+
+If you miss all the modules save sysconfig, this means the subrepositories didn't import properly. To remedy this, look up the /root/.hgsub files and use git clone commands to manually import the missing modules in their respective directories.
+
+You can customize the installation (modifying database names and informations, or virtualenv location for instance) by creating a custom.yaml file from the custom.yaml.tmpl file in the /root/dev/ directory and uncommenting values you want to override. This is by no means necessary and puppet will manage to set up your machine using default values if you don't.
+
+Once all the files are here and your options are properly configured, you just have to run the following command from /root/dev:
+
+ vagrant up
+
+Once the vagrant up command is done setting up the machine, run this command
+
+ vagrant reload
+
+So it fixes a bug with shared folders (see below).
+
+This will set up the virtualbox and provision it via puppet. From there, you can ssh into your machine, activate your virtualenv from the directory you specified in the config file (default is /home/vagrant/myspelenv/).
+
+Your /root/ directory will be located on the virtual machine in the /srv/ directory.
+
+You can then run the following command (from the /srv/root/src directory) for testing purpose:
+
+ python manage.py runserver 0.0.0.0:8000
+
+You'll have to open a browser page to 127.0.0.1:8001 to see your test site.
+
+###Notes and known bugs
+
+Windows users can experience a bug with shared folder (shared folders would only work the first time you setup the vm) due to the way Windows (doesn't) handle symlinks. Here are the steps to fix it manually:
+
+* ssh into the machine
+* run the following command:
+
+ sudo /etc/init.d/vboxadd setup
+
+* then from the host machine vagrantfile directory, run
+
+ vagrant reload
+
+The machine should then set up correctly when you use 'vagrant up'
+
+
+
+#How it works
+
+## Some little things about Puppet
+
+Puppet syntax is declarative. This means that for Puppet to automatically set up your VM, you basically just have to tell Puppet the resources you need installed on your VM, the commands it must run when required, as well as the order in which Puppet should do all this.
+
+Puppet will need 2 things to run properly:
+* a .pp manifest file and the path to it, ours is site.pp, which we put in the root/dev/manifests directory. This manifest is the backbone of the puppet script and the one we use to arrange all our provisioning so Puppet installs everything in the right order.
+* a path to find required modules, which we put in the /root/dev/modules directory.
+
+These informations must be provided to Vagrant so it knows that we will set up our VM with puppet. If you open the VagrantFile, you will see these lines around the end of the file:
+
+ config.vm.provision :puppet do |puppet|
+ puppet.manifests_path = "manifests"
+ puppet.manifest_file = "site.pp"
+ puppet.module_path = "modules"
+ puppet.options = "--hiera_config /vagrant/hiera.yaml"
+ puppet.facter = {
+ "vagrant_base_path" => File.dirname(__FILE__)
+ }
+ end
+
+This bit of code tells Vagrant to use Puppet to provision the machine, and specify the different informations we talked about just above. The last one we need to describe is the puppet.option line, which tells puppet to check the hiera.yaml file. This file is used to tell puppet where to find the files containing the definitions of the global configuration variables: basically it tells puppet to check our config.yaml file and from there set the appropriate global variables.
+
+## A look at site.pp
+
+Here is our site.pp file:
+
+ exec {
+ 'apt_update_site':
+ command => '/usr/bin/apt-get update',
+ timeout => 2400,
+ returns => [ 0, 100 ];
+ #refreshonly => true;
+
+ }
+
+ Exec["apt_update_site"] -> Package <| |>
+
+ # upgrade system
+ class { 'sysconfig::sys_upgrade': }->
+
+ # params
+ class { 'sysconfig::params': }->
+
+ # install packages
+ class { 'sysconfig::packages': }->
+
+ # install postgres
+ class { 'sysconfig::postgresql': }->
+
+ # set up the virtualenv
+ class { 'sysconfig::virtualenv': }->
+
+ # write config
+ class { 'sysconfig::config': }->
+
+ # write django_init
+ class { 'sysconfig::django_init': }->
+
+ exec { 'shared_folder_fix_OracleVM_4.3.12':
+ command => 'sudo /etc/init.d/vboxadd setup'
+ }
+
+The first exec block runs the apt-get update command. Just below this we have the Exec["apt_update_site"] -> Package <| |> which is meant to tell Puppet "do the "apt_update_site" command before installing any package resource".
+
+Then we have a number of class declarations, which are all subclasses of the "sysconfig" class from the "sysconfig" submodule, which is the custom module for puppet provisioning we are building. Each class has a corresponding .pp file with the relevant instructions in, located in /root/dev/modules/sysconfig/manifests/. This way we can properly identify what each file do and most importantly when. You will notice the -> at the end of class declarations, this is used to tell Puppet in which order it must process the different classes we have declared.
+
+At the end of the file is an exec command that will be executed last, meant to fix the shared folders problems we can encounter on Windows.
+
+### The Sysconfig submodule
+
+The Sysconfig submodule is our main module. All the .pp manifests can be found in the /root/dev/modules/sysconfig/manifest folder. A notable one is init.pp which is a mandatory manifest in any Puppet submodule containing the sysconfig class definition. All the other manifests are the subclasses of the sysconfig class that are called in site.pp.
+
+* sys_upgrade class
+
+This class executes commands such as apt-get upgrade and apt-get dist upgrade, as well as adding the apt postgresql repository and key to the sources.list.d folder so the postgresql module will get it from there when installing postgresql.
+
+* params class
+
+This class has a number of hiera(var_name, default_value) calls, which Puppet uses to set a the variable named var_name to the corresponding value from the config file mentioned in the hiera.yaml file. If there is no config.yaml file or it can't find your config.yaml file (it can be because you didn't make one), it will set the variable to default_value.
+
+This is the class where you can find all the default values for the variables used in the puppet provisioning.
+
+* packages class
+
+A straightforward class that will install all the required packages for your provisioning that you would normally install via apt-get install command if you didn't use puppet. It use the puppet Package resource for this. The package list is not generated so if you need a new package at some point, you'll have to add it here for it to be installed automatically on new VMs.
+
+* postgres class
+
+This class will install and setup Postgresql according to the parameters specified in config.yaml.
+
+* virtualenv class
+
+This class will set up the virtual env in the directory mentioned in config.yaml and install all python packages into it, using the create_python_env.py script and the resulting project-boot.py script.
+
+* config class
+
+The config class generates the config.py file using a template you can find in /root/dev/modules/sysconfig/template. To do this we use the File resource of Puppet with the attribute "ensure => 'present' " and "content => template(templatepath)"
+
+* django_init class
+
+Finally, this class initialize Django, by doing the syncb and superuser creation. Additionally for spel, it does the manip with south commenting for migrations by calling a Python script (stored in root/dev/files) that parse the file and replace "'south'," by "#'south'," and vice-versa.
\ No newline at end of file
--- a/dev/custom.yaml Wed Oct 01 13:14:23 2014 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
----
-#root_path : ../
-#vm_box : puppetlabs/ubuntu-14.04-64-puppet
-#vm_ip : 172.16.1.3
-#vm_name : spel_dev
-
-#sysconfig::params::db_name : spel
-#sysconfig::params::db_user : spel_user
-#sysconfig::params::db_pw : spel_pw
-#sysconfig::params::db_host : 127.0.0.1
-#sysconfig::params::db_port : 5433
-
-#sysconfig::params::testserver_port : 8001
-
-#sysconfig::params::superuser_name : admin_custom
-#sysconfig::params::superuser_pw : dev@spel_custom
-#sysconfig::params::user_edit_name : user-edit
-#sysconfig::params::user_edit_pw : user-edit@spel
-#sysconfig::params::user_com_name : user-com
-#sysconfig::params::user_com_pw : user-com@spel
-#sysconfig::params::user_observ_name : user-observ
-#sysconfig::params::user_observ_pw : user-observ@spel
-
-#sysconfig::params::path_to_virtualenv : '/home/vagrant/myspelenv'
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/files/settings_south_syncdb.py Wed Oct 01 13:14:55 2014 +0200
@@ -0,0 +1,61 @@
+#!/usr/bin/python
+
+import re
+import sys, getopt
+from shutil import move
+from os import remove, close
+from tempfile import mkstemp
+
+def replace(file_path, pattern, subst):
+ #Create temp file
+ fh, abs_path = mkstemp()
+ new_file = open(abs_path,'w')
+ old_file = open(file_path)
+ for line in old_file:
+ new_file.write(line.replace(pattern, subst))
+ #close temp file
+ new_file.close()
+ close(fh)
+ old_file.close()
+ #Remove original file
+ remove(file_path)
+ #Move new file
+ move(abs_path, file_path)
+
+def main(argv):
+ in_installed_apps=None
+ uncomment=None
+ done=None
+ file = ''
+ instructions='settings_south_syncdb.py -i <settings.py file> to comment south in installed apps, settings_south_syncdb.py -r -i <settings.py file> to decomment south in installed apps'
+
+ try:
+ opts, args = getopt.getopt(argv,"hri:",["file="])
+ except getopt.GetoptError:
+ print 'settings_south_syncdb.py -i <settings.py file>'
+ sys.exit(2)
+ if not opts:
+ print instructions
+ sys.exit()
+ for opt, arg in opts:
+ if opt == '-h':
+ print instructions
+ sys.exit()
+ elif opt == '-r':
+ uncomment=True
+ elif opt in ("-i", "--file"):
+ file = arg
+ else:
+ print instructions
+ sys.exit()
+ if uncomment:
+ replace(file, '#\'south\',', '\'south\',')
+ else:
+ replace(file, '\'south\',', '#\'south\',')
+
+
+
+
+
+if __name__ == "__main__":
+ main(sys.argv[1:])
\ No newline at end of file
--- a/dev/manifests/site.pp Wed Oct 01 13:14:23 2014 +0200
+++ b/dev/manifests/site.pp Wed Oct 01 13:14:55 2014 +0200
@@ -22,10 +22,13 @@
class { 'sysconfig::postgresql': }->
# set up the virtualenv
-class { 'sysconfig::virtualenv': } ->
+class { 'sysconfig::virtualenv': }->
# write config
- class { 'sysconfig::config': }->
+class { 'sysconfig::config': }->
# write django_init
-class { 'sysconfig::django_init': }
\ No newline at end of file
+class { 'sysconfig::django_init': }->
+
+
+# run 'sudo /etc/init.d/vboxadd setup' in the vm to fix shared folders issues
--- a/dev/modules/sysconfig/manifests/config.pp Wed Oct 01 13:14:23 2014 +0200
+++ b/dev/modules/sysconfig/manifests/config.pp Wed Oct 01 13:14:55 2014 +0200
@@ -8,26 +8,26 @@
notify {'config': name => "config -> \$db_host: ${db_host}, \$db_port: ${db_port}, \$db_name: ${db_name}, \$db_user: ${db_user}, \$db_pw: ${db_pw}", withpath => true }
- file { 'local-settings':
+ #file { 'local-settings':
+ #ensure => 'present',
+ #path => "/srv/spel/src/spel/settings.py",
+ #replace => 'no',
+ #owner => 'vagrant',
+ #group => 'vagrant',
+ #mode => 644,
+ #content => template('sysconfig/settings.py.erb'),
+ #}
+
+ file { 'config.py':
ensure => 'present',
- path => "/srv/spel/src/spel/settings.py",
+ path => "/srv/spel/src/spel/config.py",
replace => 'no',
owner => 'vagrant',
group => 'vagrant',
mode => 644,
- content => template('sysconfig/settings.py.erb'),
+ content => template('sysconfig/config.py.erb'),
}
- #file { 'local-settings':
- #ensure => 'present',
- #path => "/srv/spel/src/spel/config.py",
- #replace => 'no',
- #owner => 'vagrant',
- #group => 'vagrant',
- #mode => 644,
- #content => template('sysconfig/config.py.erb'),
- #}
-
file { 'media-root':
ensure => 'directory',
path => '/srv/spel/web',
--- a/dev/modules/sysconfig/manifests/django_init.pp Wed Oct 01 13:14:23 2014 +0200
+++ b/dev/modules/sysconfig/manifests/django_init.pp Wed Oct 01 13:14:55 2014 +0200
@@ -6,11 +6,25 @@
notify {'django_init': name => "django init \$superuser_name : ${superuser_name}, \$superuser_pw : ${superuser_pw}", withpath => true }->
- exec { 'syncdb':
- command => ". ${path_to_virtualenv}/bin/activate && ${path_to_virtualenv}/bin/python manage.py syncdb --noinput",
+ exec { 'syncdb_without_south':
+ command => "/usr/bin/python /srv/spel/dev/files/settings_south_syncdb.py -i /srv/spel/src/spel/settings.py && . ${path_to_virtualenv}/bin/activate && ${path_to_virtualenv}/bin/python manage.py syncdb --noinput",
+ cwd => '/srv/spel/src',
+ user => 'vagrant',
+ provider => 'shell';
+ }
+ exec { 'syncdb_with_south':
+ command => "/usr/bin/python /srv/spel/dev/files/settings_south_syncdb.py -r -i /srv/spel/src/spel/settings.py && . ${path_to_virtualenv}/bin/activate && ${path_to_virtualenv}/bin/python manage.py syncdb --noinput",
cwd => '/srv/spel/src',
user => 'vagrant',
- provider => 'shell'
+ provider => 'shell',
+ require => Exec['syncdb_without_south'];
+ }
+ exec { 'tricking_manage_py':
+ command => ". ${path_to_virtualenv}/bin/activate && ${path_to_virtualenv}/bin/python manage.py migrate --fake",
+ cwd => '/srv/spel/src',
+ user => 'vagrant',
+ provider => 'shell',
+ require => Exec['syncdb_with_south'];
}
exec { 'loaddata':
@@ -18,7 +32,7 @@
cwd => '/srv/spel/src',
user => 'vagrant',
provider => 'shell',
- require => Exec['syncdb']
+ require => Exec['tricking_manage_py']
}
exec { 'createsuperuser':
@@ -27,7 +41,7 @@
user => 'vagrant',
provider => 'shell',
onlyif => "/bin/echo \"from django.contrib.auth.models import User; exit(User.objects.filter(username='${superuser_name}').count())\" | . ${path_to_virtualenv}/bin/activate && ${path_to_virtualenv}/bin/python manage.py shell",
- require => Exec['syncdb']
+ require => Exec['tricking_manage_py']
}
}
\ No newline at end of file
--- a/dev/modules/sysconfig/manifests/params.pp Wed Oct 01 13:14:23 2014 +0200
+++ b/dev/modules/sysconfig/manifests/params.pp Wed Oct 01 13:14:55 2014 +0200
@@ -1,24 +1,18 @@
class sysconfig::params {
- $db_name = 'spel'
- $db_user = 'spel_user'
- $db_pw = 'spel'
- $db_host = '127.0.0.1'
- $db_port = '5432'
+ $db_name = hiera('sysconfig::params::db_name','spel')
+ $db_user = hiera('sysconfig::params::db_user','spel_user')
+ $db_pw = hiera('sysconfig::params::db_pw','spel')
+ $db_host = hiera('sysconfig::params::db_host','127.0.0.1')
+ $db_port = hiera('sysconfig::params::db_port','5432')
- $db_host_real = hiera('sysconfig::params::db_host',$db_host)
+ $db_host_real = $db_host
$db_is_local = ($db_host_real == undef or !$db_host_real or $db_host_real=='127.0.0.1' or $db_host_real=='localhost')
- $testserver_port = 8001
+ $testserver_port = hiera('sysconfig::params::testserver_port','8001')
- $superuser_name = 'admin'
- $superuser_pw = 'dev@spel'
- $user_edit_name = 'user-edit'
- $user_edit_pw = 'user-edit@spel'
- $user_com_name = 'user-com'
- $user_com_pw = 'user-com@spel'
- $user_observ_name = 'user-observ'
- $user_observ_pw = 'user-observ@spel'
+ $superuser_name = hiera('sysconfig::params::superuser_name','admin')
+ $superuser_pw = hiera('sysconfig::params::superuser_pw','dev@spel')
$path_to_virtualenv = hiera('sysconfig::params::path_to_virtualenv', '/home/vagrant/myspelenv')
--- a/dev/modules/sysconfig/templates/config.py.erb Wed Oct 01 13:14:23 2014 +0200
+++ b/dev/modules/sysconfig/templates/config.py.erb Wed Oct 01 13:14:55 2014 +0200
@@ -53,14 +53,14 @@
DATABASES = {
- 'default': {
- 'ENGINE': 'django.db.backends.%(db_engine)s', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
- 'NAME': '%(db_name)s', # Or path to database file if using sqlite3.
- 'USER': '%(db_user)s', # Not used with sqlite3.
- 'PASSWORD': '%(db_password)s', # Not used with sqlite3.
- 'HOST': '%(db_host)s', # Set to empty string for localhost. Not used with sqlite3.
- 'PORT': '%(db_port)d', # Set to empty string for default. Not used with sqlite3.
- }
+ 'default': {
+ 'ENGINE': 'django.db.backends.postgresql_psycopg2', # YOUR_SETTINGS # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
+ 'NAME': '<%= @db_name %>', # YOUR_SETTINGS # Or path to database file if using sqlite3.
+ 'USER': '<%= @db_user %>', # YOUR_SETTINGS # Not used with sqlite3.
+ 'PASSWORD': '<%= @db_pw %>', # YOUR_SETTINGS # Not used with sqlite3.
+ 'HOST': '<%= @db_host %>', # YOUR_SETTINGS # Set to empty string for localhost. Not used with sqlite3.
+ 'PORT': '<%= @db_port %>', # YOUR_SETTINGS # Set to empty string for default. Not used with sqlite3.
+ }
}
CACHES = {
@@ -73,7 +73,7 @@
TEMPLATE_DEBUG = DEBUG
#LOG_FILE = os.path.abspath(os.path.join(BASE_DIR,"../../run/log/log.txt"))
-LOG_FILE = '%(log_file)s'
+LOG_FILE = 'log.txt'
LOG_LEVEL = logging.DEBUG
LOGGING = {
'version': 1,
@@ -141,11 +141,11 @@
GOOGLE_ANALYTICS_CODE = '%(google_analytics_code)s'
-EMAIL_USE_TLS = %(email_use_tls)s
+EMAIL_USE_TLS = '%(email_use_tls)s'
EMAIL_HOST = '%(email_host)s'
EMAIL_HOST_USER = '%(email_host_user)s'
EMAIL_HOST_PASSWORD = '%(email_host_user)s'
-EMAIL_PORT = %(email_port)d
+EMAIL_PORT = '%(email_port)d'
ACCOUNT_ACTIVATION_DAYS = 7
REGISTRATION_OPEN = False
@@ -171,9 +171,9 @@
HAYSTACK_CONNECTIONS = {
'default': {
#for elasticsearch use ldt.indexation.backends.elasticsearch_backend.ElasticsearchSearchEngine
- 'ENGINE': 'haystack.backends.simple_backend.SimpleEngine',
- #'URL': 'http://127.0.0.1:9200/',
- #'INDEX_NAME': 'spel',
+ 'ENGINE': 'ldt.indexation.backends.elasticsearch_backend.ElasticsearchSearchEngine',
+ 'URL': 'http://127.0.0.1:9200/',
+ 'INDEX_NAME': 'spel',
},
}
--- a/dev/modules/sysconfig/templates/settings.py.erb Wed Oct 01 13:14:23 2014 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,286 +0,0 @@
-# -*- coding: utf-8 -*-
-#@PydevCodeAnalysisIgnore
-import os.path
-import spel
-# Django settings for project.
-
-DEBUG = True
-TEMPLATE_DEBUG = DEBUG
-
-ADMINS = (
- # ('Your Name', 'your_email@domain.com'),
-)
-
-MANAGERS = ADMINS
-
-DATABASES = {
- 'default': {
- 'ENGINE': 'django.db.backends.postgresql_psycopg2', # YOUR_SETTINGS # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
- 'NAME': '<%= @db_name %>', # YOUR_SETTINGS # Or path to database file if using sqlite3.
- 'USER': '<%= @db_user %>', # YOUR_SETTINGS # Not used with sqlite3.
- 'PASSWORD': '<%= @db_pw %>', # YOUR_SETTINGS # Not used with sqlite3.
- 'HOST': '<%= @db_host %>', # YOUR_SETTINGS # Set to empty string for localhost. Not used with sqlite3.
- 'PORT': '<%= @db_port %>', # YOUR_SETTINGS # Set to empty string for default. Not used with sqlite3.
- }
-}
-
-# 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.
-# If running in a Windows environment this must be set to the same as your
-# system time zone.
-TIME_ZONE = 'UTC'
-
-# Language code for this installation. All choices can be found here:
-# http://www.i18nguy.com/unicode/language-identifiers.html
-LANGUAGE_CODE = 'fr-fr'
-
-ugettext = lambda s: s
-
-LANGUAGES = (
- ('fr', ugettext('French')),
- ('en', ugettext('English')),
- ('ja', ugettext('Japanese')),
-)
-
-
-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
-
-# Absolute path to the directory that holds media.
-# Example: "/home/media/media.lawrence.com/"
-#MEDIA_ROOT = ''
-
-# Root of static files used by each app, generated by code or uploaded by users
-#STATIC_URL = '/static/'
-
-# URL that handles the media served from MEDIA_ROOT. Make sure to use a
-# trailing slash if there is a path component (optional in other cases).
-# Examples: "http://media.lawrence.com", "http://example.com/media/"
-#MEDIA_URL = ''
-
-# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
-# trailing slash.
-# Examples: "http://foo.com/media/", "/media/".
-
-#LDT_MEDIA_PREFIX = '/ldt/'
-
-# Make this unique, and don't share it with anybody.
-SECRET_KEY = 't^lii5_z@tho$%6t&b#dm#t9nz$$ylyclxvkdiyqbl+(dnt(ma'
-
-# List of callables that know how to import templates from various sources.
-TEMPLATE_LOADERS = (
- 'django.template.loaders.filesystem.Loader',
- 'django.template.loaders.app_directories.Loader',
-# 'django.template.loaders.eggs.Loader',
-)
-
-MIDDLEWARE_CLASSES = (
- 'django.middleware.cache.UpdateCacheMiddleware',
- 'django.middleware.common.CommonMiddleware',
- 'django.middleware.cache.FetchFromCacheMiddleware',
- 'django.middleware.gzip.GZipMiddleware',
- 'ldt.ldt_utils.middleware.swfupload.SWFUploadMiddleware',
- 'django.contrib.sessions.middleware.SessionMiddleware',
- 'django.middleware.csrf.CsrfViewMiddleware',
- 'django.contrib.auth.middleware.AuthenticationMiddleware',
- #'django.middleware.locale.LocaleMiddleware',
- 'django.contrib.messages.middleware.MessageMiddleware',
- 'django_openid_consumer.middleware.OpenIDMiddleware',
- 'ldt.ldt_utils.middleware.userprofile.LanguageMiddleware',
- 'ldt.security.middleware.SecurityMiddleware',
-)
-
-TEMPLATE_CONTEXT_PROCESSORS = (
- "django.core.context_processors.request",
- "django.contrib.auth.context_processors.auth",
- "django.core.context_processors.debug",
- "django.core.context_processors.i18n",
- "django.core.context_processors.media",
- "django.core.context_processors.static",
- "ldt.utils.context_processors.ldt_context",
- "spel.utils.context_processors.spel_context",
-)
-
-
-ROOT_URLCONF = 'spel.urls'
-
-TEMPLATE_DIRS = (
- # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
- # Always use forward slashes, even on Windows.
- # Don't forget to use absolute paths, not relative paths.
- os.path.join(os.path.basename(__file__), 'templates'),
- os.path.join(os.path.dirname(__file__), 'templates'),
-)
-
-FIXTURES_DIRS = (
- os.path.join(os.path.basename(__file__), 'fixtures'),
-)
-
-INSTALLED_APPS = (
- 'django_extensions',
- 'django.contrib.auth',
- 'django.contrib.contenttypes',
- 'django.contrib.sessions',
- 'django.contrib.sites',
- 'django.contrib.messages',
- 'django.contrib.admin',
- 'django.contrib.staticfiles',
- 'haystack',
- 'tastypie',
- 'guardian',
- 'taggit',
- 'taggit_templatetags',
- 'registration',
- 'oauth_provider',
- 'django_openid_consumer',
- 'social_auth',
- 'south',
- 'sorl.thumbnail',
- 'ldt',
- 'ldt.core',
- 'ldt.security',
- 'ldt.user',
- 'ldt.ldt_utils',
- 'ldt.text',
- 'ldt.management',
- 'ldt.indexation',
- 'chunked_uploads',
- 'spel',
-)
-
-#AUTH_PROFILE_MODULE = 'user.UserProfile'
-AUTH_USER_MODEL = 'user.LdtUser'
-INITIAL_CUSTOM_USER_MIGRATION = "0009_rename_auth_user_to_user_ldt_user"
-
-DECOUPAGE_BLACKLIST = (
- "de_PPP",
-)
-
-ZIP_BLACKLIST = (
- "__MACOSX",
-)
-
-AUTHENTICATION_BACKENDS = (
- 'social_auth.backends.twitter.TwitterBackend',
- 'social_auth.backends.facebook.FacebookBackend',
-# 'social_auth.backends.google.GoogleOAuthBackend',
-# 'social_auth.backends.google.GoogleOAuth2Backend',
- 'social_auth.backends.google.GoogleBackend',
- 'social_auth.backends.yahoo.YahooBackend',
-# 'social_auth.backends.contrib.linkedin.LinkedinBackend',
-# 'social_auth.backends.contrib.LiveJournalBackend',
-# 'social_auth.backends.contrib.orkut.OrkutBackend',
- 'social_auth.backends.OpenIDBackend',
- 'django.contrib.auth.backends.ModelBackend',
- 'guardian.backends.ObjectPermissionBackend',
-)
-#SOCIAL_AUTH_IMPORT_BACKENDS = (
-# 'myproy.social_auth_extra_services',
-#)
-
-ACCOUNT_ACTIVATION_DAYS = 7
-
-LDT_MAX_SEARCH_NUMBER = 50
-LDT_JSON_DEFAULT_INDENT = 0
-LDT_MAX_FRAGMENT_PER_SEARCH = 3
-LDT_RESULTS_PER_PAGE = 10
-LDT_MAX_CONTENTS_PER_PAGE = 10
-LDT_MAX_PROJECTS_PER_PAGE = 10
-LDT_FRONT_MEDIA_PER_PAGE = 9
-LDT_FRONT_PROJECTS_PER_PAGE = 12
-LDT_MEDIA_IN_RESULTS_PAGE = 6
-
-OAUTH_PROVIDER_KEY_SIZE = 32
-OAUTH_PROVIDER_SECRET_SIZE = 32
-OAUTH_PROVIDER_VERIFIER_SIZE = 10
-OAUTH_PROVIDER_CONSUMER_KEY_SIZE = 256
-OAUTH_AUTHORIZE_VIEW = 'oauth_provider.views.fake_authorize_view'
-OAUTH_CALLBACK_VIEW = 'oauth_provider.views.fake_callback_view'
-TEST_WEBSERVER_ADDRPORT = "127.0.0.1:8888"
-
-TWITTER_CONSUMER_KEY = 'UxAdbOLSo4Mx3CXIwDG9Eg'
-TWITTER_CONSUMER_SECRET = '2PcWgdjnJL6Vp8srB40jeAo0fjMEtDnUwmAia6EUww'
-FACEBOOK_APP_ID = '163134140411313'
-FACEBOOK_API_SECRET = 'f25e0754a44f0d90d3f4d9ea961ff012'
-
-SOCIAL_AUTH_COMPLETE_URL_NAME = 'complete'
-SOCIAL_AUTH_ASSOCIATE_URL_NAME = 'associate_complete'
-
-
-AUTO_INDEX_AFTER_SAVE = True
-
-ANONYMOUS_USER_ID = -1
-
-WEB_VERSION = spel.get_version()
-
-DIVISIONS_FOR_STAT_ANNOTATION = 64
-
-FRONT_TAG_LIST = []
-
-DEFAULT_CONTENT_ICON = "thumbnails/contents/content_default_icon.png"
-DEFAULT_PROJECT_ICON = "thumbnails/projects/project_default_icon.png"
-DEFAULT_USER_ICON = "thumbnails/users/user_default_icon.png"
-DEFAULT_GROUP_ICON = "thumbnails/groups/group_default_icon.png"
-PROFILE_IMG_MAX_SIZE = 1000000
-
-USE_GROUP_PERMISSIONS = ['Project', 'Content', 'Media']
-FORBIDDEN_STREAM_URL = "rtmp://media.iri.centrepompidou.fr/ddc_player/mp4:video/forbidden_stream.mp4?old_path="
-PUBLIC_GROUP_NAME = 'everyone'
-MAX_USERS_SEARCH = 20
-
-SYNTAX = {
- '++' : 'OK',
- '--' : 'KO',
- '==' : 'REF',
- '??' : 'Q'
- }
-
-EXTERNAL_STREAM_SRC = ['youtube.com', 'dailymotion.com', 'vimeo.com']
-
-HAYSTACK_CONNECTIONS = {
- 'default': {
- #for elasticsearch use ldt.indexation.backends.elasticsearch_backend.ElasticsearchSearchEngine
- 'ENGINE': 'ldt.indexation.backends.elasticsearch_backend.ElasticsearchSearchEngine',
- 'URL': 'http://127.0.0.1:9200/',
- 'INDEX_NAME': 'spel',
- },
-}
-HAYSTACK_SIGNAL_PROCESSOR = 'ldt.indexation.signals.LdtSignalProcessor'
-
-from config import *
-
-if not "SRC_BASE_URL" in locals():
- SRC_BASE_URL = BASE_URL + __name__.split('.')[0] + '/'
-
-if not "LOGIN_URL" in locals():
- LOGIN_URL = SRC_BASE_URL + 'accounts/login/'
-if not "LOGOUT_URL" in locals():
- LOGOUT_URL = SRC_BASE_URL + 'accounts/disconnect/'
-if not "LOGIN_REDIRECT_URL" in locals():
- LOGIN_REDIRECT_URL = SRC_BASE_URL + 'ldt/'
-if not "LOGOUT_REDIRECT_URL" in locals():
- LOGOUT_REDIRECT_URL = SRC_BASE_URL + 'accounts/login'
-if not "PROFILE_REDIRECT_URL" in locals():
- PROFILE_REDIRECT_URL = SRC_BASE_URL + 'auth_accounts/create/profile'
-
-if not "LOGIN_ERROR_URL" in locals():
- LOGIN_ERROR_URL = SRC_BASE_URL + 'accounts/login'
-
-# Used in a lot of templates
-if not "LDT_MEDIA_PREFIX" in locals():
- LDT_MEDIA_PREFIX = STATIC_URL + 'ldt/'
-# URL that handles the media served from MEDIA_ROOT.
-if not "MEDIA_URL" in locals():
- MEDIA_URL = BASE_URL + 'static/media/'
-
-#forced settings
-MAX_TAG_LENGTH = 1024
-#FORCE_LOWERCASE_TAGS = True
-LDT_INDEXATION_INSERT_BATCH_SIZE = 1
-LDT_RESULTS_PER_PAGE = 500
-
-
--- a/src/spel/settings.py Wed Oct 01 13:14:23 2014 +0200
+++ b/src/spel/settings.py Wed Oct 01 13:14:55 2014 +0200
@@ -87,7 +87,7 @@
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
- #'django.middleware.locale.LocaleMiddleware',
+ 'django.middleware.locale.LocaleMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django_openid_consumer.middleware.OpenIDMiddleware',
'ldt.ldt_utils.middleware.userprofile.LanguageMiddleware',