go on
authorOlivier Larchevêque <olivier.larcheveque@auf.org>
Thu, 12 Sep 2013 20:22:22 +0000 (16:22 -0400)
committerOlivier Larchevêque <olivier.larcheveque@auf.org>
Thu, 12 Sep 2013 20:22:22 +0000 (16:22 -0400)
.gitignore [new file with mode: 0644]
deploy.py
project_name/manage.py
project_name/settings/base.py
project_name/settings/development.py
project_name/settings/local_settings.py [new file with mode: 0644]
requirements/development.txt
requirements/production.txt

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..ebc2ccc
--- /dev/null
@@ -0,0 +1,15 @@
+*.sqlite
+*.db
+
+*.pyc
+*.pyo
+*.log
+
+.*.swp
+*~
+
+.virtualenv
+
+local_settings.py
+media
+sitestatic
index ad1d214..c83f059 100644 (file)
--- a/deploy.py
+++ b/deploy.py
@@ -1,5 +1,6 @@
 # -*- coding: utf-8 -*-
 
+import sys
 import os
 import subprocess
 from pkg_resources import parse_version
@@ -39,10 +40,14 @@ def setup_venv():
 
 
 def setup_dependances():
-    print u"Deps installation"
+    if len(sys.argv) > 1:
+        requirement_file = sys.argv[1]
+    else:
+        requirement_file = 'requirements.txt'
+    print u"Deps installation %s." % requirement_file
     shell_exec(
-        "%s/bin/pip install -r %s/requirements.txt" %
-        (VENV_DIR, ROOT_DIR)
+        "%s/bin/pip install -r %s" %
+        (VENV_DIR, requirement_file)
         )
 
 
index a6f5a1e..123fb43 100644 (file)
@@ -1,9 +1,17 @@
+# -*- coding: utf-8 -*-
+
 import os
 import sys
 
-sys.path.append(os.path.abspath(os.path.dirname(__file__)))
+PROJECT_DIR = os.path.abspath(os.path.dirname(__file__))
+ROOT_DIR = os.path.dirname(PROJECT_DIR)
+VENV_DIR = os.path.join(ROOT_DIR, '.virtualenv')
+
+sys.path.append(ROOT_DIR)
+
+activate_this = os.path.join(VENV_DIR, 'bin/activate_this.py')
+execfile(activate_this, dict(__file__=activate_this))
 
 if __name__ == "__main__":
     from django.core.management import execute_from_command_line
     execute_from_command_line(sys.argv)
-
index e69de29..62e0dd6 100644 (file)
@@ -0,0 +1,102 @@
+# -*- coding: utf-8 -*-
+
+import os
+import socket
+
+from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS as \
+    DEFAULT_TEMPLATE_CONTEXT_PROCESSORS
+from django.conf.global_settings import MIDDLEWARE_CLASSES as \
+    DEFAULT_MIDDLEWARE_CLASSES
+
+
+# Paths
+SETTINGS_PATH = os.path.dirname(__file__)
+PROJECT_PATH = os.path.dirname(SETTINGS_PATH)
+ROOT_PATH = os.path.dirname(PROJECT_PATH)
+MEDIA_ROOT = os.path.join(ROOT_PATH, 'media')
+STATIC_ROOT = os.path.join(ROOT_PATH, 'sitestatic')
+
+# Rapports d'erreurs
+SERVER_EMAIL = 'ne-pas-repondre@auf.org'
+EMAIL_SUBJECT_PREFIX = '[%s - %s] ' % (socket.gethostname(), PROJECT_PATH)
+ADMINS = ()  # pas de notifications courriel
+MANAGERS = ADMINS
+
+# Locales
+TIME_ZONE = 'America/Montreal'
+LANGUAGE_CODE = 'fr-ca'
+USE_I18N = True
+USE_L10N = True
+USE_TZ = True
+
+# URLs
+ROOT_URLCONF = '{{ project_name }}.urls'
+MEDIA_URL = '/media/'
+STATIC_URL = '/static/'
+
+INSTALLED_APPS = (
+    'django.contrib.auth',
+    'django.contrib.contenttypes',
+    'django.contrib.sessions',
+    'django.contrib.sites',
+    'django.contrib.messages',
+    'django.contrib.staticfiles',
+    'django.contrib.admin',
+    'south',
+    'raven.contrib.django',
+)
+
+TEMPLATE_CONTEXT_PROCESSORS = DEFAULT_TEMPLATE_CONTEXT_PROCESSORS + (
+    'django.core.context_processors.static',
+    'django.core.context_processors.request',
+)
+
+MIDDLEWARE_CLASSES = DEFAULT_MIDDLEWARE_CLASSES + (
+    'auf.django.piwik.middleware.TrackMiddleware',
+)
+
+AUTHENTICATION_BACKENDS = (
+    'django.contrib.auth.backends.ModelBackend',
+)
+
+SOUTH_TESTS_MIGRATE = False
+
+LOGGING_FORMAT = \
+    '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
+LOGGING = {
+    'version': 1,
+    'disable_existing_loggers': False,
+    'filters': {
+        'require_debug_false': {
+            '()': 'django.utils.log.RequireDebugFalse'
+        }
+    },
+    'formatters': {
+        'verbose': {
+            'format': LOGGING_FORMAT
+        },
+    },
+    'handlers': {
+        'console': {
+            'level': 'DEBUG',
+            'class': 'logging.StreamHandler',
+        },
+        'sentry': {
+            'level': 'ERROR',
+            'filters': ['require_debug_false'],
+            'class': 'raven.contrib.django.handlers.SentryHandler',
+        },
+    },
+    'loggers': {
+        '': {
+            'handlers': ['console', 'sentry'],
+            'level': 'DEBUG',
+            'propagate': False,
+        },
+    }
+}
+
+try:
+    from local_settings import *   # NOQA
+except ImportError:
+    pass
index 3cd5377..741cea0 100644 (file)
@@ -5,3 +5,5 @@ from base import *  # NOQA
 INTERNAL_IPS = ('127.0.0.1',)
 INSTALLED_APPS += ('debug_toolbar',)
 MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
+
+EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
diff --git a/project_name/settings/local_settings.py b/project_name/settings/local_settings.py
new file mode 100644 (file)
index 0000000..036ee87
--- /dev/null
@@ -0,0 +1,21 @@
+# -*- encoding: utf-8 -*-
+
+DATABASES = {
+    'default': {
+        # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
+        'ENGINE': 'django.db.backends.sqlite3',
+        'NAME': 'db.sqlite',
+        'USER': '',
+        'PASSWORD': '',
+        'HOST': '',
+        'PORT': '',
+    }
+}
+
+SECRET_KEY = ''
+
+PIWIK_TOKEN = ''
+
+RAVEN_CONFIG = {
+    'dsn': '',
+}
index d7f1e2f..ba7551c 100644 (file)
@@ -1 +1,3 @@
 -r production.txt
+
+django-debug-toolbar
index f9b5d7b..10fbeda 100644 (file)
@@ -1 +1,6 @@
 -r wheezy.txt
+
+raven==3.4.1
+south==0.8.2
+
+http://pypi.auf.org/media/dist/auf.django.piwik-1.8.tar.gz#md5=da2be13ae62b8b89c39448b753f48abd