Skip to content

Commit

Permalink
add SITES_PACKAGE configuration value to match SITES_DIR for finding …
Browse files Browse the repository at this point in the history
…urls
  • Loading branch information
wardi committed Mar 29, 2012
1 parent 8f3bc99 commit 5160cbf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.rst
Expand Up @@ -39,9 +39,10 @@ Configuration
'dynamicsiteslite.context_processors.current_site', 'dynamicsiteslite.context_processors.current_site',
) )


5. Configure dynamicsites by adding SITES_DIR, DEFAULT_HOST, and HOSTNAME_REDIRECTS to settings.py :: 5. Configure dynamicsites by adding SITES_DIR, SITES_PACKAGE, DEFAULT_HOST, and HOSTNAME_REDIRECTS to settings.py ::


SITES_DIR = os.path.join(os.path.dirname(__file__), 'sites') SITES_DIR = os.path.join(os.path.dirname(__file__), 'sites')
SITES_PACKAGE = 'sites'
DEFAULT_HOST = 'www.your-default-site.com' DEFAULT_HOST = 'www.your-default-site.com'
HOSTNAME_REDIRECTS = { HOSTNAME_REDIRECTS = {
# 'redirect-src-1.com': 'www.redirect-dest-1.com', # 'redirect-src-1.com': 'www.redirect-dest-1.com',
Expand Down
6 changes: 3 additions & 3 deletions dynamicsiteslite/middleware.py
Expand Up @@ -83,15 +83,15 @@ def process_request(self, request):
# set from where urlconf will be loaded if it exists # set from where urlconf will be loaded if it exists
try: try:
urlconf_pkg = '%s.urls' % folder_name urlconf_pkg = '%s.urls' % folder_name
__import__("sites.%s" % urlconf_pkg) __import__("%s.%s" % (settings.SITES_PACKAGE, urlconf_pkg))
self.logger.debug('using sites.%s for urlconf', self.logger.debug('using sites.%s for urlconf',
urlconf_pkg) urlconf_pkg)
self.request.urlconf = urlconf_pkg self.request.urlconf = urlconf_pkg
except ImportError: except ImportError:
# urlconf doesn't exist... skip it # urlconf doesn't exist... skip it
self.logger.debug( self.logger.debug(
'cannot find sites.%s.urls for urlconf... skipping', 'cannot find %s.%s.urls for urlconf... skipping',
folder_name) settings.SITES_PACKAGE, folder_name)
pass pass
# add site templates dir to TEMPLATE_DIRS # add site templates dir to TEMPLATE_DIRS
self.logger.debug( self.logger.debug(
Expand Down

0 comments on commit 5160cbf

Please sign in to comment.