Commit 1061e5cc authored by christophe siraut's avatar christophe siraut

Base settings files

parent 169f39ff
# Django settings for nuage project.
# Shouldn't django autofind the templates folder in the project root folder?
import os
PROJECT_DIR = os.path.normpath(os.path.dirname(__file__))
# Turn off for production
DEBUG = True
TEMPLATE_DEBUG = DEBUG
......@@ -9,8 +14,9 @@ ADMINS = (
MANAGERS = ADMINS
DATABASE_ENGINE = '' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = '' # Or path to database file if using sqlite3.
DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'nuage.sqlite' # Or path to database file if using sqlite3.
# DATABASE_NAME = '/home/chris/django/nuage/nuage.sqlite'
DATABASE_USER = '' # Not used with sqlite3.
DATABASE_PASSWORD = '' # Not used with sqlite3.
DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
......@@ -21,7 +27,7 @@ DATABASE_PORT = '' # Set to empty string for default. Not used with
# 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'
TIME_ZONE = 'Europe/Brussels'
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
......@@ -35,12 +41,14 @@ USE_I18N = True
# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = ''
# Change this for production
#MEDIA_ROOT = '/var/www/nuage/static/'
MEDIA_ROOT = os.path.join(PROJECT_DIR, '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 = ''
MEDIA_URL = '/static/'
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
......@@ -48,7 +56,7 @@ MEDIA_URL = ''
ADMIN_MEDIA_PREFIX = '/media/'
# Make this unique, and don't share it with anybody.
SECRET_KEY = 'bwew&jf-n1u$d_2r#r+w1lc%8&5kl7_u88m19ehgi94=#4sm-^'
SECRET_KEY = 'yt$kh#^*y6p4&7_+3940u4j(91abrdko7hvtwc*)1w8f29+p&9'
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
......@@ -69,6 +77,7 @@ 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_DIR, 'templates'),
)
INSTALLED_APPS = (
......@@ -76,4 +85,8 @@ INSTALLED_APPS = (
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'nuage.sondage',
)
LOGIN_URL = '/user/login/'
LOGIN_REDIRECT_URL = '/'
from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from nuage.sondage.models import Poll
from nuage.sondage.forms import PollForm
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
info_dict = {
'queryset': Poll.objects.all(),
}
poll_dict = {
#'model' : Poll,
'form_class' : PollForm,
'post_save_redirect' : '/'
}
urlpatterns = patterns('',
# Example:
# (r'^nuage/', include('nuage.foo.urls')),
......@@ -14,4 +29,29 @@ urlpatterns = patterns('',
# Uncomment the next line to enable the admin:
# (r'^admin/', include(admin.site.urls)),
(r'^$', 'django.views.generic.list_detail.object_list', dict(info_dict, template_name='index.html')),
(r'^nuage$', 'django.views.generic.simple.direct_to_template', {'template': 'nuage.html'}),
(r'^(?P<poll_id>\w{4})/$', 'nuage.sondage.views.vote'),
(r'^new/$', 'nuage.sondage.views.new'),
(r'^(?P<object_id>\w+)/edit/$', 'nuage.sondage.views.secure_update_object', dict(poll_dict, post_save_redirect='choices/')),
#(r'^(?P<poll_id>\w+)/edit/$', 'nuage.sondage.views.edit'),
(r'^(?P<poll_id>\w+)/edit/choices/$', 'nuage.sondage.views.editchoices'),
(r'^(?P<poll_id>\w{4})/vote/$', 'nuage.sondage.views.vote'),
(r'^user/login/$', login),
(r'^user/logout/$', logout, {'template_name': 'index.html'}),
(r'^user/register', 'nuage.userbase.views.register'),
)
from django.conf import settings
if settings.DEBUG:
urlpatterns += patterns('',
(r'^%s/(?P<path>.*)$' % settings.MEDIA_URL[1:-1],
'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT, 'show_indexes': False}),
)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment