From 2e598146d62b74ba59027a5bdbc78d267ae33576 Mon Sep 17 00:00:00 2001 From: Mike Crute Date: Sat, 20 Apr 2013 10:55:34 -0400 Subject: Upgrading to Django 1.5 --- .hgignore | 4 ---- .hgrc | 1 - greenbox/manage.py | 11 ----------- greenbox/settings.py | 36 ++++++++++++++++++++---------------- manage.py | 10 ++++++++++ 5 files changed, 30 insertions(+), 32 deletions(-) delete mode 100644 .hgignore delete mode 100644 .hgrc delete mode 100644 greenbox/manage.py create mode 100755 manage.py diff --git a/.hgignore b/.hgignore deleted file mode 100644 index 5ab741f..0000000 --- a/.hgignore +++ /dev/null @@ -1,4 +0,0 @@ -syntax: glob -*.pyc -*.db -nohup.out diff --git a/.hgrc b/.hgrc deleted file mode 100644 index 0d20b64..0000000 --- a/.hgrc +++ /dev/null @@ -1 +0,0 @@ -*.pyc diff --git a/greenbox/manage.py b/greenbox/manage.py deleted file mode 100644 index 5e78ea9..0000000 --- a/greenbox/manage.py +++ /dev/null @@ -1,11 +0,0 @@ -#!/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) diff --git a/greenbox/settings.py b/greenbox/settings.py index e6205e2..eb4f340 100644 --- a/greenbox/settings.py +++ b/greenbox/settings.py @@ -1,4 +1,7 @@ -import os.path +import os + +PROJECT_DIR = os.path.dirname(__file__) +PUBLIC_DIR = os.path.join(PROJECT_DIR, 'site_media') SITE_ID = 1 USE_I18N = False @@ -13,30 +16,30 @@ ADMINS = ( MANAGERS = ADMINS -DATABASE_ENGINE = 'sqlite3' -DATABASE_NAME = '/srv/greenbox/greenbox.db' -#DATABASE_NAME = '/Users/mcrute/sandboxes/greenbox/src/greenbox.db' +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': '/home/crute_recipes/greenbox.db', + } +} TIME_ZONE = 'America/New_York' LANGUAGE_CODE = 'en-us' ROOT_URLCONF = 'greenbox.urls' -# Absolute path to the directory that holds media. -# Example: "/home/media/media.lawrence.com/" -MEDIA_ROOT = os.path.join(PROJECT_DIR, 'templates/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 = '/media' +MEDIA_ROOT = os.path.join(PUBLIC_DIR, 'media') +MEDIA_URL = '/site_media/media/' -SECRET_KEY = 'zki4e4!80ar7^1w6f_c2u^5#=r(7#4%0u^3il^@__#3zf^u+f)' +STATIC_ROOT = os.path.join(PUBLIC_DIR, 'static') +STATIC_URL = '/site_media/static/' -TEMPLATE_LOADERS = ( - 'django.template.loaders.filesystem.load_template_source', - 'django.template.loaders.app_directories.load_template_source', +STATICFILES_DIRS = ( + os.path.join(PROJECT_DIR, 'static'), ) +SECRET_KEY = 'zki4e4!80ar7^1w6f_c2u^5#=r(7#4%0u^3il^@__#3zf^u+f)' + MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', @@ -50,8 +53,9 @@ TEMPLATE_DIRS = ( INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', + 'django.contrib.staticfiles', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.admin', - 'greenbox.recipe', + 'recipe', ) diff --git a/manage.py b/manage.py new file mode 100755 index 0000000..1845198 --- /dev/null +++ b/manage.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python +import os +import sys + +if __name__ == "__main__": + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "greenbox.settings") + + from django.core.management import execute_from_command_line + + execute_from_command_line(sys.argv) -- cgit v1.2.3