Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Internet > Django Plugins

    django-multihost 0.3

    Download button

    No screenshots available
    Downloads: 170  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    James Addison | More programs
    BSD License / FREE
    August 31st, 2010, 10:52 GMT
    ROOT / Internet / Django Plugins

     Read user reviews (0)  Refer to a friend  Subscribe

    django-multihost description

    Simple multihost handling for Django

    django-multihost is a Django middleware that overrides Site ORM functionality and gets the current Site from the Host header. The code is loosely based on the work done by Bruce Kroeze here: django-threaded-multihost.

    The MultiHostMiddleware class contained in this app has 2 tasks:

     1. Upon middleware __init__(), it overrides SiteManager.get_current() with a multihost-aware version that reads the Host header from the request and attempts to find a matching Site (caches it if cache is enabled).
     2. Upon middleware process_request(), it sets the request into threadlocal storage and then uses the new SiteManager.get_current() functionality to retrieve the Site matching the Host header and sets it into the request instance. If a match is not found and MULTIHOST_AUTO_WWW is True (the default), it will attempt to modify the Host URL to add/remove www. and attempt the lookup again. If it still doesn't find a matching Site, it redirects to MULTIHOST_REDIRECT_URL.

    Installation

     1. Copy or symlink the multihost package into your django project directory or install it by running one of the following commands:

     python setup.py install

     or

     pip install django-multihost

     or

     easy_install django-multihost

     2. Add MULTIHOST_REDIRECT_URL to settings.py
     3. Add multihost.middleware.MultiHostMiddleware to your MIDDLEWARE_CLASSES in at the end of the list. If you find it isn't working, move it up the list order as there may be a middleware conflict.

    Advanced Settings

    There are 4 settings that developers can use to override default functionality:

     * MULTIHOST_REDIRECT_URL: required; no default. The default middleware request processing will redirect to this URL in the case of Site lookup failure.
     * MULTIHOST_AUTO_WWW: optional; defaults to True. If the Site can't be found that matches the incoming Host header exactly, this will automatically try removing/adding www. and searching again.


    Product's homepage

    Requirements:

    · Python
    · Django

      


    TAGS:

    multihost handling | Django multihost | Django | multihost | handling

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM