Skip to content

Instantly share code, notes, and snippets.

@zazk
Created January 15, 2012 19:05
Show Gist options
  • Save zazk/1616833 to your computer and use it in GitHub Desktop.
Save zazk/1616833 to your computer and use it in GitHub Desktop.
Settings Django
# -*- coding: utf-8 -*-
"""
Settings common.
"""
from os.path import dirname, join, realpath
SITE_ROOT = dirname(dirname(realpath(__file__)))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('Juan de Dios', '[email protected]'),
('Enriqe', '[email protected]'),
)
MANAGERS = ADMINS
# EMAIL
EMAIL_HOST = 'smtp.webfaction.com'
EMAIL_HOST_USER = 'peruvian-atelier'
EMAIL_HOST_PASSWORD = 'peruvian-atelier'
DEFAULT_FROM_EMAIL = '[email protected]'
SERVER_EMAIL = '[email protected]'
EMAIL_PORT = 25
EMAIL_USE_TLS = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'zazk_peruvian', # Or path to database file if using sqlite3.
'USER': 'zazk_peruvian', # Not used with sqlite3.
'PASSWORD': 'peruvian', # Not used with sqlite3.
'HOST': 'localhost', # Set to empty string for localhost. Not used with sqlite3.
'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.
# 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 = 'America/Lima'
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'es-pe'
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 filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = join(SITE_ROOT, 'media')
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = '/media'
# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = '/home/zazk/webapps/peruvian_static/'
#STATIC_ROOT = ''
# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = 'http://peruvian.2minds.org/static/'
#STATIC_URL = '/static/'
# URL prefix for admin static files -- CSS, JavaScript and images.
# Make sure to use a trailing slash.
# Examples: "http://foo.com/static/admin/", "/static/admin/".
ADMIN_MEDIA_PREFIX = STATIC_URL + 'grappelli/'
# Additional locations of static files
STATICFILES_DIRS = (
join(SITE_ROOT, 'static'),
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)
# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
# Make this unique, and don't share it with anybody.
SECRET_KEY = '^$#i^ds&cs)cu68j8hx9=9tdktsly3hp65+_*i6=m9i0zc*tdk'
# 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.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',
'django.contrib.messages.context_processors.messages',
'django.core.context_processors.request',
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
)
ROOT_URLCONF = 'www.urls'
TEMPLATE_DIRS = (
join(SITE_ROOT, '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.messages',
'django.contrib.staticfiles',
'django.contrib.flatpages',
# Uncomment the next line to enable the admin:
'grappelli',
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
# local apps
'local_apps.store',
# external apps
#'south',
'external_apps.registration'
)
#Set www to webapp
#PREPEND_WWW = false
# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'mail_admins': {
'level': 'ERROR',
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}
# Grappelli settings
GRAPPELLI_ADMIN_TITLE = 'Peruvian Atelier'
# Registration settings
ACCOUNT_ACTIVATION_DAYS = 2
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
LOGIN_REDIRECT_URL = '/'
# Media img settings
IMG_SIZE_THUMB = (260, 220)
IMG_SIZE_NORMAL = (490, 380)
IMG_SIZE_LARGE = (490, 380)
BANNER_SIZE_NORMAL = (425, 365)
from django.conf.urls.defaults import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
from django.conf import settings
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'www.views.home', name='home'),
# url(r'^www/', include('www.foo.urls')),
# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
url(r'^admin/', include(admin.site.urls)),
url(r'^grappelli/', include('grappelli.urls')),
# Accounts
url(r'^accounts/', include('external_apps.registration.backends.default.urls')),
(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT}),
(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
# Front-end
url(r'^por-categoria/(?P<id>\d*)', 'local_apps.store.views.show_by_category', name='by-category'),
url(r'^producto/(?P<id>\d*)', 'local_apps.store.views.show_product', name='show-product'),
url(r'^pedido/agregar/$', 'local_apps.store.views.order_add_item', name='order-add'),
url(r'^pedido/$', 'local_apps.store.views.show_order', name='order'),
url(r'^contactenos/$', 'local_apps.store.views.contact_us', name='contact-us'),
url(r'^seccion/(?P<id>\d*)', 'local_apps.store.views.show_section', name='show-section'),
url(r'^galeria/$', 'local_apps.store.views.foto_list', name='foto-list'),
url(r'^videos/$', 'local_apps.store.views.video_list', name='video-list'),
url(r'^videos/ver/(?P<id>\d*)', 'local_apps.store.views.video_show', name='video-show'),
url(r'^pilotos/$', 'local_apps.store.views.piloto_list', name='piloto-list'),
url(r'^pilotos/ver/(?P<id>\d*)', 'local_apps.store.views.piloto_show', name='piloto-show'),
url(r'^mapa/$', 'local_apps.store.views.mapa', name='mapa'),
url(r'^noticias/$', 'local_apps.store.views.noticia_list', name='noticia-list'),
url(r'^noticias/ver/(?P<id>\d*)', 'local_apps.store.views.noticia_show', name='noticia-show'),
url(r'^$', 'local_apps.store.views.store_home', name='store-home'),
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment