Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

=====
Usage
=====

django-dynasite was developed to:
* manage multiple sites in a single Django app

Installation
============

Available on PyPi::

pip install django-dynasite

Configuration
=============

Add to your installed apps in your setting.py file::

INSTALLED_APPS = (
...
'dynasite',
)

Get the Site from SITE_ID or host name
=============

django.contrib.sites.models.get_current_site Replacement
Instead, use:
from dynasite.models import get_current_site
...
site = get_current_site(request)

Will fetch the site from the SITE_ID setting if defined. Otherwise, will try to match the hostname to a domain defined in django.contrib.sites.models.Site. Caching is used.

Add site variables to context to use in your Web app templates
=============

Simply add this middleware to your settings:

TEMPLATE_CONTEXT_PROCESSORS = (
...
'dynasite.context_processors.dynasite_context_processor',
...
)

Then, in your template, you have access to the 'dynasite' variable:

dynasite.site -> returns the current site
dynasite.site_url -> returns the current site's complete url. Takes into account if in secure mode or not.

Replace cache middleware to take into account varying host names
=============

By default, Django uses the full path of pages when creating keys for caching. However, it doesn't take into account the full URI when building the keys. If page templates change by host name, change your caching middleware:

MIDDLEWARE_CLASSES = (
'dynasite.middleware.UpdateCacheMiddleware',
...
'dynasite.middleware.FetchFromCacheMiddleware',
...

LICENSE
=======

Copyright (c) 2013 Jerome Paradis and contributors

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

Release files for django-dynasite 0.1beta3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-dynasite 0.1beta3
File Size Uploaded
django-dynasite-0.1beta3.tar.gz 6.1 kB Details

Release files / django-dynasite-0.1beta3.tar.gz

Download URL django-dynasite-0.1beta3.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
94fa39999a5602a711a961c9e6498833b9c9b159100cef8074431ee74def3377
BLAKE2b-256 checksum
How to use checksums
9511a1aa7b70a4da5c0cc2411749ca35cc7e957ea93cd22852d4d1b8836eba8d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1beta3 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page