Skip to content

Commit 0aceb63

Browse files
committed
Initial import. Still has Chicago stuff all over.
0 parents  commit 0aceb63

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+2962
-0
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.pyc
2+
*.swp
3+
gzip

__init__.py

Whitespace-only changes.

application.wsgi

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import os
2+
import sys
3+
import site
4+
5+
# Reordering the path code from http://code.google.com/p/modwsgi/wiki/VirtualEnvironments
6+
7+
# Remember original sys.path.
8+
prev_sys_path = list(sys.path)
9+
10+
# Look for Virtual Env
11+
env_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../virtualenvs/boundaryservice"))
12+
13+
# Add our Virtual Env
14+
site.addsitedir(os.path.join(
15+
env_path,
16+
"lib/python%s/site-packages" % sys.version[:3]
17+
))
18+
19+
# Add our project
20+
sys.path.append(os.path.dirname(__file__))
21+
# and the parent directory
22+
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
23+
24+
# Reorder sys.path so new directories at the front.
25+
new_sys_path = []
26+
for item in list(sys.path):
27+
if item not in prev_sys_path:
28+
new_sys_path.append(item)
29+
sys.path.remove(item)
30+
sys.path[:0] = new_sys_path
31+
32+
#redirecting stdout to stderr cuz geopy uses print statements
33+
sys.stdout = sys.stderr
34+
35+
# Fire up the WSGI
36+
import django.core.handlers.wsgi
37+
_application = django.core.handlers.wsgi.WSGIHandler()
38+
39+
# We have to setup our own wsgi handler so we can grab environment
40+
# variables from apache.
41+
def application(environ, start_response):
42+
43+
# Discover our settings file
44+
if not os.environ.has_key("DJANGO_SETTINGS_MODULE"):
45+
if not environ.has_key("DEPLOYMENT_TARGET"):
46+
os.environ["DJANGO_SETTINGS_MODULE"] = "config.settings"
47+
else:
48+
os.environ["DJANGO_SETTINGS_MODULE"] = "config.%s.settings" % environ["DEPLOYMENT_TARGET"]
49+
50+
return _application(environ, start_response)
51+
52+

config/__init__.py

Whitespace-only changes.

config/logger.conf

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[loggers]
2+
keys=root
3+
4+
[handlers]
5+
keys=syslogHandler
6+
7+
[formatters]
8+
keys=simpleFormatter
9+
10+
[formatter_simpleFormatter]
11+
format=%(levelname)s:%(name)s:%(message)s
12+
13+
[logger_root]
14+
level=INFO
15+
handlers=syslogHandler
16+
17+
[handler_syslogHandler]
18+
class=handlers.SysLogHandler
19+
level=INFO
20+
formatter=simpleFormatter
21+
args=("/dev/log", handlers.SysLogHandler.LOG_LOCAL2)

config/production/__init__.py

Whitespace-only changes.

config/production/apache

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<VirtualHost *:80>
2+
ServerName boundaryservice.hacktyler.com
3+
ServerAlias www.boundaryservice.hacktyler.com
4+
5+
SetEnv DEPLOYMENT_TARGET production
6+
WSGIScriptAlias / /home/ubuntu/sites/boundaryservice/application.wsgi
7+
<Directory /home/ubuntu/sites/boundaryservice/repository>
8+
Order deny,allow
9+
Allow from all
10+
</Directory>
11+
12+
Redirect permanent /favicon.ico http://media.hacktyler.com/boundaryservice/na_media/favicon.ico
13+
14+
Alias /robots.txt /home/ubuntu/sites/boundaryservice/repository/media/robots.txt
15+
16+
ErrorLog /home/ubuntu/logs/boundaryservice.error.log
17+
LogLevel warn
18+
19+
SetEnvIf X-Forwarded-For "^.*\..*\..*\..*" is-forwarder
20+
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
21+
LogFormat "[%h] %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio2
22+
CustomLog /home/ubuntu/logs/boundaryservice.access.log combinedio env=is-forwarder
23+
CustomLog /home/ubuntu/logs/boundaryservice.access.log combinedio2 env=!is-forwarder
24+
25+
ServerSignature Off
26+
27+
RewriteEngine on
28+
# canonical hostname
29+
RewriteCond %{HTTP_HOST} !^boundaryservice.hacktyler.com [NC]
30+
RewriteRule ^/(.*) http://boundaryservice.hacktyler.com/$1 [L,R]
31+
32+
RewriteCond %{REQUEST_URI} /maintenance.html$
33+
RewriteRule $ / [R=302,L]
34+
</VirtualHost>

config/production/apache_maintenance

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<VirtualHost *:80>
2+
ServerName boundaryservice.hacktyler.com
3+
ServerAlias www.boundaryservice.hacktyler.com
4+
5+
Redirect permanent /favicon.ico http://media.hacktyler.com/boundaryservice/na_media/favicon.ico
6+
7+
Alias /robots.txt /home/ubuntu/sites/boundaryservice/media/robots.txt
8+
9+
ErrorLog /home/ubuntu/logs/boundaryservice.error.log
10+
LogLevel warn
11+
12+
SetEnvIf X-Forwarded-For "^.*\..*\..*\..*" is-forwarder
13+
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
14+
LogFormat "[%h] %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio2
15+
CustomLog /home/ubuntu/logs/boundaryservice.access.log combinedio env=is-forwarder
16+
CustomLog /home/ubuntu/logs/boundaryservice.access.log combinedio2 env=!is-forwarder
17+
18+
ServerSignature Off
19+
20+
RewriteEngine on
21+
# canonical hostname
22+
RewriteCond %{HTTP_HOST} !^boundaryservice.hacktyler.com [NC]
23+
RewriteRule ^/(.*) http://boundaryservice.hacktyler.com/$1 [L,R]
24+
25+
DocumentRoot /home/ubuntu/sites/boundaryservice/media/
26+
27+
RewriteCond %{REQUEST_URI} !/maintenance.html$
28+
RewriteRule $ /maintenance.html [R=302,L]
29+
</VirtualHost>

config/production/settings.py

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
from config.settings import *
2+
3+
DEBUG = False
4+
TEMPLATE_DEBUG = DEBUG
5+
6+
# Database
7+
DATABASES['default']['HOST'] = 'db'
8+
DATABASES['default']['PORT'] = '5433'
9+
DATABASES['default']['USER'] = 'boundaryservice'
10+
DATABASES['default']['PASSWORD'] = 'dMQlbUCftr'
11+
12+
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
13+
# trailing slash if there is a path component (optional in other cases).
14+
# Examples: "http://media.lawrence.com", "http://example.com/media/"
15+
MEDIA_URL = 'http://media.hacktyler.com/boundaryservice/site_media/'
16+
17+
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
18+
# trailing slash.
19+
# Examples: "http://foo.com/media/", "/media/".
20+
ADMIN_MEDIA_PREFIX = 'http://media.hacktyler.com/boundaryservice/admin_media/'
21+
22+
# Predefined domain
23+
MY_SITE_DOMAIN = 'boundaryservice.hacktyler.com'
24+
25+
# Email
26+
EMAIL_HOST = 'mail.hacktyler.com'
27+
EMAIL_PORT = 25
28+
29+
# Caching
30+
CACHES = {
31+
'default': {
32+
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
33+
'LOCATION': 'cache.hacktyler.com:11211',
34+
}
35+
}
36+
37+
# S3
38+
AWS_S3_URL = 's3://media.hacktyler.com/boundaryservice/'
39+
40+
# Internal IPs for security
41+
INTERNAL_IPS = ()
42+
43+
API_DOMAIN = 'TKTK'
44+
45+
# logging
46+
import logging.config
47+
LOG_FILENAME = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'logger.conf')
48+
logging.config.fileConfig(LOG_FILENAME)
49+

config/settings.py

+143
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
import logging
2+
import os
3+
4+
import django
5+
6+
# Base paths
7+
DJANGO_ROOT = os.path.dirname(os.path.realpath(django.__file__))
8+
SITE_ROOT = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
9+
10+
# Debugging
11+
DEBUG = True
12+
TEMPLATE_DEBUG = DEBUG
13+
14+
ADMINS = (
15+
# ('Your Name', '[email protected]'),
16+
)
17+
18+
MANAGERS = ADMINS
19+
20+
DATABASES = {
21+
'default': {
22+
'ENGINE': 'django.contrib.gis.db.backends.postgis', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
23+
'NAME': 'boundaryservice', # Or path to database file if using sqlite3.
24+
'USER': 'boundaryservice', # Not used with sqlite3.
25+
'PASSWORD': 'dMQlbUCftr', # Not used with sqlite3.
26+
'HOST': 'localhost', # Set to empty string for localhost. Not used with sqlite3.
27+
'PORT': '5432', # Set to empty string for default. Not used with sqlite3.
28+
}
29+
}
30+
31+
# Local time
32+
TIME_ZONE = 'America/Chicago'
33+
34+
# Local language
35+
LANGUAGE_CODE = 'en-us'
36+
37+
# Site framework
38+
SITE_ID = 1
39+
40+
# If you set this to False, Django will make some optimizations so as not
41+
# to load the internationalization machinery.
42+
USE_I18N = True
43+
44+
# If you set this to False, Django will not format dates, numbers and
45+
# calendars according to the current locale
46+
USE_L10N = True
47+
48+
# Absolute path to the directory that holds media.
49+
MEDIA_ROOT = os.path.join(SITE_ROOT, 'media')
50+
51+
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
52+
# trailing slash if there is a path component (optional in other cases).
53+
# Examples: "http://media.lawrence.com", "http://example.com/media/"
54+
MEDIA_URL = '/site_media/'
55+
56+
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
57+
# trailing slash.
58+
# Examples: "http://foo.com/media/", "/media/".
59+
ADMIN_MEDIA_PREFIX = '/media/'
60+
61+
# Make this unique, and don't share it with anybody.
62+
SECRET_KEY = '+t(q+ljogaj(+7m@kueu-g881gb8xp_oaz)$iabxjp8a1@2#u!'
63+
64+
# List of callables that know how to import templates from various sources.
65+
TEMPLATE_LOADERS = (
66+
'django.template.loaders.filesystem.Loader',
67+
'django.template.loaders.app_directories.Loader',
68+
'django.template.loaders.eggs.Loader',
69+
)
70+
71+
TEMPLATE_CONTEXT_PROCESSORS = (
72+
'django.contrib.auth.context_processors.auth',
73+
'django.core.context_processors.media',
74+
)
75+
76+
MIDDLEWARE_CLASSES = (
77+
'django.middleware.cache.UpdateCacheMiddleware',
78+
'django.middleware.common.CommonMiddleware',
79+
# 'django.contrib.sessions.middleware.SessionMiddleware',
80+
'django.middleware.csrf.CsrfViewMiddleware',
81+
# 'django.contrib.auth.middleware.AuthenticationMiddleware',
82+
# 'django.contrib.messages.middleware.MessageMiddleware',
83+
'debug_toolbar.middleware.DebugToolbarMiddleware',
84+
'django.middleware.cache.FetchFromCacheMiddleware',
85+
)
86+
87+
ROOT_URLCONF = 'config.urls'
88+
89+
TEMPLATE_DIRS = (
90+
os.path.join(SITE_ROOT, 'templates')
91+
)
92+
93+
INSTALLED_APPS = (
94+
'django.contrib.contenttypes',
95+
'django.contrib.sites',
96+
'django.contrib.admin',
97+
'django.contrib.admindocs',
98+
'django.contrib.sessions',
99+
'django.contrib.auth',
100+
'django.contrib.humanize',
101+
'django.contrib.gis',
102+
'django.contrib.sitemaps',
103+
104+
'tastypie',
105+
106+
'boundaryservice',
107+
108+
'newsapps.templatelib',
109+
'demo',
110+
)
111+
112+
# Predefined domain
113+
MY_SITE_DOMAIN = 'localhost:8000'
114+
115+
# Email
116+
# run "python -m smtpd -n -c DebuggingServer localhost:1025" to see outgoing
117+
# messages dumped to the terminal
118+
EMAIL_HOST = 'localhost'
119+
EMAIL_PORT = 1025
120+
DEFAULT_FROM_EMAIL = '[email protected]'
121+
122+
# Caching
123+
CACHE_MIDDLEWARE_KEY_PREFIX='boundaryservice'
124+
CACHE_MIDDLEWARE_SECONDS=90 * 60 # 90 minutes
125+
126+
CACHES = {
127+
'default': {
128+
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
129+
}
130+
}
131+
132+
API_DOMAIN = 'localhost:8000'
133+
134+
# Logging
135+
logging.basicConfig(
136+
level=logging.DEBUG,
137+
)
138+
139+
# Allow for local (per-user) override
140+
try:
141+
from local_settings import *
142+
except ImportError:
143+
pass

config/staging/__init__.py

Whitespace-only changes.

config/staging/apache

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<VirtualHost *:80>
2+
ServerName boundaryservice.beta.hacktyler.com
3+
ServerAlias www.boundaryservice.beta.hacktyler.com
4+
5+
SetEnv DEPLOYMENT_TARGET staging
6+
WSGIScriptAlias / /home/ubuntu/sites/boundaryservice/application.wsgi
7+
<Directory /home/ubuntu/sites/boundaryservice/repository>
8+
Order deny,allow
9+
Allow from all
10+
</Directory>
11+
12+
Redirect permanent /favicon.ico http://media.beta.hacktyler.com/boundaryservice/media/favicon.ico
13+
14+
Alias /robots.txt /home/ubuntu/sites/boundaryservice/repository/media/robots.txt
15+
16+
ErrorLog /home/ubuntu/logs/boundaryservice.error.log
17+
LogLevel warn
18+
19+
SetEnvIf X-Forwarded-For "^.*\..*\..*\..*" is-forwarder
20+
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
21+
LogFormat "[%h] %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio2
22+
CustomLog /home/ubuntu/logs/boundaryservice.access.log combinedio env=is-forwarder
23+
CustomLog /home/ubuntu/logs/boundaryservice.access.log combinedio2 env=!is-forwarder
24+
25+
ServerSignature Off
26+
27+
RewriteEngine on
28+
# canonical hostname
29+
RewriteCond %{HTTP_HOST} !^boundaryservice.beta.hacktyler.com [NC]
30+
RewriteRule ^/(.*) http://boundaryservice.beta.hacktyler.com/$1 [L,R]
31+
32+
RewriteCond %{REQUEST_URI} /maintenance.html$
33+
RewriteRule $ / [R=302,L]
34+
</VirtualHost>

0 commit comments

Comments
 (0)