Skip to main content

Utils for Django's sites framework

Project description

With django-sitesutils you’re able to access current site, using everywhere you can access request object.

Current site is detected using host domain from request object and SITE_ID project setting as a fallback. If site is found, then is set to the respective Site model object from app, otherwise is a django.contrib.sites.models.RequestSite instance.


  1. Install django-sitesutils using pip:

    $ pip install django-sitesutils
  2. Add RequestSiteMiddleware to your MIDDLEWARE_CLASSES setting:

        # ...

    This middleware will set site attribute for the request object. This attribute is evaluated lazily, only when you access it.

  3. If you want to access current site in templates, add site context processor to your TEMPLATE_CONTEXT_PROCESSORS settings:

        # ...


Feel free to fork, send pull requests or report bugs and issues on github.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
django-sitesutils-0.1.2.tar.gz (4.3 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page