Skip to content
Browse files

refactored settings

  • Loading branch information...
1 parent 36cab31 commit f2a959dddadedf18480fc156cc8969f7e1b92a95 @hypertexthero committed May 14, 2011
Showing with 72 additions and 19 deletions.
  1. +1 −1 .gitignore
  2. +69 −17 settings_EXAMPLE.py
  3. +2 −1 urls.py
View
2 .gitignore
@@ -14,7 +14,7 @@ init.sh
# No files with passwords/etc
htusers
-# No user-uploaded media
+# No user-uploaded media or media admin files
# media/
# No packages - better to unpack these files and commit the raw source as Git has its own built in compression methods
View
86 settings_EXAMPLE.py
@@ -1,10 +1,29 @@
-# Django settings for myproject project.
-# local_settings.py is imported in the end of this file. The file local_settings.py contains either your production or development settings, and should not go into version control. See settings_local_development_EXAMPLE.py and settings_local_production_EXAMPLE.py for more information.
+# Development settings
import os
DIRNAME = os.path.dirname(__file__)
-# Language code for this installation. All choices can be found here:
+DEBUG = True
+TEMPLATE_DEBUG = DEBUG
+
+# Development database connection settings
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
+ 'NAME': '', # Or path to database file if using sqlite3.
+ 'USER': '', # Not used with sqlite3.
+ 'PASSWORD': '', # Not used with sqlite3.
+ 'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
+ 'PORT': '', # Set to empty string for default. Not used with sqlite3.
+ }
+}
+
+# Make this unique, and don't share it with anybody.
+SECRET_KEY = 'random string of ascii text here'
+
+# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
+TIME_ZONE = 'Europe/Rome'
+
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'
@@ -18,6 +37,31 @@
# calendars according to the current locale
USE_L10N = True
+# URL that handles the media served from MEDIA_ROOT. Make sure to use a
+# trailing slash.
+# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
+MEDIA_URL = '/media/'
+
+# URL prefix for static files.
+# Example: "http://media.lawrence.com/static/"
+STATIC_URL = '/static/'
+
+# Examples: "http://foo.com/static/admin/", "/static/admin/".
+# ln -s ~/django_projects/mysite/lib/python2.6/site-packages/django/contrib/admin/media/ ~/django_projects/mysite/myproject/static/admin
+ADMIN_MEDIA_PREFIX = '/static/admin/'
+
+MEDIA_ROOT = os.path.join(DIRNAME, 'media')
+STATIC_ROOT = os.path.join(DIRNAME, 'static')
+TEMPLATE_DIRS = os.path.join(DIRNAME, 'templates')
+
+# Additional locations of static files
+STATICFILES_DIRS = (
+ # Put strings here, like "/home/html/static" or "C:/www/django/static".
+ # Always use forward slashes, even on Windows.
+ # Don't forget to use absolute paths, not relative paths.
+ '',
+)
+
# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
@@ -26,18 +70,6 @@
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
-# Absolute filesystem path to the directory that will hold user-uploaded files.
-# Example: "/home/media/media.lawrence.com/media/"
-MEDIA_ROOT = os.path.join(DIRNAME, 'media')
-
-# TEMPLATE_DIRS = (
-# # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
-# # Always use forward slashes, even on Windows.
-# # Don't forget to use absolute paths, not relative paths.
-# '',
-# )
-TEMPLATE_DIRS = os.path.join(DIRNAME, 'templates')
-
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
@@ -70,5 +102,25 @@
'django.contrib.admindocs',
)
-# Importing development or production-specific settings. The file local_settings.py contains either your production or development settings, and should not go into version control. See settings_local_development_EXAMPLE.py and settings_local_production_EXAMPLE.py for more information.
-from settings_local import *
+# A sample logging configuration. The only tangible logging
+# performed by this configuration is to send an email to
+# the site admins on every HTTP 500 error.
+# See http://docs.djangoproject.com/en/dev/topics/logging for
+# more details on how to customize your logging configuration.
+# LOGGING = {
+# 'version': 1,
+# 'disable_existing_loggers': False,
+# 'handlers': {
+# 'mail_admins': {
+# 'level': 'ERROR',
+# 'class': 'django.utils.log.AdminEmailHandler'
+# }
+# },
+# 'loggers': {
+# 'django.request': {
+# 'handlers': ['mail_admins'],
+# 'level': 'ERROR',
+# 'propagate': True,
+# },
+# }
+# }
View
3 urls.py
@@ -19,7 +19,8 @@
# (r'^foo/(?P<id>\d+)/$', 'direct_to_template', {'template': 'foo_detail.html'}),
)
-# Serving static/media files could be better with Django. Here's how to do it in the development server (and use href="{{ STATIC_URL }}css/mysite.css" in mysite/myproject/templates/base.html). In production I believe it will be controlled by a setting in mysite/myproject/etc/nginx.conf
+# Serving static/media files could be better with Django. Here's how to do it in the development server (and use href="{{ STATIC_URL }}css/mysite.css" in mysite/myproject/templates/base.html). In production I believe it will be controlled by a the server's configuration, in this case (nginx), in the file mysite/myproject/etc/nginx.conf
+# http://ecarmi.org/writing/django-on-joyent/
# http://docs.djangoproject.com/en/dev/howto/static-files/#serving-static-files-in-development
from django.conf import settings

0 comments on commit f2a959d

Please sign in to comment.
Something went wrong with that request. Please try again.