This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description
==============
django-domains
==============


.. image:: https://badge.fury.io/py/django-domains.png
:target: http://badge.fury.io/py/django-domains

.. image:: https://travis-ci.org/marazmiki/django-domains.png?branch=master
:target: https://travis-ci.org/marazmiki/django-domains

.. image:: https://coveralls.io/repos/marazmiki/django-domains/badge.png?branch=master
:target: https://coveralls.io/r/marazmiki/django-domains?branch=master

.. image:: https://pypip.in/d/django-domains/badge.png
:target: https://pypi.python.org/pypi/django-domains


Installation
------------

1. Install the package

.. code:: bash

pip install django-domains

2. Open settings.py and add middlewares into end of MIDDLEWARE_CLASSES tuple:

.. code:: python

MIDDLEWARE_CLASSES += (
'domains.middleware.RequestMiddleware',
'domains.middleware.DynamicSiteMiddleware',
)

First middleware ``domains.middleware.RequestMiddleware`` is required, because
it sets the `request` object into local thread.

Second middleware ``domains.middleware.DynamicSiteMiddleware`` is optional. You
can use it for dynamical changing `SITE_ID` parameter corresponding site's PK
with requested domains (see Django sites framework).

If you also want to use different templates for domains, add template loaders
in begin of TEMPLATE_LOADERS tuple:

.. code:: python

TEMPLATE_LOADERS = (
'domains.loaders.filesystem.Loader',
'domains.loaders.app_directories.Loader',
# another loaders
)

3. Run tests:

.. code:: bash

./manage.py test domains

Usage
-----

If you want to use different template sets for each domains, just create
directories with name `domainname.tld` (don't forget add TEMPLATE_LOADERS
as figured in Installation) and put templates here.

Also you can use custom function that builds domain name. You must add
`DOMAINS_TEMPLATE_NAME_FUNCTION` attribute into your settings.py and
specify path to naming function.

Function must return tuple with path fragments. This fragments will be
joined into full template path with django-domains.

Expect you call this function `my_custom_template_name` and placed it in
`my/project/utils.py`:

Btw, you can access to `request` :)

.. code:: python

def my_custom_template_name(template_dir, template_name):
"""
This function generates template path in format:

{template_dir}/custom/domains/{host}/{template_name}
"""
from domains.utils import get_request

request = get_request()

return (template_dir, 'custom', 'domains', request.get_host,
template_name)


Add into your `settings.py` this line:

.. code:: python

DOMAINS_TEMPLATE_NAME_FUNCTION = 'my.project.utils.my_custom_template_name'



0.6.0
-----

* Drop support of older python versions (2.6, 3.2, 3.3)
* Drop support of older Django versions (1.6 and older)
* Add support for Python 3.5
* Add support for Django 1.9 (thanks to `Jordan Reiter <mailto:jordanreiter@gmail.com>`_
* Migrate to Django Applications API (thanks to `Jordan Reiter <mailto:jordanreiter@gmail.com>`_
* Improve PEP-0008 support and some minor code refactoring

0.5.2
-----

* Update head django versions


0.5.1
-----

* Update head django versions

0.5
---
* Added support Django 1.8
* New hook machinery

0.2
---

* Improves pep8;
+ Support for Django 1.4, Django 1.5, Django 1.6, Django1.7
+ Added Travis CI integration
Release History

Release History

0.6

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.5.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.5.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.5

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.4.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.4.0b

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django_domains-0.6-py2.py3-none-any.whl (14.9 kB) Copy SHA256 Checksum SHA256 2.7 Wheel Feb 7, 2016
django-domains-0.6.tar.bz2 (8.2 kB) Copy SHA256 Checksum SHA256 Source Feb 7, 2016
django-domains-0.6.tar.gz (9.8 kB) Copy SHA256 Checksum SHA256 Source Feb 7, 2016
django-domains-0.6.zip (18.1 kB) Copy SHA256 Checksum SHA256 Source Feb 7, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting