-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Brian Boyer
authored and
Brian Boyer
committed
Apr 1, 2011
1 parent
27393db
commit c37b6c9
Showing
27 changed files
with
990 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import os | ||
import sys | ||
import site | ||
|
||
# Reordering the path code from http://code.google.com/p/modwsgi/wiki/VirtualEnvironments | ||
|
||
# Remember original sys.path. | ||
prev_sys_path = list(sys.path) | ||
|
||
# Look for Virtual Env | ||
env_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../virtualenvs/censusweb")) | ||
|
||
# Add our Virtual Env | ||
site.addsitedir(os.path.join( | ||
env_path, | ||
"lib/python%s/site-packages" % sys.version[:3] | ||
)) | ||
|
||
# Add our project | ||
sys.path.append(os.path.dirname(__file__)) | ||
# and the parent directory | ||
sys.path.append(os.path.dirname(os.path.dirname(__file__))) | ||
|
||
# Reorder sys.path so new directories at the front. | ||
new_sys_path = [] | ||
for item in list(sys.path): | ||
if item not in prev_sys_path: | ||
new_sys_path.append(item) | ||
sys.path.remove(item) | ||
sys.path[:0] = new_sys_path | ||
|
||
#redirecting stdout to stderr cuz geopy uses print statements | ||
sys.stdout = sys.stderr | ||
|
||
# Fire up the WSGI | ||
import django.core.handlers.wsgi | ||
_application = django.core.handlers.wsgi.WSGIHandler() | ||
|
||
# We have to setup our own wsgi handler so we can grab environment | ||
# variables from apache. | ||
def application(environ, start_response): | ||
|
||
# Discover our settings file | ||
if not os.environ.has_key("DJANGO_SETTINGS_MODULE"): | ||
if not environ.has_key("DEPLOYMENT_TARGET"): | ||
os.environ["DJANGO_SETTINGS_MODULE"] = "config.settings" | ||
else: | ||
os.environ["DJANGO_SETTINGS_MODULE"] = "config.%s.settings" % environ["DEPLOYMENT_TARGET"] | ||
|
||
return _application(environ, start_response) | ||
|
||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[loggers] | ||
keys=root | ||
|
||
[handlers] | ||
keys=syslogHandler | ||
|
||
[formatters] | ||
keys=simpleFormatter | ||
|
||
[formatter_simpleFormatter] | ||
format=%(levelname)s:%(name)s:%(message)s | ||
|
||
[logger_root] | ||
level=INFO | ||
handlers=syslogHandler | ||
|
||
[handler_syslogHandler] | ||
class=handlers.SysLogHandler | ||
level=INFO | ||
formatter=simpleFormatter | ||
args=("/dev/log", handlers.SysLogHandler.LOG_LOCAL2) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<VirtualHost *:80> | ||
ServerName censusweb.censusweb.ire.org | ||
ServerAlias www.censusweb.censusweb.ire.org | ||
|
||
SetEnv DEPLOYMENT_TARGET production | ||
WSGIScriptAlias / /home/newsapps/sites/censusweb/application.wsgi | ||
<Directory /home/newsapps/sites/censusweb/repository> | ||
Order deny,allow | ||
Allow from all | ||
</Directory> | ||
|
||
Redirect permanent /favicon.ico http://media.censusweb.ire.org/censusweb/na_media/favicon.ico | ||
|
||
Alias /robots.txt /home/newsapps/sites/censusweb/repository/media/robots.txt | ||
|
||
ErrorLog /home/newsapps/logs/censusweb.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/censusweb.access.log combinedio env=is-forwarder | ||
CustomLog /home/newsapps/logs/censusweb.access.log combinedio2 env=!is-forwarder | ||
|
||
ServerSignature Off | ||
|
||
RewriteEngine on | ||
# canonical hostname | ||
RewriteCond %{HTTP_HOST} !^censusweb.censusweb.ire.org [NC] | ||
RewriteRule ^/(.*) http://censusweb.censusweb.ire.org/$1 [L,R] | ||
|
||
RewriteCond %{REQUEST_URI} /maintenance.html$ | ||
RewriteRule $ / [R=302,L] | ||
</VirtualHost> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<VirtualHost *:80> | ||
ServerName censusweb.censusweb.ire.org | ||
ServerAlias www.censusweb.censusweb.ire.org | ||
|
||
Redirect permanent /favicon.ico http://media.censusweb.ire.org/censusweb/na_media/favicon.ico | ||
|
||
Alias /robots.txt /home/newsapps/sites/censusweb/media/robots.txt | ||
|
||
ErrorLog /home/newsapps/logs/censusweb.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/censusweb.access.log combinedio env=is-forwarder | ||
CustomLog /home/newsapps/logs/censusweb.access.log combinedio2 env=!is-forwarder | ||
|
||
ServerSignature Off | ||
|
||
RewriteEngine on | ||
# canonical hostname | ||
RewriteCond %{HTTP_HOST} !^censusweb.censusweb.ire.org [NC] | ||
RewriteRule ^/(.*) http://censusweb.censusweb.ire.org/$1 [L,R] | ||
|
||
DocumentRoot /home/newsapps/sites/censusweb/media/ | ||
|
||
RewriteCond %{REQUEST_URI} !/maintenance.html$ | ||
RewriteRule $ /maintenance.html [R=302,L] | ||
</VirtualHost> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from config.settings import * | ||
|
||
DEBUG = False | ||
TEMPLATE_DEBUG = DEBUG | ||
|
||
# Database | ||
DATABASES['default']['HOST'] = 'db' | ||
DATABASES['default']['PORT'] = '5433' | ||
DATABASES['default']['USER'] = 'censusweb' | ||
DATABASES['default']['PASSWORD'] = 'Xy9XKembdu' | ||
|
||
# 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 = 'http://media.censusweb.ire.org/censusweb/site_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 = 'http://media.censusweb.ire.org/censusweb/admin_media/' | ||
|
||
# Predefined domain | ||
MY_SITE_DOMAIN = 'censusweb.censusweb.ire.org' | ||
|
||
EMAIL_HOST = 'mail' | ||
EMAIL_PORT = 25 | ||
|
||
# Caching | ||
CACHE_BACKEND = 'memcached://cache:11211/' | ||
|
||
# S3 | ||
AWS_S3_URL = 's3://media.censusweb.ire.org/censusweb/' | ||
|
||
# Internal IPs for security | ||
INTERNAL_IPS = () | ||
|
||
# logging | ||
import logging.config | ||
LOG_FILENAME = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'logger.conf') | ||
logging.config.fileConfig(LOG_FILENAME) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
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.realpath(__file__))) | ||
|
||
# Debugging | ||
DEBUG = True | ||
TEMPLATE_DEBUG = DEBUG | ||
|
||
ADMINS = ( | ||
# ('Your Name', 'your_email@domain.com'), | ||
) | ||
|
||
MANAGERS = ADMINS | ||
|
||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.contrib.gis.db.backends.postgis', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. | ||
'NAME': 'censusweb', # Or path to database file if using sqlite3. | ||
'USER': 'censusweb', # Not used with sqlite3. | ||
'PASSWORD': 'Xy9XKembdu', # Not used with sqlite3. | ||
'HOST': 'localhost', # Set to empty string for localhost. Not used with sqlite3. | ||
'PORT': '5432', # Set to empty string for default. Not used with sqlite3. | ||
} | ||
} | ||
|
||
# Local time | ||
TIME_ZONE = 'America/Chicago' | ||
|
||
# Local language | ||
LANGUAGE_CODE = 'en-us' | ||
|
||
# Site framework | ||
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. | ||
MEDIA_ROOT = os.path.join(SITE_ROOT, '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 = '/site_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 = '/media/' | ||
|
||
# Make this unique, and don't share it with anybody. | ||
SECRET_KEY = 'kljdfagjkldfjklgsf;lj098w3r09eoifjfw09u39j' | ||
|
||
# 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.media', | ||
) | ||
|
||
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', | ||
'debug_toolbar.middleware.DebugToolbarMiddleware', | ||
'django.middleware.cache.FetchFromCacheMiddleware', | ||
) | ||
|
||
ROOT_URLCONF = 'config.urls' | ||
|
||
TEMPLATE_DIRS = ( | ||
os.path.join(SITE_ROOT, 'templates') | ||
) | ||
|
||
INSTALLED_APPS = ( | ||
# 'django.contrib.auth', | ||
'django.contrib.contenttypes', | ||
'django.contrib.sessions', | ||
'django.contrib.sites', | ||
# 'django.contrib.messages', | ||
# Uncomment the next line to enable the admin: | ||
# 'django.contrib.admin', | ||
# Uncomment the next line to enable admin documentation: | ||
# 'django.contrib.admindocs', | ||
|
||
'django.contrib.humanize', | ||
'django.contrib.gis', | ||
'django.contrib.sitemaps', | ||
) | ||
|
||
# Predefined domain | ||
MY_SITE_DOMAIN = 'localhost:8000' | ||
|
||
# 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@censusweb.ire.org' | ||
|
||
# Caching | ||
CACHE_MIDDLEWARE_KEY_PREFIX='censusweb' | ||
CACHE_MIDDLEWARE_SECONDS=90 * 60 # 90 minutes | ||
CACHE_BACKEND="dummy:///" | ||
|
||
# Logging | ||
logging.basicConfig( | ||
level=logging.DEBUG, | ||
) | ||
|
||
# Allow for local (per-user) override | ||
try: | ||
from local_settings import * | ||
except ImportError: | ||
pass |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<VirtualHost *:80> | ||
ServerName censusweb.censusweb-beta.ire.org | ||
ServerAlias www.censusweb.censusweb-beta.ire.org | ||
|
||
SetEnv DEPLOYMENT_TARGET staging | ||
WSGIScriptAlias / /home/newsapps/sites/censusweb/application.wsgi | ||
<Directory /home/newsapps/sites/censusweb/repository> | ||
Order deny,allow | ||
Allow from all | ||
</Directory> | ||
|
||
Redirect permanent /favicon.ico http://media.censusweb-beta.ire.org/censusweb/media/favicon.ico | ||
|
||
Alias /robots.txt /home/newsapps/sites/censusweb/repository/media/robots.txt | ||
|
||
ErrorLog /home/newsapps/logs/censusweb.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/censusweb.access.log combinedio env=is-forwarder | ||
CustomLog /home/newsapps/logs/censusweb.access.log combinedio2 env=!is-forwarder | ||
|
||
ServerSignature Off | ||
|
||
RewriteEngine on | ||
# canonical hostname | ||
RewriteCond %{HTTP_HOST} !^censusweb.censusweb-beta.ire.org [NC] | ||
RewriteRule ^/(.*) http://censusweb.censusweb-beta.ire.org/$1 [L,R] | ||
|
||
RewriteCond %{REQUEST_URI} /maintenance.html$ | ||
RewriteRule $ / [R=302,L] | ||
</VirtualHost> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<VirtualHost *:80> | ||
ServerName censusweb.censusweb-beta.ire.org | ||
ServerAlias www.censusweb.censusweb-beta.ire.org | ||
|
||
Redirect permanent /favicon.ico http://media.censusweb-beta.ire.org/media/favicon.ico | ||
|
||
Alias /robots.txt /home/newsapps/sites/censusweb/media/robots.txt | ||
|
||
ErrorLog /home/newsapps/logs/censusweb.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/censusweb.access.log combinedio env=is-forwarder | ||
CustomLog /home/newsapps/logs/censusweb.access.log combinedio2 env=!is-forwarder | ||
|
||
ServerSignature Off | ||
|
||
RewriteEngine on | ||
# canonical hostname | ||
RewriteCond %{HTTP_HOST} !^censusweb.censusweb.ire.org [NC] | ||
RewriteRule ^/(.*) http://censusweb.censusweb.ire.org/$1 [L,R] | ||
|
||
DocumentRoot /home/newsapps/sites/censusweb/media/ | ||
|
||
RewriteCond %{REQUEST_URI} !/maintenance.html$ | ||
RewriteRule $ /maintenance.html [R=302,L] | ||
</VirtualHost> |
Oops, something went wrong.