Skip to content

Commit 7531d5c

Browse files
author
Fred Wenzel
committed
Django 1.2 project.
1 parent 0647eca commit 7531d5c

File tree

5 files changed

+194
-0
lines changed

5 files changed

+194
-0
lines changed

__init__.py

Whitespace-only changes.

log_settings.py

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import logging
2+
import logging.handlers
3+
4+
from django.conf import settings
5+
6+
7+
# Loggers created under the "reporter" namespace, e.g. "reporter.caching", will
8+
# inherit the configuration from the base logger.
9+
log = logging.getLogger('reporter')
10+
11+
level = settings.LOG_LEVEL
12+
13+
if settings.DEBUG:
14+
fmt = ('%(asctime)s %(name)s:%(levelname)s %(message)s '
15+
':%(pathname)s:%(lineno)s')
16+
fmt = getattr(settings, 'LOG_FORMAT', fmt)
17+
handler = logging.StreamHandler()
18+
formatter = logging.Formatter(fmt, datefmt='%H:%M:%S')
19+
else:
20+
fmt = '%s: %s' % (settings.SYSLOG_TAG,
21+
'%(name)s:%(levelname)s %(message)s :%(pathname)s:%(lineno)s')
22+
fmt = getattr(settings, 'SYSLOG_FORMAT', fmt)
23+
SysLogger = logging.handlers.SysLogHandler
24+
handler = SysLogger(facility=SysLogger.LOG_LOCAL7)
25+
formatter = logging.Formatter(fmt)
26+
27+
log.setLevel(level)
28+
handler.setLevel(level)
29+
handler.setFormatter(formatter)
30+
31+
for f in getattr(settings, 'LOG_FILTERS', []):
32+
handler.addFilter(logging.Filter(f))
33+
34+
log.addHandler(handler)

manage.py

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env python
2+
import os
3+
import site
4+
import sys
5+
6+
from django.core.management import execute_manager, setup_environ
7+
8+
ROOT = os.path.dirname(os.path.abspath(__file__))
9+
path = lambda *a: os.path.join(ROOT, *a)
10+
11+
site.addsitedir(path('apps'))
12+
#site.addsitedir(path('lib'))
13+
14+
try:
15+
import settings_local as settings
16+
except ImportError:
17+
try:
18+
import settings # Assumed to be in the same directory.
19+
except ImportError:
20+
import sys
21+
sys.stderr.write(
22+
"Error: Tried importing 'settings_local.py' and 'settings.py' "
23+
"but neither could be found (or they're throwing an ImportError)."
24+
" Please come back and try again later.")
25+
raise
26+
27+
# The first thing execute_manager does is call `setup_environ`. Logging config
28+
# needs to access settings, so we'll setup the environ early.
29+
setup_environ(settings)
30+
31+
# Import for side-effect: configures our logging handlers.
32+
import log_settings
33+
34+
35+
if __name__ == "__main__":
36+
execute_manager(settings)

settings.py

+107
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# Django settings for the reporter project.
2+
3+
import os
4+
import logging
5+
6+
# Make filepaths relative to settings.
7+
ROOT = os.path.dirname(os.path.abspath(__file__))
8+
path = lambda *a: os.path.join(ROOT, *a)
9+
10+
ROOT_PACKAGE = os.path.basename(ROOT)
11+
12+
13+
DEBUG = False
14+
TEMPLATE_DEBUG = DEBUG
15+
16+
LOG_LEVEL = logging.DEBUG
17+
SYSLOG_TAG = "http_app_reporter"
18+
19+
ADMINS = (
20+
# ('Your Name', '[email protected]'),
21+
)
22+
23+
MANAGERS = ADMINS
24+
25+
DATABASES = {
26+
'default': {
27+
'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
28+
'NAME': '', # Or path to database file if using sqlite3.
29+
'USER': '', # Not used with sqlite3.
30+
'PASSWORD': '', # Not used with sqlite3.
31+
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
32+
'PORT': '', # Set to empty string for default. Not used with sqlite3.
33+
}
34+
}
35+
36+
# Local time zone for this installation. Choices can be found here:
37+
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
38+
# although not all choices may be available on all operating systems.
39+
# On Unix systems, a value of None will cause Django to use the same
40+
# timezone as the operating system.
41+
# If running in a Windows environment this must be set to the same as your
42+
# system time zone.
43+
TIME_ZONE = 'America/Los_Angeles'
44+
45+
# Language code for this installation. All choices can be found here:
46+
# http://www.i18nguy.com/unicode/language-identifiers.html
47+
LANGUAGE_CODE = 'en-us'
48+
49+
SITE_ID = 1
50+
51+
# If you set this to False, Django will make some optimizations so as not
52+
# to load the internationalization machinery.
53+
USE_I18N = True
54+
55+
# If you set this to False, Django will not format dates, numbers and
56+
# calendars according to the current locale
57+
USE_L10N = True
58+
59+
# Absolute path to the directory that holds media.
60+
# Example: "/home/media/media.lawrence.com/"
61+
MEDIA_ROOT = path('media')
62+
63+
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
64+
# trailing slash if there is a path component (optional in other cases).
65+
# Examples: "http://media.lawrence.com", "http://example.com/media/"
66+
MEDIA_URL = '/media/'
67+
68+
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
69+
# trailing slash.
70+
# Examples: "http://foo.com/media/", "/media/".
71+
ADMIN_MEDIA_PREFIX = '/admin-media/'
72+
73+
# Make this unique, and don't share it with anybody.
74+
SECRET_KEY = '^e*0du@u83$de+==+x$5k%x#+4v7&nm-_sggrr(t!&@kufz87n'
75+
76+
# Templates
77+
78+
TEMPLATE_DIRS = (
79+
path('templates'),
80+
)
81+
82+
# List of callables that know how to import templates from various sources.
83+
TEMPLATE_LOADERS = (
84+
'django.template.loaders.filesystem.Loader',
85+
'django.template.loaders.app_directories.Loader',
86+
# 'django.template.loaders.eggs.Loader',
87+
)
88+
89+
MIDDLEWARE_CLASSES = (
90+
'django.middleware.common.CommonMiddleware',
91+
'django.contrib.sessions.middleware.SessionMiddleware',
92+
'django.middleware.csrf.CsrfViewMiddleware',
93+
'django.contrib.auth.middleware.AuthenticationMiddleware',
94+
'django.contrib.messages.middleware.MessageMiddleware',
95+
)
96+
97+
ROOT_URLCONF = 'reporter.urls'
98+
99+
INSTALLED_APPS = (
100+
'django.contrib.auth',
101+
'django.contrib.contenttypes',
102+
'django.contrib.sessions',
103+
'django.contrib.sites',
104+
'django.contrib.messages',
105+
# Uncomment the next line to enable the admin:
106+
# 'django.contrib.admin',
107+
)

urls.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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'^reporter/', include('reporter.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+
)

0 commit comments

Comments
 (0)