Commits

Laureline Guerin committed fbc6344

first version

Comments (0)

Files changed (14)

+syntax: glob
+
+*.pyc
+local_settings.py
+project/database.sqlite
+============
+INSTALLATION
+============
+
+dépendances
+===========
+
+* django 1.2.4
+* django-cms trunk 15122be38bf8c66062d1 (cms, mptt, menus, publisher)
+
+install
+=======
+
+en dev
+------
+
+le plus simple, faire des liens symboliques des deps dans project
+
+faire un local_settings.py
+
+faire un syncdb: python project/manage.py syncdb
+
+django-cms
+----------
+
+Faire un symlink de cms/media/cms dans media.

media/css/screen.css

Empty file added.
+* 404, 500, custom error view

project/__init__.py

Empty file added.
+#!/usr/bin/env 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)

project/misc/__init__.py

Empty file added.

project/misc/models.py

Empty file added.

project/misc/views.py

+from django import http
+from django.conf import settings
+from django.template import loader, Context
+
+def server_error(request):
+    """
+    500 errors handler.
+    
+    Templates: `500.html`
+    Context:
+        + MEDIA_URL
+    """
+    template = loader.get_template("500.html")
+    response_dict = {
+        'MEDIA_URL': settings.MEDIA_URL
+    }
+    return http.HttpResponseServerError(template.render(Context(response_dict)))
+# -*- coding: utf-8 -*-
+# vim: set fileencoding=utf-8 :
+
+import os.path
+
+PROJECT_ROOT_PATH = os.path.dirname(os.path.abspath(__file__))
+
+DEBUG = False
+TEMPLATE_DEBUG = False
+SERVE_STATIC_FILES = False
+
+ADMINS = (
+    ('Lauréline Guérin', 'zebuline@crocobox.org'),
+)
+
+MANAGERS = ADMINS
+
+EMAIL_SUBJECT_PREFIX = u'[TODO] '
+SERVER_EMAIL = 'zebuline@crocobox.org'
+DEFAULT_FROM_EMAIL = 'zebuline@crocobox.org'
+
+# 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 = 'Europe/Paris'
+DEFAULT_CHARSET = 'utf-8'
+
+# Language code for this installation. All choices can be found here:
+# http://www.i18nguy.com/unicode/language-identifiers.html
+LANGUAGE_CODE = 'fr'
+LANGUAGES = (
+    ('fr', u'Français'),
+)
+DATE_FORMAT = "d/m/Y"
+
+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
+
+# If you set this to False, Django will not format dates, numbers and
+# calendars according to the current locale
+USE_L10N = True
+
+# Absolute path to the directory that holds media.
+# Example: "/home/media/media.lawrence.com/"
+MEDIA_ROOT = os.path.join(PROJECT_ROOT_PATH, '../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 = '/media/'
+
+# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
+# trailing slash.
+# Examples: "http://foo.com/media/", "/media/".
+ADMIN_MEDIA_PREFIX = '/admin/media/'
+
+# Make this unique, and don't share it with anybody.
+SECRET_KEY = 'TODO'
+
+# 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',
+)
+
+TEMPLATE_CONTEXT_PROCESSORS = (
+    "django.core.context_processors.auth",
+    "django.core.context_processors.i18n",
+    "django.core.context_processors.request",
+    "django.core.context_processors.media",
+    "cms.context_processors.media",
+)
+
+MIDDLEWARE_CLASSES = (
+    'django.contrib.sessions.middleware.SessionMiddleware',
+    #'cms.middleware.multilingual.MultilingualURLMiddleware',
+    'django.contrib.auth.middleware.AuthenticationMiddleware',
+    'django.middleware.common.CommonMiddleware',
+    'django.contrib.messages.middleware.MessageMiddleware',
+    'cms.middleware.page.CurrentPageMiddleware',
+    'cms.middleware.user.CurrentUserMiddleware',
+    'cms.middleware.toolbar.ToolbarMiddleware', 
+    'cms.middleware.media.PlaceholderMediaMiddleware',
+)
+
+ROOT_URLCONF = 'project.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(PROJECT_ROOT_PATH, '../templates/'),
+)
+
+INSTALLED_APPS = (
+    'django.contrib.auth',
+    'django.contrib.contenttypes',
+    'django.contrib.sessions',
+    'django.contrib.sites',
+    'django.contrib.messages',
+    'django.contrib.admin',
+    
+    'cms',
+    'cms.plugins.text',
+    'cms.plugins.picture',
+    'cms.plugins.link',
+    'cms.plugins.file',
+    'cms.plugins.snippet',
+    'mptt',
+    'menus',
+)
+
+# CMS
+CMS_TEMPLATES = (
+    ('base.html', u'défaut'),
+    ('home.html', u'accueil'),
+    #('2col.html', '2 colonnes'),
+    #('3col.html', '3 colonnes'),
+)
+
+
+"""
+Define at least those settings in your custom environment. Example:
+
+import os.path
+
+BASE_PATH = os.path.dirname(os.path.abspath(__file__))
+
+DEBUG = True
+TEMPLATE_DEBUG = True
+SERVE_STATIC_FILES = True
+
+DATABASES = {
+    'default': {
+        'ENGINE': 'django.db.backends.sqlite3',
+        'NAME': os.path.join(BASE_PATH, 'database.sqlite')
+    }
+}
+
+"""
+
+try:
+    from local_settings import *
+except ImportError:
+    try:
+        from staging_settings import *
+    except ImportError:
+        pass
+
+    try:
+        from production_settings import *
+    except ImportError:
+        pass
+
+# -*- coding: utf-8 -*-
+# vim: set fileencoding=utf-8 :
+
+from django.conf import settings
+from django.conf.urls.defaults import *
+from django.contrib import admin
+
+import os
+
+# Custom handler 500
+handler500 = 'misc.views.server_error'
+
+admin.autodiscover()
+
+urlpatterns = patterns('',
+    url(r'^admin/', include(admin.site.urls)),
+    url(r'^', include('cms.urls')),
+)
+
+## Media (local)
+if settings.SERVE_STATIC_FILES:
+    urlpatterns += patterns('',
+        url(r'^media/(?P<path>.*)$',
+            'django.views.static.serve',
+            dict(
+                document_root = settings.MEDIA_ROOT,
+                show_indexes = True
+            )
+        ),
+    )
+{% extends "base.html" %}
+
+{% block content %}
+<h2>Objet non trouvé</h2>
+{% endblock %}
+{% extends "base.html" %}
+
+{% block content %}
+<h2>Erreur interne</h2>
+<p>Un email a été envoyé aux administrateurs du site afin de les avertir de cette erreur, qui sera corrigée dans les plus brefs délais.</p>
+{% endblock %}
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<title>TODO</title>
+<meta name="keywords" content="" />
+<meta name="description" content="" />
+<link href="{{ MEDIA_URL }}css/screen.css" rel="stylesheet" type="text/css" media="screen" />
+</head>
+<body>
+
+</div>
+
+</body>
+</html>