README
Get the code via git:
git clone git://github.com/ecometrica/django-multisite.git django-multisite
Add the django-multisite/multisite folder to your PYTHONPATH.
Quickstart
Replace your SITE_ID in settings.py to:
from multisite import SiteID SITE_ID = SiteID()
Add to settings.py TEMPLATE_LOADERS:
TEMPLATE_LOADERS = (
'multisite.template_loader.Loader',
'django.template.loaders.app_directories.Loader',
)
Edit to settings.py MIDDLEWARE_CLASSES:
MIDDLEWARE_CLASSES = (
...
'multisite.middleware.DynamicSiteMiddleware',
...
)
Append to settings.py, in order to use a custom cache that can be safely cleared:
# The cache connection to use for django-multisite. # Default: 'default' CACHE_MULTISITE_ALIAS = 'multisite' # The cache key prefix that django-multisite should use. # Default: '' (Empty string) CACHE_MULTISITE_KEY_PREFIX = ''
If you have set CACHE_MULTISITE_ALIAS to a custom value, e.g. 'multisite', add a separate backend to settings.py CACHES:
CACHES = {
'default': {
...
},
'multisite': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
'TIMEOUT': 60 * 60 * 24, # 24 hours
...
},
}
Domain fallbacks
By default, if the domain name is unknown, multisite will respond with an HTTP 404 Not Found error. To change this behaviour, add to settings.py:
# The view function or class-based view that django-multisite will
# use when it cannot match the hostname with a Site. This can be
# the name of the function or the function itself.
# Default: None
MULTISITE_FALLBACK = 'django.views.generic.base.RedirectView
# Keyword arguments for the MULTISITE_FALLBACK view.
# Default: {}
MULTISITE_FALLBACK_KWARGS = {'url': 'http://example.com/',
'permanent': False}
Create a directory settings.TEMPLATE_DIRS directory with the names of domains, such as:
mkdir templates/example.com
Metadata
Release files for django-multisite 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-multisite-0.5.0.tar.gz | 21.3 kB | Without provenance | Details for django-multisite-0.5.0.tar.gz |
Release files / django-multisite-0.5.0.tar.gz
| Download URL | django-multisite-0.5.0.tar.gz |
|---|---|
| Size | 21.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b1cc35914d3c1c168d7446f676d9970d1f8099130ae2ab1b185c4205bf516a56
|
|
BLAKE2b-256 checksum How to use checksums |
0362a209f8f845c77f3efa9cbb24437bd1ba152e184b4f094b20a85b83495387
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-multisite 0.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.