Commits

Arnaud Grausem committed 0f5aaa5

Separation of project internal settings and user specific settings
Add an helper file to define local_settings
Ignore local locale_settings.py

Comments (0)

Files changed (5)

 .*\.pyc$
 .*\.db$
-thot/manage.py
-thot/settings.py
 media/js/tinymce
+thot/local_settings.py$

thot/local_settings.py.dist

+# -*- coding: utf-8 -*-
+
+#-------------------------------------------------------------------------------
+# Copyright (C) 2010 Grausem Arnaud <arnaud.grausem@gmail.com>
+# Licence CeCILL v2: see LICENSE for details
+#
+# This file is part of thot
+#
+# This software is governed by the CeCILL license under French law and
+# abiding by the rules of distribution of free software. You can use,
+# modify and/ or redistribute the software under the terms of the CeCILL
+# license as circulated by CEA, CNRS and INRIA at the following URL
+# "http://www.cecill.info".
+#
+# As a counterpart to the access to the source code and rights to copy, modify
+# and redistribute granted by the license, users are provided only with a
+# limited warranty and the software's author, the holder of the economic
+# rights, and the successive licensors have only limited liability.
+#
+# In this respect, the user's attention is drawn to the risks associated with
+# loading, using, modifying and/or developing or reproducing the software by
+# the user in light of its specific status of free software, that may mean
+# that it is complicated to manipulate, and that also therefore means that it
+# is reserved for developers and experienced professionals having in-depth
+# computer knowledge. Users are therefore encouraged to load and test the
+# software's suitability as regards their requirements in conditions enabling
+# the security of their systems and/or data to be ensured and, more generally,
+# to use and operate it in the same conditions as regards security.
+#
+# The fact that you are presently reading this means that you have had
+# knowledge of the CeCILL license and that you accept its terms.
+#-------------------------------------------------------------------------------
+
+"""
+
+    thot.local_settings
+    ~~~~~~~~~~~~~~~~~~~
+
+    Modify settings for the Thot application instead in the settings file
+
+"""
+
+# To enable debug, uncomment lines below
+# Make sure this is commented in production environnement
+# DEBUG = False
+# TEMPLATE_DEBUG = DEBUG
+
+# defines admins of the thot application in production
+ADMINS = (
+    # ('Your Name', 'your_email@domain.com'),
+)
+# defines managers
+MANAGERS = ADMINS
+
+DATABASE_ENGINE = ''           # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
+DATABASE_NAME = ''             # Or path to database file if using sqlite3.
+DATABASE_USER = ''             # Not used with sqlite3.
+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.
+
+# 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 = 'America/Chicago'
+
+# Language code for this installation. All choices can be found here:
+# http://www.i18nguy.com/unicode/language-identifiers.html
+LANGUAGE_CODE = 'en-us'
+
+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
+
+# 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 = '/static/'
+
+# Absolute path to the directory that holds media.
+# Example: "/home/media/media.lawrence.com/"
+MEDIA_ROOT = ''
+
+# Pathes to the local dirs
+LOCALE_PATHS = (
+    # Put strings here, like "/home/django/locale" or "C:/www/django/locale".
+    # Always use forward slashes, even on Windows.
+    # Don't forget to use absolute paths, not relative paths.
+)
+
+# Make this unique, and don't share it with anybody.
+SECRET_KEY = 'h@3$n3z4aq+jeqcbhc!)--ot=^&das@@cre&4-7h!t4=ub=w2y'
+
+TEMPLATE_CONTEXT_PROCESSORS = (
+    'django.core.context_processors.auth',
+    'django.core.context_processors.debug',
+    'django.core.context_processors.i18n',
+    'django.core.context_processors.media',
+    'thot.registration.context_processors.user',
+)
+
+# 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',
+    'django.template.loaders.eggs.load_template_source',
+)
+
+# To enable the CAS authentication, uncomment the line below
+# Make sure the django_cas library is installed
+MIDDLEWARE_CLASSES = (
+    'django.middleware.common.CommonMiddleware',
+    'django.contrib.sessions.middleware.SessionMiddleware',
+    'django.middleware.locale.LocaleMiddleware',
+    'django.contrib.auth.middleware.AuthenticationMiddleware',
+    #'django_cas.middleware.CASMiddleware',
+    'django.middleware.doc.XViewMiddleware',
+)
+
+# To enable the cas authentication backend, uncomment the lines below
+# Make sure the django_cas library is installed
+#
+# AUTHENTICATION_BACKENDS = (
+#     'thot.registration.backends.ArCASBackend',
+# )
+
+# Pathes to the template dirs
+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.
+)
+
+SESSION_EXPIRE_AT_BROWSER_CLOSE = True
+
+#################################
+# LOG CONFIGURATION             #
+#################################
+
+LOG_FILE = '/tmp/thot.out'
+LOG_LEVEL = 'INFO'
+
+#################################
+# DAJAX CONFIGURATION SETTINGS  #
+#################################
+DAJAXICE_DEBUG = DEBUG
+
+#################################
+# LDAP CONFIGURATION            #
+#################################
+
+# This section needs to be populated if you want to enable the CAS 
+# authentication and populate database with retrieving informations 
+# from an LDAP Server
+
+LDAP_SERVER = {
+    'uri': '',
+    'base_dn': '',
+    'bind_dn': '',
+    'bind_pwd': '',
+    'filters': {
+        'user': '', 	# filter to get information about one user having access to the application
+        'users': '' 	# filter to get all users having access to the application
+    },
+    'attr_map': { 	# mappings between application data structure and ldap fields 
+        'user': { 	# user mapping
+            'username': '', 
+            'email': '', 
+            'first_name': '', 
+            'last_name': ''
+        }
+    }
+}
+
+#################################
+# SSO CONFIGURATION             #
+#################################
+
+# This section needs to be populated if you want to enable the CAS 
+# authentication
+# See http://code.google.com/p/django-cas/ for more informations
+
+# cas server url
+CAS_SERVER_URL = ''
+# total cas logout or application logout
+CAS_LOGOUT_COMPLETELY = False
+# redirection after login
+CAS_REDIRECT_URL = "/"
+# cas version 1 or 2
+CAS_VERSION = '2'
+# after logout, don't send the user to the url defined in CAS_REDIRECT_URL
+CAS_IGNORE_REFERER = False
+
+#################################
+# TINYMCE CONFIGURATION         #
+#################################
+
+TINYMCE_JS_URL = MEDIA_URL + "js/tinymce/tiny_mce.js"
+TINYMCE_JS_ROOT = MEDIA_ROOT + "js/tinymce"
+
+#################################
+# DEFAULT VIEWS CONFIGURATION   #
+#################################
+
+# The default view to load for installed application
+
+# Default view for the Timesheet application
+# Avalailble views are daily, weekly or monthly. Choose one of them
+DEFAULT_ACTIVITY_VIEW = 'monthly' 
+# Default view for the Report application
+# Avalailble views are user, group or task. Choose one of them
+DEFAULT_REPORT_VIEW = 'user'
+#!/usr/bin/python
+
+from django.core.management import execute_manager
+
+try:
+    import settings # Assumed to be in the same directory.
+except ImportError:
+    import sys
+    sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
+    sys.exit(1)
+
+if __name__ == "__main__":
+    execute_manager(settings)

thot/settings.ar.py

-# -*- coding: utf-8 -*-
-
-#-------------------------------------------------------------------------------
-# Copyright (C) 2010 Grausem Arnaud <arnaud.grausem@gmail.com>
-# Licence CeCILL v2: see LICENSE for details
-#
-# This file is part of thot
-#
-# This software is governed by the CeCILL license under French law and
-# abiding by the rules of distribution of free software. You can use,
-# modify and/ or redistribute the software under the terms of the CeCILL
-# license as circulated by CEA, CNRS and INRIA at the following URL
-# "http://www.cecill.info".
-#
-# As a counterpart to the access to the source code and rights to copy, modify
-# and redistribute granted by the license, users are provided only with a
-# limited warranty and the software's author, the holder of the economic
-# rights, and the successive licensors have only limited liability.
-#
-# In this respect, the user's attention is drawn to the risks associated with
-# loading, using, modifying and/or developing or reproducing the software by
-# the user in light of its specific status of free software, that may mean
-# that it is complicated to manipulate, and that also therefore means that it
-# is reserved for developers and experienced professionals having in-depth
-# computer knowledge. Users are therefore encouraged to load and test the
-# software's suitability as regards their requirements in conditions enabling
-# the security of their systems and/or data to be ensured and, more generally,
-# to use and operate it in the same conditions as regards security.
-#
-# The fact that you are presently reading this means that you have had
-# knowledge of the CeCILL license and that you accept its terms.
-#-------------------------------------------------------------------------------
-
-"""
-
-    thot.locale_settings
-    ~~~~~~~~~~~~~~~~~~~~
-
-    The predefined settings for the Thot web application
-
-"""
-
-import os
-
-from django.utils.translation import ugettext as _
-
-APPS_PATH = os.path.dirname(os.path.abspath(__file__))
-PROJECT_PATH = os.path.dirname(APPS_PATH)
-
-DEBUG = True
-TEMPLATE_DEBUG = DEBUG
-
-
-ADMINS = (
-    ('my name', 'my mail'),
-)
-
-MANAGERS = ADMINS
-
-DATABASE_ENGINE = 'sqlite3'           # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
-DATABASE_NAME = PROJECT_PATH + os.path.sep + 'my_db.db'             # Or path to database file if using sqlite3.
-DATABASE_USER = ''             # Not used with sqlite3.
-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.
-
-# 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 = 'Europe/Paris'
-
-# Language code for this installation. All choices can be found here:
-# http://www.i18nguy.com/unicode/language-identifiers.html
-LANGUAGE_CODE = 'fr'
-
-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
-
-LOCALE_PATHS = (
-    APPS_PATH + os.path.sep + 'locale'
-)
-
-# Absolute path to the directory that holds media.
-# Example: "/home/media/media.lawrence.com/"
-MEDIA_ROOT = PROJECT_PATH + os.path.sep + 'media'
-
-# 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 = '/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 = '/media/'
-
-# Make this unique, and don't share it with anybody.
-SECRET_KEY = 'h@3$n3z4aq+jeqcbhc!)--ot=^&das@@cre&4-7h!t4=ub=w2y'
-
-TEMPLATE_CONTEXT_PROCESSORS = (
-    'django.core.context_processors.auth',
-    'django.core.context_processors.debug',
-    'django.core.context_processors.i18n',
-    'django.core.context_processors.media',
-    'thot.registration.context_processors.user',
-)
-
-# 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',
-    'django.template.loaders.eggs.load_template_source',
-)
-
-MIDDLEWARE_CLASSES = (
-    'django.middleware.common.CommonMiddleware',
-    'django.contrib.sessions.middleware.SessionMiddleware',
-    'django.middleware.locale.LocaleMiddleware',
-    'django.contrib.auth.middleware.AuthenticationMiddleware',
-    'django_cas.middleware.CASMiddleware',
-    'django.middleware.doc.XViewMiddleware',
-)
-
-ROOT_URLCONF = 'thot.urls'
-
-LOGIN_REDIRECT_URL = "/"
-
-AUTHENTICATION_BACKENDS = (
-    'thot.registration.backends.ArCASBackend',
-    'thot.registration.backends.ArBackend',
-)
-
-TEMPLATE_DIRS = (
-    PROJECT_PATH + os.path.sep + 'templates'
-    # 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.
-)
-
-INSTALLED_APPS = (
-    'django.contrib.auth',
-    'django.contrib.contenttypes',
-    'django.contrib.sessions',
-    'django.contrib.sites',
-    'django.contrib.admin',
-    'dajaxice',
-    'dajax',
-    'tinymce',
-    'thot',
-    'thot.membership',
-    'thot.timesheet',
-    'thot.registration',
-    'thot.report', 
-#    'thot.statistic',
-)
-
-SESSION_EXPIRE_AT_BROWSER_CLOSE = True
-
-#################################
-# LOG CONFIGURATION             #
-#################################
-
-LOG_FILE = '/tmp/thot.out'
-LOG_LEVEL = 'DEBUG'
-
-#################################
-# LDAP CONFIGURATION            #
-#################################
-
-LDAP_SERVER = {
-    'uri': '', # ex: ldap://my-ldap-server or ldaps://my-ldap-server-ssl
-    'base_dn': '', # o=annuaire
-    'bind_dn': '', # an operator to bind
-    'bind_pwd': '', # password to bind
-    'filters': {
-        'user': 'uid=%s', # filter to search a user
-        'users': '' # filter to search all users
-    },
-    'attr_map': {
-        'user': { 
-            'username': 'uid', 
-            'email': 'mail',
-            'first_name': 'givenName',
-            'last_name': 'sn'
-        } # user mapping
-    }
-}
-
-#################################
-# SSO CONFIGURATION             #
-#################################
-CAS_SERVER_URL = 'https://cas.unistra.fr/cas/login'
-CAS_LOGOUT_COMPLETELY = False
-CAS_REDIRECT_URL = "/"
-CAS_VERSION = '2'
-CAS_IGNORE_REFERER = False
-
-#################################
-# DAJAX CONFIGURATION SETTINGS  #
-#################################
-DAJAXICE_DEBUG = DEBUG
-DAJAXICE_MEDIA_PREFIX="dajaxice"
-DAJAXICE_FUNCTIONS = (
-    'timesheet.ajax.index',
-    'timesheet.ajax.daily',
-    'timesheet.ajax.weekly',
-    'timesheet.ajax.monthly',
-    'timesheet.ajax.tasks',
-    'timesheet.ajax.help'
-    'timesheet.ajax.update_calendar',
-    'timesheet.ajax.change_date',
-    'timesheet.ajax.load_tasks',
-    'timesheet.ajax.get_tasks',
-    'timesheet.ajax.add_activity',
-    'timesheet.ajax.add_activities',
-    'timesheet.ajax.delete_activities',
-    'timesheet.ajax.edit_activity',
-    'timesheet.ajax.add_form',
-    'report.ajax.update_users',
-    'report.ajax.update_tasks',
-    'report.ajax.user',
-    'report.ajax.group',
-    'report.ajax.task',
-    'report.ajax.display',
-)
-
-#################################
-# TINYMCE CONFIGURATION         #
-#################################
-
-TINYMCE_JS_URL = MEDIA_URL + "js/tinymce/tiny_mce.js"
-TINYMCE_JS_ROOT = MEDIA_ROOT + "js/tinymce"
-
-TINYMCE_DEFAULT_CONFIG = {
-    'mode': "textareas",
-    'elements' : "elm1",
-    'theme': "advanced",
-    'skin': "default",
-    'relative_urls': False,
-    'plugins': "safari,style,preview,paste,fullscreen,visualchars,nonbreaking,xhtmlxtras",
-    'theme_advanced_buttons1' : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,formatselect,fontselect,fontsizeselect",
-    'theme_advanced_buttons2' : "cut,copy,paste,pastetext,pasteword,|,bullist,numlist,|,undo,redo,|,cleanup,code,|,fullscreen,styleprops,|,preview",
-    'theme_advanced_toolbar_location' : "top",
-    'theme_advanced_toolbar_align' : "left",
-    'theme_advanced_resizing' : "true",
-}
-
-#################################
-# TIMESHEET APP CONFIGURATION   #
-#################################
-
-# The activity view to load when the application first load
-DEFAULT_ACTIVITY_VIEW = 'monthly' # Avalailble views are daily, weekly or monthly. Choose one of them
-
-DEFAULT_REPORT_VIEW = 'user' # Avalailble views are daily, weekly or monthly. Choose one of them
+# -*- coding: utf-8 -*-
+
+#-------------------------------------------------------------------------------
+# Copyright (C) 2010 Grausem Arnaud <arnaud.grausem@gmail.com>
+# Licence CeCILL v2: see LICENSE for details
+#
+# This file is part of thot
+#
+# This software is governed by the CeCILL license under French law and
+# abiding by the rules of distribution of free software. You can use,
+# modify and/ or redistribute the software under the terms of the CeCILL
+# license as circulated by CEA, CNRS and INRIA at the following URL
+# "http://www.cecill.info".
+#
+# As a counterpart to the access to the source code and rights to copy, modify
+# and redistribute granted by the license, users are provided only with a
+# limited warranty and the software's author, the holder of the economic
+# rights, and the successive licensors have only limited liability.
+#
+# In this respect, the user's attention is drawn to the risks associated with
+# loading, using, modifying and/or developing or reproducing the software by
+# the user in light of its specific status of free software, that may mean
+# that it is complicated to manipulate, and that also therefore means that it
+# is reserved for developers and experienced professionals having in-depth
+# computer knowledge. Users are therefore encouraged to load and test the
+# software's suitability as regards their requirements in conditions enabling
+# the security of their systems and/or data to be ensured and, more generally,
+# to use and operate it in the same conditions as regards security.
+#
+# The fact that you are presently reading this means that you have had
+# knowledge of the CeCILL license and that you accept its terms.
+#-------------------------------------------------------------------------------
+
+"""
+
+    thot.settings
+    ~~~~~~~~~~~~~
+
+    Default settings for the Thot web application. Change this only if you know 
+    what you do. If you want to modifiy some parameters, do it in the 
+    local_settings file that is imported at the end of this file.
+
+"""
+
+# If you set this to False, Django will make some optimizations so as not
+# to load the internationalization machinery.
+USE_I18N = True
+
+# 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 = '/media/'
+
+# Make this unique, and don't share it with anybody.
+SECRET_KEY = 'j3bc_b0uf&4sf8^i+k^+f$pb9cnf(a48fs%iuzbxfu6vekrwe*'
+
+# 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',
+    'django.template.loaders.eggs.load_template_source',
+)
+
+TEMPLATE_CONTEXT_PROCESSORS = (
+    'django.core.context_processors.auth',
+    'django.core.context_processors.debug',
+    'django.core.context_processors.i18n',
+    'django.core.context_processors.media',
+    'thot.registration.context_processors.user',
+)
+
+ROOT_URLCONF = 'thot.urls'
+
+LOGIN_REDIRECT_URL = "/"
+
+AUTHENTICATION_BACKENDS = (
+    'thot.registration.backends.ArBackend',
+)
+
+INSTALLED_APPS = (
+    'django.contrib.auth',
+    'django.contrib.contenttypes',
+    'django.contrib.sessions',
+    'django.contrib.sites',
+    'django.contrib.admin',
+    'django_extensions',
+    'dajaxice',
+    'dajax',
+    'tinymce',
+    'thot',
+    'thot.membership',
+    'thot.timesheet',
+    'thot.registration',
+    'thot.report', 
+)
+
+SESSION_EXPIRE_AT_BROWSER_CLOSE = True
+
+#################################
+# DAJAX CONFIGURATION SETTINGS  #
+#################################
+DAJAXICE_MEDIA_PREFIX="dajaxice"
+DAJAXICE_FUNCTIONS = (
+    'timesheet.ajax.index',
+    'timesheet.ajax.daily',
+    'timesheet.ajax.weekly',
+    'timesheet.ajax.monthly',
+    'timesheet.ajax.update_calendar',
+    'timesheet.ajax.change_date',
+    'timesheet.ajax.load_tasks',
+    'timesheet.ajax.get_tasks',
+    'timesheet.ajax.editable_tasks',
+    'timesheet.ajax.edit_task',
+    'timesheet.ajax.add_tasks',
+    'timesheet.ajax.add_activity',
+    'timesheet.ajax.add_activities',
+    'timesheet.ajax.delete_activities',
+    'timesheet.ajax.edit_activity',
+    'timesheet.ajax.add_form',
+    'report.ajax.update_users',
+    'report.ajax.update_tasks',
+    'report.ajax.user',
+    'report.ajax.group',
+    'report.ajax.task',
+    'report.ajax.display',
+)
+
+#################################
+# TINYMCE CONFIGURATION         #
+#################################
+
+TINYMCE_DEFAULT_CONFIG = {
+    'mode': "textareas",
+    'elements' : "elm1",
+    'theme': "advanced",
+    'skin': "default",
+    'relative_urls': False,
+    'plugins': "safari,style,preview,paste,fullscreen,visualchars,nonbreaking,\
+        xhtmlxtras",
+    'theme_advanced_buttons1' :
+        "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,\
+        justifyright,justifyfull,formatselect,fontselect,fontsizeselect",
+    'theme_advanced_buttons2' : 
+        "cut,copy,paste,pastetext,pasteword,|,bullist,numlist,|,undo,redo,|,\
+        cleanup,code,|,fullscreen,styleprops,|,preview",
+    'theme_advanced_toolbar_location' : "top",
+    'theme_advanced_toolbar_align' : "left",
+    'theme_advanced_resizing' : "true",
+}
+
+try:
+    from local_settings import *
+except ImportError:
+    pass