Skip to content

Commit

Permalink
Import project skeleton.
Browse files Browse the repository at this point in the history
  • Loading branch information
onyxfish committed Dec 12, 2010
0 parents commit 75bd860
Show file tree
Hide file tree
Showing 32 changed files with 651 additions and 0 deletions.
Empty file added boundaries/__init__.py
Empty file.
Empty file added boundaries/apps/__init__.py
Empty file.
1 change: 1 addition & 0 deletions boundaries/assets/maintenance.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This site is down for maintenance.
69 changes: 69 additions & 0 deletions boundaries/assets/reset.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.5.1
*/
html {
color: #000;
background: #FFF;
}
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td {
margin: 0;
padding: 0;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
fieldset,img {
border: 0;
}
address,caption,cite,code,dfn,em,strong,th,var {
font-style: normal;
font-weight: normal;
}
li {
list-style: none;
}
caption,th {
text-align: left;
}
h1,h2,h3,h4,h5,h6 {
font-size: 100%;
font-weight: normal;
}
q:before,q:after {
content: '';
}
abbr,acronym {
border: 0;
font-variant: normal;
}
sup {
vertical-align: text-top;
}
sub {
vertical-align: text-bottom;
}
input,textarea,select {
font-family: inherit;
font-size: inherit;
font-weight: inherit;
}
input,textarea,select {*font-size:100%;
}
legend {
color: #000;
}
body {
font: 13px/1.231 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;
}
table {
font-size: inherit;
font: 100%;
}
pre,code,kbd,samp,tt {
font-family: monospace;*font-size:108%;
line-height: 100%;
}
Empty file added boundaries/configs/__init__.py
Empty file.
Empty file.
13 changes: 13 additions & 0 deletions boundaries/configs/common/common.wsgi
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import os
import sys

# put the Django project on sys.path
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../")))

sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../../apps")))

sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../ext")))
os.environ["DJANGO_SETTINGS_MODULE"] = "boundaries.configs.common.settings"

from django.core.handlers.wsgi import WSGIHandler
application = WSGIHandler()
31 changes: 31 additions & 0 deletions boundaries/configs/common/manage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env python

import os
import sys

from django.core.management import execute_manager

# we want a few paths on the python path
# first up we add the root above the application so
# we can have absolute paths everywhere
python_path = os.path.join(
os.path.realpath(os.path.dirname(__file__)), '../../../'
)
# we have have a local apps directory
apps_path = os.path.join(
os.path.realpath(os.path.dirname(__file__)), '../../apps'
)

# we add them first to avoid any collisions
sys.path.insert(0, python_path)
sys.path.insert(0, apps_path)

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)
121 changes: 121 additions & 0 deletions boundaries/configs/common/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
import logging
import os

import django

# Base paths
DJANGO_ROOT = os.path.dirname(os.path.realpath(django.__file__))
SITE_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))

# Debugging
DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)

MANAGERS = ADMINS

# Database
# Note: DATABASE_USER and DATABASE_PASSWORD are defined in the staging and
# production settings.py files. For local use, either define them in
# local_settings.py or ignore to use your local user.
DATABASE_ENGINE = 'postgresql_psycopg2'
DATABASE_HOST = 'localhost'
DATABASE_PORT = '5432'
DATABASE_NAME = 'boundaries'

# Local time
TIME_ZONE = 'America/Chicago'

# Local language
LANGUAGE_CODE = 'en-gb'

# Site framework
SITE_ID = 1

# Internationalization
USE_I18N = False

# Absolute path to the directory that holds media.
MEDIA_ROOT = os.path.join(SITE_ROOT, 'assets')

# 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 = ''

# 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 = '/media/'

# Make this unique, and don't share it with anybody.
SECRET_KEY = '&9e%+az2pfb4bq)^_og%txwhz37k8!g#6)tbe-c16^1!l5(04r'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.load_template_source',
'django.template.loaders.app_directories.load_template_source',
'django.template.loaders.eggs.load_template_source',
)

TEMPLATE_CONTEXT_PROCESSORS = (
)

MIDDLEWARE_CLASSES = (
'django.middleware.gzip.GZipMiddleware',
'django.middleware.cache.UpdateCacheMiddleware',
'django.middleware.common.CommonMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware',
'django.middleware.cache.FetchFromCacheMiddleware',
)

ROOT_URLCONF = 'boundaries.configs.common.urls'

TEMPLATE_DIRS = (
os.path.join(SITE_ROOT, 'templates')
)

INSTALLED_APPS = (
'django.contrib.contenttypes',
'django.contrib.sites',
'django.contrib.admin',
'django.contrib.admindocs',
'django.contrib.humanize',
'django.contrib.gis',
'django.contrib.sitemaps',
)

# Predefined domain
MY_SITE_DOMAIN = 'localhost:8000'

# Email
# run "python -m smtpd -n -c DebuggingServer localhost:1025" to see outgoing
# messages dumped to the terminal
EMAIL_HOST = 'localhost'
EMAIL_PORT = 1025
DEFAULT_FROM_EMAIL = 'do.not.reply@tribune.com'

# Caching
CACHE_MIDDLEWARE_KEY_PREFIX='boundaries'
CACHE_MIDDLEWARE_SECONDS=90 * 60 # 90 minutes
CACHE_BACKEND="dummy:///"

# Analytics
OMNITURE_PAGE_NAME = "boundaries"
OMNITURE_SECTION = ""
OMNITURE_SUBSECTION = ""
GOOGLE_ANALYTICS_KEY = "UA-9792248-6"

# Logging
logging.basicConfig(
level=logging.DEBUG,
)

# Allow for local (per-user) override
try:
from local_settings import *
except ImportError:
pass
14 changes: 14 additions & 0 deletions boundaries/configs/common/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from django.conf import settings
from django.conf.urls.defaults import *
from django.contrib import admin

admin.autodiscover()

urlpatterns = patterns('',
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
(r'^admin/(.*)', admin.site.root),

(r'^site_media/(?P<path>.*)$', 'django.views.static.serve', {
'document_root': settings.MEDIA_ROOT
}),
)
Empty file.
42 changes: 42 additions & 0 deletions boundaries/configs/production/apache
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<VirtualHost *:80>
ServerName boundaries.chicagotribune.com
ServerAlias boundaries.apps.chicagotribune.com
ServerAlias www.boundaries.chicagotribune.com
ServerAlias www.boundaries.apps.chicagotribune.com

SetEnvIf X-Forwarded-For "^163\.192\..*\..*" trib
<Location /> # until launch
Order Deny,Allow
Allow from all
# Allow from env=trib
</Location>

WSGIScriptAlias / /home/newsapps/sites/boundaries/repository/boundaries/configs/production/production.wsgi
<Directory /home/newsapps/sites/boundaries/repository/boundaries>
Order deny,allow
Allow from all
</Directory>

Redirect permanent /favicon.ico http://media.apps.chicagotribune.com/boundaries/na_media/favicon.ico

Alias /robots.txt /home/newsapps/sites/boundaries/repository/boundaries/assets/robots.txt

ErrorLog /home/newsapps/logs/boundaries.error.log
LogLevel warn

SetEnvIf X-Forwarded-For "^.*\..*\..*\..*" is-forwarder
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
LogFormat "[%h] %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio2
CustomLog /home/newsapps/logs/boundaries.access.log combinedio env=is-forwarder
CustomLog /home/newsapps/logs/boundaries.access.log combinedio2 env=!is-forwarder

ServerSignature Off

RewriteEngine on
# canonical hostname
RewriteCond %{HTTP_HOST} !^boundaries.chicagotribune.com [NC]
RewriteRule ^/(.*) http://boundaries.chicagotribune.com/$1 [L,R]

RewriteCond %{REQUEST_URI} /maintenance.html$
RewriteRule $ / [R=302,L]
</VirtualHost>
38 changes: 38 additions & 0 deletions boundaries/configs/production/apache_maintenance
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<VirtualHost *:80>
ServerName boundaries.chicagotribune.com
ServerAlias boundaries.apps.chicagotribune.com
ServerAlias www.boundaries.chicagotribune.com
ServerAlias www.boundaries.apps.chicagotribune.com

SetEnvIf X-Forwarded-For "^163\.192\..*\..*" trib
<Location /> # until launch
Order Deny,Allow
Allow from all
# Allow from env=trib
</Location>

Redirect permanent /favicon.ico http://media.apps.chicagotribune.com/boundaries/na_media/favicon.ico

Alias /robots.txt /home/newsapps/sites/boundaries/repository/boundaries/assets/robots.txt

ErrorLog /home/newsapps/logs/boundaries.error.log
LogLevel warn

SetEnvIf X-Forwarded-For "^.*\..*\..*\..*" is-forwarder
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
LogFormat "[%h] %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio2
CustomLog /home/newsapps/logs/boundaries.access.log combinedio env=is-forwarder
CustomLog /home/newsapps/logs/boundaries.access.log combinedio2 env=!is-forwarder

ServerSignature Off

RewriteEngine on
# canonical hostname
RewriteCond %{HTTP_HOST} !^boundaries.chicagotribune.com [NC]
RewriteRule ^/(.*) http://boundaries.chicagotribune.com/$1 [L,R]

DocumentRoot /home/newsapps/sites/boundaries/repository/boundaries/assets/

RewriteCond %{REQUEST_URI} !/maintenance.html$
RewriteRule $ /maintenance.html [R=302,L]
</VirtualHost>
34 changes: 34 additions & 0 deletions boundaries/configs/production/logging.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[loggers]
keys=root,boundaries

[handlers]
keys=syslogHandler,emailHandler

[formatters]
keys=simpleFormatter

[formatter_simpleFormatter]
format=%(asctime)s:%(levelname)s:%(name)s:%(message)s
datefmt=%b.%d'%y %H:%M

[logger_root]
level=WARN
handlers=syslogHandler

[logger_boundaries]
level=INFO
handlers=syslogHandler,emailHandler
qualname=boundaries
propagate=0

[handler_syslogHandler]
class=handlers.SysLogHandler
level=WARN
formatter=simpleFormatter
args=("/dev/log", handlers.SysLogHandler.LOG_USER)

[handler_emailHandler]
class=handlers.SMTPHandler
level=ERROR
formatter=simpleFormatter
args=('mail.tribapps.com', 'do.not.reply@tribune.com', 'newsapps@tribune.com', 'EC2 / Production / boundaries')
Loading

0 comments on commit 75bd860

Please sign in to comment.