Skip to content

Commit

Permalink
Included example django project
Browse files Browse the repository at this point in the history
  • Loading branch information
krak3n committed Mar 30, 2013
1 parent 44329e9 commit 35edb9d
Show file tree
Hide file tree
Showing 23 changed files with 763 additions and 3 deletions.
1 change: 1 addition & 0 deletions examples/django/__PROJECT_NAME__/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = '0.1dev'
Empty file.
Empty file.
83 changes: 83 additions & 0 deletions examples/django/__PROJECT_NAME__/config/common/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
"""
{{ PROJECT_NAME }}.config.common.settings
-----------------------------------------
"""

from os.path import abspath, join, dirname


""" Paths """
SITE_ROOT = abspath(join(dirname(__file__), '..', '..'))
PROJECT_ROOT = abspath(join(dirname(__file__), '..', '..'))
MEDIA_ROOT = join(SITE_ROOT, 'media')
STATICFILES_DIRS = [
join(PROJECT_ROOT, 'public'), ]
LOG_ROOT = join(SITE_ROOT, 'logs')

""" Urls """
STATIC_URL = '/s/'
MEDIA_URL = '/m/'
ROOT_URLCONF = '{{ PROJECT_NAME }}.urls'

""" Secret Key & Site ID """
SITE_ID = 1
SECRET_KEY = '{{ DJANGO_SECRET_KEY }}'

""" Location """
TIME_ZONE = 'Europe/London'
LANGUAGE_CODE = 'en-gb'
USE_I18N = True
USE_L10N = True

""" Templates """
TEMPLATE_DIRS = [join(PROJECT_ROOT, 'templates')]
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.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.core.context_processors.request',
'django.contrib.messages.context_processors.messages',
'{{ PROJECT_NAME }}.context_processors.domain',
)

""" Middleware """
MIDDLEWARE_CLASSES = (
'django.middleware.cache.UpdateCacheMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.cache.FetchFromCacheMiddleware',
)

""" Installed Applications """
INSTALLED_APPS = (
# Django Apps
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.admin',
'django.contrib.staticfiles',
# Third Party Apps here
# Project Apps here
)

""" Test Suite """
NOSE_ARGS = [
'--include=^(can|it|ensure|must|should|specs?|examples?)',
'--with-spec',
'--spec-color',
'-s',
'--with-coverage',
'--cover-erase',
'--cover-package={{ PROJECT_NAME }}']
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
Empty file.
25 changes: 25 additions & 0 deletions examples/django/__PROJECT_NAME__/config/dev/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#
# Development Nginx Config
#

# Standard Port 80
server {

listen 80;
server_name _; # Catch all

client_max_body_size 500M;

access_log /var/log/nginx/{{ PROJECT_NAME }}.access.log combined;
error_log /var/log/nginx/{{ PROJECT_NAME }}.error.log;

location / {

proxy_pass http://127.0.0.1:9000;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

}

}
31 changes: 31 additions & 0 deletions examples/django/__PROJECT_NAME__/config/dev/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""
{{ PROJECT_NAME }}.config.settings.dev
--------------------------------------
"""

from ..common.settings import *


""" Debugging (default True for local environment) """
DEBUG = True
TEMPLATE_DEBUG = DEBUG

""" Databases (default is mysql) """
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': '{{ PROJECT_NAME }}',
'USER': 'root',
'PASSWORD': '',
}
}

""" Cacheing (default is dummy, see django docs) """
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
}
}

""" Use MD5 Password Hashing for Dev - Speeds things up """
PASSWORD_HASHERS = ['django.contrib.auth.hashers.MD5PasswordHasher']
16 changes: 16 additions & 0 deletions examples/django/__PROJECT_NAME__/context_processors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
{{ PROJECT_NAME }}.context_processors
-------------------------------------
"""

from django.conf import settings
from django.contrib.sites.models import Site


def domain(request):
current_site = Site.objects.get_current()
domain = getattr(settings, 'DOMAIN', 'http://%s' % current_site.domain)
return {
'DOMAIN': domain,
'site': current_site,
}
Empty file.
Loading

0 comments on commit 35edb9d

Please sign in to comment.