Skip to content
This repository has been archived by the owner on Mar 12, 2021. It is now read-only.

Commit

Permalink
Update to Django 1.2 (and some other newer versions) and some other m…
Browse files Browse the repository at this point in the history
…inor settings tweaks
  • Loading branch information
SmileyChris committed Nov 2, 2010
1 parent 69f2c33 commit e1ae6b6
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 23 deletions.
@@ -1,10 +1,8 @@
from django.conf.urls.defaults import *
from django.conf.urls.defaults import patterns, include
from django.contrib import admin


admin.autodiscover()


urlpatterns = patterns('',
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
(r'^admin/', include(admin.site.urls)),
Expand Down
Expand Up @@ -5,7 +5,13 @@

ROOT_URLCONF = 'myproject.conf.dev.urls'

# DATABASE_ENGINE = 'postgresql_psycopg2'
# DATABASE_NAME = 'myproject'
# DATABASE_USER = 'dbuser'
# DATABASE_PASSWORD = 'dbpassword'
MEDIA_ROOT = os.path.join(VAR_ROOT, 'uploads')

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'myproject',
# 'USER': 'dbuser',
# 'PASSWORD': 'dbpassword',
}
}
Expand Up @@ -4,7 +4,7 @@
CONF_MODULE = '%s.conf' % settings.PROJECT_MODULE_NAME

urlpatterns = patterns('',
(r'', include('%s.urls' % CONF_MODULE)),
(r'', include('%s.common.urls.admin' % CONF_MODULE)),
(r'', include('%s.common.urls.static' % CONF_MODULE)),
(r'', include('%s.urls' % CONF_MODULE)),
)
Expand Up @@ -8,15 +8,18 @@
)
MANAGERS = ADMINS

DATABASE_ENGINE = 'sqlite3'
# Place the SQLite database into ``[project]/conf/local/`` so it's outside of
# the repository.
DATABASE_NAME = os.path.join(PROJECT_ROOT, PROJECT_MODULE_NAME,
'conf', 'local', 'dev.db')
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(VAR_ROOT, 'dev.db'),
}
}

ROOT_URLCONF = '%s.conf.local.urls' % PROJECT_MODULE_NAME

INSTALLED_APPS += (
'django.contrib.admin',
'django.contrib.admindocs',
)

MEDIA_ROOT = os.path.join(VAR_ROOT, 'uploads')
Expand Up @@ -8,6 +8,8 @@
PROJECT_ROOT, PROJECT_MODULE_NAME = os.path.split(
os.path.dirname(os.path.realpath(myproject.__file__))
)
# This assumes the project is installed in the src directory of a virtualenv.
VAR_ROOT = os.path.join(os.path.dirname(os.path.dirname(PROJECT_ROOT)), 'var')

DEBUG = True
TEMPLATE_DEBUG = DEBUG
Expand All @@ -31,10 +33,7 @@
ADMIN_MEDIA_PREFIX = '/admin-media/'

MEDIA_URL = '/uploads/'
MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'uploads')

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(PROJECT_ROOT, PROJECT_MODULE_NAME, 'static')

This comment has been minimized.

Copy link
@mlouro

mlouro Feb 24, 2011

any reason to remove STATIC_ROOT entirely? Can we have a default value there?

This comment has been minimized.

Copy link
@SmileyChris

SmileyChris Feb 24, 2011

Author Member

I removed it due to the potential confusion about STATIC_ROOT being a collection point rather than a point where project-wide media should be installed (in the latest staticfiles iteration anyway).

Next step is to change the requirement to the new staticfiles version which mirrors Django 1.3 contrib.staticfiles. At that stage, we should be encouraging the use of STATICFILES_DIRS and django-staticfiles>=1.0.X

This comment has been minimized.

Copy link
@SmileyChris

SmileyChris Feb 24, 2011

Author Member

But yes, we should probably make STATIC_ROOT = os.path.join(VAR_ROOT, 'static')

This comment has been minimized.

Copy link
@mlouro

mlouro Feb 24, 2011

so we should also have something like:

PROJECT_STATIC_ROOT = os.path.join(PROJECT_ROOT, PROJECT_MODULE_NAME, 'static')
STATICFILES_DIRS = (PROJECT_STATIC_ROOT,)

right?

This comment has been minimized.

Copy link
@SmileyChris

SmileyChris Feb 24, 2011

Author Member

Yep, except I don't think the requirements are using staticfiles >= 1 yet. And I don't think I'd bother with PROJECT_STATIC_ROOT -- it just adds to the confusion between STATIC_ROOT being a collection point and this one being an endpoint.


ROOT_URLCONF = 'myproject.conf.urls'

Expand Down
@@ -1,14 +1,16 @@
from myproject.conf.settings import *

DEBUG=False
TEMPLATE_DEBUG=False

# Database connection info.
DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = ':memory:' # Or path to database file if using sqlite3.
DEBUG = False
TEMPLATE_DEBUG = DEBUG

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
ROOT_URLCONF = 'myproject.conf.test.urls'

INSTALLED_APPS += ('django_nose', )
INSTALLED_APPS += ('django_nose',)

TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'

0 comments on commit e1ae6b6

Please sign in to comment.