forked from reverie/yourworldoftext
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Andrew Badr
committed
Jul 25, 2010
0 parents
commit 7bf34c2
Showing
52 changed files
with
10,713 additions
and
0 deletions.
There are no files selected for viewing
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,3 @@ | ||
*.pyc | ||
*.swp | ||
localsettings.py |
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,8 @@ | ||
import os, sys | ||
sys.path.append('/var/www/yourworld/') | ||
sys.path.append('/var/www/') | ||
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' | ||
|
||
import django.core.handlers.wsgi | ||
|
||
application = django.core.handlers.wsgi.WSGIHandler() |
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,7 @@ | ||
<VirtualHost *> | ||
ServerName yourserver.example.com | ||
ServerAdmin [email protected] | ||
Alias /static/ /var/www/yourworldoftext/static/ | ||
Alias /media/ /usr/lib/python2.6/site-packages/django/contrib/admin/media/ | ||
WSGIScriptAlias / /var/www/yourworldoftext/apache/wsgi.py | ||
</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,19 @@ | ||
import os, re | ||
|
||
def here(*args): | ||
return os.path.join(os.path.abspath(os.path.dirname(__file__)), *args) | ||
|
||
def req_render_to_response(request, template, context=None): | ||
from django.shortcuts import render_to_response | ||
from django.template import RequestContext | ||
context = context or {} | ||
rc = RequestContext(request, context) | ||
return render_to_response(template, context_instance=rc) | ||
|
||
# This block is from http://stackoverflow.com/questions/92438/ | ||
control_chars = ''.join(map(unichr, range(0,32) + range(127,160))) | ||
control_chars_set = set(control_chars) | ||
control_char_re = re.compile('[%s]' % re.escape(control_chars)) | ||
def remove_control_chars(s): | ||
return control_char_re.sub('', s) | ||
|
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,26 @@ | ||
#http://www.djangosnippets.org/snippets/1478/ | ||
|
||
from django.db import models | ||
from django.core.serializers.json import DjangoJSONEncoder | ||
from django.utils import simplejson as json | ||
|
||
class DictField(models.TextField): | ||
"""DictField is a textfield that contains JSON-serialized dictionaries.""" | ||
|
||
# Used so to_python() is called | ||
__metaclass__ = models.SubfieldBase | ||
|
||
def to_python(self, value): | ||
"""Convert our string value to JSON after we load it from the DB""" | ||
if isinstance(value, dict): | ||
return value | ||
value = json.loads(value) | ||
assert isinstance(value, dict) | ||
return value | ||
|
||
def get_db_prep_save(self, value): | ||
"""Convert our JSON object to a string before we save""" | ||
assert isinstance(value, dict) | ||
value = json.dumps(value, cls=DjangoJSONEncoder) | ||
return super(DictField, self).get_db_prep_save(value) | ||
|
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,41 @@ | ||
import os, logging, logging.handlers, time | ||
|
||
from django.conf import settings | ||
|
||
def _mkdir(newdir): | ||
# Copied from http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/82465 | ||
"""works the way a good mkdir should :) | ||
- already exists, silently complete | ||
- regular file in the way, raise an exception | ||
- parent directory(ies) does not exist, make them as well | ||
""" | ||
if os.path.isdir(newdir): | ||
pass | ||
elif os.path.isfile(newdir): | ||
raise OSError("a file with the same name as the desired " \ | ||
"dir, '%s', already exists." % newdir) | ||
else: | ||
head, tail = os.path.split(newdir) | ||
if head and not os.path.isdir(head): | ||
_mkdir(head) | ||
if tail: | ||
os.mkdir(newdir) | ||
|
||
_mkdir(settings.LOG_DIRECTORY) | ||
|
||
filename = settings.LOG_DIRECTORY + '/application.log' | ||
|
||
logger = logging.getLogger('default') | ||
handler = logging.handlers.RotatingFileHandler(filename, maxBytes=10*1024*1024, backupCount=10) | ||
formatter = logging.Formatter("%(asctime)s - %(levelname)s - %(message)s") | ||
handler.setFormatter(formatter) | ||
logger.addHandler(handler) | ||
|
||
logger.setLevel(1) # 0 seems to skip DEBUG messages, contrary to the docs | ||
|
||
debug = logger.debug | ||
info = logger.info | ||
warning = logger.warning | ||
error = logger.error | ||
critical = logger.critical | ||
exception = logger.exception |
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,11 @@ | ||
#!/usr/bin/env python | ||
from django.core.management import execute_manager | ||
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) |
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,2 @@ | ||
Django==1.2.1 | ||
django-registration==0.7 |
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,83 @@ | ||
from helpers import here | ||
|
||
DEBUG = True | ||
TEMPLATE_DEBUG = DEBUG | ||
|
||
ADMINS = ( | ||
) | ||
|
||
MANAGERS = ADMINS | ||
|
||
DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. | ||
DATABASE_NAME = 'ywot.sqlite' # Or path to database file if using sqlite3. | ||
DATABASE_USER = '' # Not used with sqlite3. | ||
DATABASE_PASSWORD = '' # Not used with sqlite3. | ||
DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. | ||
DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3. | ||
|
||
TIME_ZONE = 'America/Los_Angeles' | ||
|
||
LANGUAGE_CODE = 'en-us' | ||
|
||
SITE_ID = 1 | ||
|
||
USE_I18N = False | ||
|
||
# Absolute path to the directory that holds media. | ||
# Example: "/home/media/media.lawrence.com/" | ||
MEDIA_ROOT = '' | ||
|
||
# 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/' | ||
|
||
SECRET_KEY = 'default' | ||
|
||
# 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', | ||
) | ||
|
||
MIDDLEWARE_CLASSES = ( | ||
'django.middleware.common.CommonMiddleware', | ||
'django.contrib.sessions.middleware.SessionMiddleware', | ||
'django.contrib.auth.middleware.AuthenticationMiddleware', | ||
'django.middleware.csrf.CsrfViewMiddleware', | ||
) | ||
|
||
ROOT_URLCONF = 'yourworld.urls' | ||
|
||
TEMPLATE_DIRS = ( | ||
here('templates') | ||
) | ||
|
||
INSTALLED_APPS = ( | ||
'django.contrib.auth', | ||
'django.contrib.contenttypes', | ||
'django.contrib.sessions', | ||
'django.contrib.sites', | ||
'registration', | ||
'ywot', | ||
) | ||
|
||
DEFAULT_FROM_EMAIL = SERVER_EMAIL = '"Your World of Text" <[email protected]>' | ||
|
||
# You should change this | ||
LOG_DIRECTORY = './log/' | ||
|
||
ACCOUNT_ACTIVATION_DAYS = 3 | ||
|
||
try: | ||
from localsettings import * | ||
except: | ||
pass | ||
|
||
assert DEBUG or (SECRET_KEY != 'default'), "Change the secret key." |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,35 @@ | ||
/* ----------------------------------------------------------------------- | ||
Blueprint CSS Framework 0.9 | ||
http://blueprintcss.org | ||
* Copyright (c) 2007-Present. See LICENSE for more info. | ||
* See README for instructions on how to use Blueprint. | ||
* For credits and origins, see AUTHORS. | ||
* This is a compressed file. See the sources in the 'src' directory. | ||
----------------------------------------------------------------------- */ | ||
|
||
/* ie.css */ | ||
body {text-align:center;} | ||
.container {text-align:left;} | ||
* html .column, * html .span-1, * html .span-2, * html .span-3, * html .span-4, * html .span-5, * html .span-6, * html .span-7, * html .span-8, * html .span-9, * html .span-10, * html .span-11, * html .span-12, * html .span-13, * html .span-14, * html .span-15, * html .span-16, * html .span-17, * html .span-18, * html .span-19, * html .span-20, * html .span-21, * html .span-22, * html .span-23, * html .span-24 {display:inline;overflow-x:hidden;} | ||
* html legend {margin:0px -8px 16px 0;padding:0;} | ||
sup {vertical-align:text-top;} | ||
sub {vertical-align:text-bottom;} | ||
html>body p code {*white-space:normal;} | ||
hr {margin:-8px auto 11px;} | ||
img {-ms-interpolation-mode:bicubic;} | ||
.clearfix, .container {display:inline-block;} | ||
* html .clearfix, * html .container {height:1%;} | ||
fieldset {padding-top:0;} | ||
textarea {overflow:auto;} | ||
input.text, input.title, textarea {background-color:#fff;border:1px solid #bbb;} | ||
input.text:focus, input.title:focus {border-color:#666;} | ||
input.text, input.title, textarea, select {margin:0.5em 0;} | ||
input.checkbox, input.radio {position:relative;top:.25em;} | ||
form.inline div, form.inline p {vertical-align:middle;} | ||
form.inline label {position:relative;top:-0.25em;} | ||
form.inline input.checkbox, form.inline input.radio, form.inline input.button, form.inline button {margin:0.5em 0;} | ||
button, input.button {position:relative;top:0.25em;} |
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 @@ | ||
/* ----------------------------------------------------------------------- | ||
Blueprint CSS Framework 0.9 | ||
http://blueprintcss.org | ||
* Copyright (c) 2007-Present. See LICENSE for more info. | ||
* See README for instructions on how to use Blueprint. | ||
* For credits and origins, see AUTHORS. | ||
* This is a compressed file. See the sources in the 'src' directory. | ||
----------------------------------------------------------------------- */ | ||
|
||
/* print.css */ | ||
body {line-height:1.5;font-family:"Helvetica Neue", Arial, Helvetica, sans-serif;color:#000;background:none;font-size:10pt;} | ||
.container {background:none;} | ||
hr {background:#ccc;color:#ccc;width:100%;height:2px;margin:2em 0;padding:0;border:none;} | ||
hr.space {background:#fff;color:#fff;visibility:hidden;} | ||
h1, h2, h3, h4, h5, h6 {font-family:"Helvetica Neue", Arial, "Lucida Grande", sans-serif;} | ||
code {font:.9em "Courier New", Monaco, Courier, monospace;} | ||
a img {border:none;} | ||
p img.top {margin-top:0;} | ||
blockquote {margin:1.5em;padding:1em;font-style:italic;font-size:.9em;} | ||
.small {font-size:.9em;} | ||
.large {font-size:1.1em;} | ||
.quiet {color:#999;} | ||
.hide {display:none;} | ||
a:link, a:visited {background:transparent;font-weight:700;text-decoration:underline;} | ||
a:link:after, a:visited:after {content:" (" attr(href) ")";font-size:90%;} |
Oops, something went wrong.