Skip to content

Commit 009973f

Browse files
author
Caleb Brown
committed
brought over blackrobot's django skeleton
1 parent 73b2bbd commit 009973f

File tree

5 files changed

+181
-0
lines changed

5 files changed

+181
-0
lines changed

deploy/deploy.wsgi

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import os
2+
import sys
3+
import site
4+
5+
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
6+
os.environ['PYTHON_EGG_CACHE'] = '/var/www/django/.python-eggs'
7+
8+
site.addsitedir('/var/www/django/<domain>/env/lib/python2.6/site-packages')
9+
sys.path.append('/var/www/django/<domain>/src')
10+
11+
import django.core.handlers.wsgi
12+
application = django.core.handlers.wsgi.WSGIHandler()

src/__init__.py

Whitespace-only changes.

src/manage.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env python
2+
from django.core.management import execute_manager
3+
try:
4+
import settings # Assumed to be in the same directory.
5+
except ImportError:
6+
import sys
7+
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__)
8+
sys.exit(1)
9+
10+
if __name__ == "__main__":
11+
execute_manager(settings)

src/settings.py

+137
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
# vim: ai ts=4 sts=4 et sw=4
2+
import os
3+
import socket
4+
from sys import argv
5+
6+
# Django settings for scribblitt project.
7+
8+
# Set DEBUG = True if on the production server
9+
LOCAL_SERVER_ARGS = ('runserver', 'runserver_plus', 'runprofileserver', )
10+
if len(set(argv) & set(LOCAL_SERVER_ARGS)) > 0:
11+
DEBUG = True
12+
else:
13+
DEBUG = False
14+
15+
TEMPLATE_DEBUG = DEBUG
16+
17+
ADMINS = (
18+
('Damon Jablons', '[email protected]'),
19+
)
20+
21+
MANAGERS = ADMINS
22+
23+
DATABASES = {
24+
'default': {
25+
'ENGINE': 'django.db.backends.sqlite3',
26+
'NAME': ''
27+
}
28+
}
29+
30+
# Local time zone for this installation. Choices can be found here:
31+
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
32+
# although not all choices may be available on all operating systems.
33+
# If running in a Windows environment this must be set to the same as your
34+
# system time zone.
35+
TIME_ZONE = 'America/New_York'
36+
37+
# Language code for this installation. All choices can be found here:
38+
# http://www.i18nguy.com/unicode/language-identifiers.html
39+
LANGUAGE_CODE = 'en-us'
40+
41+
SITE_ID = 1
42+
43+
# If you set this to False, Django will make some optimizations so as not
44+
# to load the internationalization machinery.
45+
USE_I18N = False
46+
47+
# This dynamically discovers the path to the project
48+
PROJECT_PATH = os.path.realpath(os.path.dirname(__file__))
49+
50+
# Absolute path to the directory that holds media.
51+
# Example: "/home/media/media.lawrence.com/"
52+
MEDIA_ROOT = os.path.join(PROJECT_PATH, 'media')
53+
54+
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
55+
# trailing slash if there is a path component (optional in other cases).
56+
# Examples: "http://media.lawrence.com", "http://example.com/media/"
57+
MEDIA_URL = '/media/'
58+
59+
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
60+
# trailing slash.
61+
# Examples: "http://foo.com/media/", "/media/".
62+
ADMIN_MEDIA_PREFIX = '%sadmin-media/' % MEDIA_URL
63+
64+
# Make this unique, and don't share it with anybody.
65+
SECRET_KEY = ''
66+
67+
# List of callables that know how to import templates from various sources.
68+
TEMPLATE_LOADERS = (
69+
'django.template.loaders.filesystem.load_template_source',
70+
'django.template.loaders.app_directories.load_template_source',
71+
)
72+
73+
# Context Processors
74+
TEMPLATE_CONTEXT_PROCESSORS = (
75+
'django.core.context_processors.auth',
76+
'django.core.context_processors.media',
77+
'django.core.context_processors.request',
78+
)
79+
80+
if DEBUG:
81+
TEMPLATE_CONTEXT_PROCESSORS += ('django.core.context_processors.debug',)
82+
if USE_I18N:
83+
TEMPLATE_CONTEXT_PROCESSORS += ('django.core.context_processors.i18n',)
84+
85+
MIDDLEWARE_CLASSES = (
86+
'django.middleware.common.CommonMiddleware',
87+
'django.contrib.sessions.middleware.SessionMiddleware',
88+
'django.contrib.auth.middleware.AuthenticationMiddleware',
89+
)
90+
91+
if DEBUG:
92+
MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
93+
94+
ROOT_URLCONF = 'urls'
95+
96+
TEMPLATE_DIRS = ()
97+
for root, dirs, files in os.walk(PROJECT_PATH):
98+
if 'templates' in dirs: TEMPLATE_DIRS += (os.path.join(root, 'templates'),)
99+
100+
INSTALLED_APPS = (
101+
# Django Applications
102+
'django.contrib.auth',
103+
'django.contrib.contenttypes',
104+
'django.contrib.sessions',
105+
'django.contrib.sites',
106+
'django.contrib.admin',
107+
'django.contrib.admindocs',
108+
109+
# Third Party Django Applications
110+
'django_extensions',
111+
'sorl.thumbnail',
112+
113+
# Project Applications
114+
)
115+
116+
if DEBUG:
117+
INSTALLED_APPS += ('debug_toolbar',)
118+
119+
TEMPLATE_TAGS = (
120+
'sorl.thumbnail.templatetags.thumbnail',
121+
)
122+
123+
# SORL Settings
124+
THUMBNAIL_EXTENSION = 'jpg'
125+
126+
INTERNAL_IPS = (
127+
'127.0.0.1',
128+
)
129+
130+
DEBUG_TOOLBAR_CONFIG = {
131+
'INTERCEPT_REDIRECTS': False,
132+
}
133+
134+
try:
135+
from local_settings import *
136+
except ImportError:
137+
pass

src/urls.py

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from django.conf.urls.defaults import *
2+
3+
# Uncomment the next two lines to enable the admin:
4+
# from django.contrib import admin
5+
# admin.autodiscover()
6+
7+
urlpatterns = patterns('',
8+
# Example:
9+
# (r'^pictela/', include('pictela.foo.urls')),
10+
11+
# Uncomment the admin/doc line below and add 'django.contrib.admindocs'
12+
# to INSTALLED_APPS to enable admin documentation:
13+
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),
14+
15+
# Uncomment the next line to enable the admin:
16+
# (r'^admin/', include(admin.site.urls)),
17+
)
18+
19+
import sys
20+
if 'runserver' in sys.argv or 'runserver_plus':
21+
urlpatterns = patterns('', url(r'^media/(.*)$', 'django.views.static.serve', kwargs={'document_root': os.path.join(settings.PROJECT_PATH, 'media')}), ) + urlpatterns

0 commit comments

Comments
 (0)