django-maintenancemode-0.11.2/0000755000076600000240000000000012637427177016430 5ustar bashustaff00000000000000django-maintenancemode-0.11.2/AUTHORS0000644000076600000240000000023312636423075017466 0ustar bashustaff00000000000000django-maintenancemode is written by Remco Wendt Feel free to contact me by mail if you have any questions, or just want to say hi.django-maintenancemode-0.11.2/CHANGES0000644000076600000240000000307512637427000017411 0ustar bashustaff00000000000000Changes ======= 0.11.2 ------ - Getting ready for Django 1.10 release. - Dropped support for Django 1.3 and older. 0.11.1 ------ - Enable network specify in INTERNAL_IPS 0.11.0 ------ - Added management command to set maintenance mode on/off 0.10.1 ------ - Made sure the app runs on Django 1.8. 0.10.0 ------ - Got rid of dependency on setuptools - Added ability to exclude specific paths from maintenance mode with the ``MAINTENANCE_IGNORE_URLS`` setting. - Use RequestContext when rending the ``503.html`` template. - Use tox for running the tests instead of buildout. - Made sure the app runs on Django 1.4. 0.9.3 ----- - Minor documentation updates for the switch to github, expect more changes to follow soon. 0.9.2 ----- - Fixed an issue with setuptools, thanks for reporting this ksato9700 0.9.1 ----- - Tested django-maintenancemode with django-1.0 release (following the 1.0.X release branch) - Bundled buildout.cfg and bootstrap with the source version of the project, allowing repeatable buildout - The middleware now uses its own default config file, thanks to a patch by semente - Use INTERNAL_IPS to check for users that need access. user.is_staff will stay in place for backwards incompatibility. Thanks for the idea Joshua Works - Have setup.py sdist only distribute maintenancemode itself, no longer distribute tests and buildout stuff - Use README and CHANGES in setup.py's long_description, stolen from Jeroen's djangorecipe :) - Updated the documentation and now use pypi as the documentation source (link there from google code) 0.9 ----- First release django-maintenancemode-0.11.2/django_maintenancemode.egg-info/0000755000076600000240000000000012637427177024573 5ustar bashustaff00000000000000django-maintenancemode-0.11.2/django_maintenancemode.egg-info/dependency_links.txt0000644000076600000240000000000112637427177030641 0ustar bashustaff00000000000000 django-maintenancemode-0.11.2/django_maintenancemode.egg-info/not-zip-safe0000644000076600000240000000000112636431056027007 0ustar bashustaff00000000000000 django-maintenancemode-0.11.2/django_maintenancemode.egg-info/PKG-INFO0000644000076600000240000001330412637427177025671 0ustar bashustaff00000000000000Metadata-Version: 1.1 Name: django-maintenancemode Version: 0.11.2 Summary: django-maintenancemode allows you to temporary shutdown your site for maintenance work Home-page: http://github.com/shanx/django-maintenancemode Author: Basil Shubin Author-email: basil.shubin@gmail.com License: BSD License Download-URL: https://github.com/shanx/django-maintenancemode/zipball/master Description: django-maintenancemode ====================== django-maintenancemode is a middleware that allows you to temporary shutdown your site for maintenance work. Logged in users having staff credentials can still fully use the site as can users visiting the site from an IP address defined in Django's ``INTERNAL_IPS``. Authored by `Remco Wendt `_, and some great `contributors `_. .. image:: https://img.shields.io/pypi/v/django-maintenancemode.svg :target: https://pypi.python.org/pypi/django-maintenancemode/ .. image:: https://img.shields.io/pypi/dm/django-maintenancemode.svg :target: https://pypi.python.org/pypi/django-maintenancemode/ .. image:: https://img.shields.io/github/license/shanx/django-maintenancemode.svg :target: https://pypi.python.org/pypi/django-maintenancemode/ .. image:: https://img.shields.io/travis/shanx/django-maintenancemode.svg :target: https://travis-ci.org/shanx/django-maintenancemode/ How it works ------------ ``maintenancemode`` works the same way as handling 404 or 500 error in Django work. It adds a ``handler503`` which you can override in your main ``urls.py`` or you can add a ``503.html`` to your templates directory. * If user is logged in and staff member, the maintenance page is not displayed. * If user's IP is in ``INTERNAL_IPS``, the maintenance page is not displayed. * To override the default view which is used if the maintenance mode is enabled you can simply define a ``handler503`` variable in your ROOT_URLCONF_, similar to how you would customize other `error handlers`_, e.g. : .. code-block:: python handler503 = 'example.views.maintenance_mode' Installation ------------ 1. Either checkout ``maintenancemode`` from GitHub, or install using pip : .. code-block:: bash pip install django-maintenancemode 2. Add ``maintenancemode`` to your ``INSTALLED_APPS`` : .. code-block:: python INSTALLED_APPS = ( ... 'maintenancemode', ) 3. Add ``MaintenanceModeMiddleware`` to ``MIDDLEWARE_CLASSES``, make sure it comes after ``AuthenticationMiddleware`` : .. code-block:: python MIDDLEWARE_CLASSES = ( ... 'django.contrib.auth.middleware.AuthenticationMiddleware', 'maintenancemode.middleware.MaintenanceModeMiddleware', ) 4. Add variable called ``MAINTENANCE_MODE`` in your project's ``settings.py`` file : .. code-block:: python MAINTENANCE_MODE = True # Setting this variable to ``True`` activates the middleware. or set ``MAINTENANCE_MODE`` to ``False`` and use ``maintenance`` command : .. code-block:: shell python ./manage.py maintenance Please see ``example`` application. This application is used to manually test the functionalities of this package. This also serves as a good example... You need only Django 1.4 or above to run that. It might run on older versions but that is not tested. Configuration ------------- There are various optional configuration options you can set in your ``settings.py`` .. code-block:: python # Enable / disable maintenance mode. # Default: False MAINTENANCE_MODE = True # or ``False`` and use ``maintenance`` command # Sequence of URL path regexes to exclude from the maintenance mode. # Default: () MAINTENANCE_IGNORE_URLS = ( r'^/docs/.*', r'^/contact' ) License ------- ``django-maintenancemode`` is released under the BSD license. .. _ROOT_URLCONF: https://docs.djangoproject.com/en/dev/ref/settings/#root-urlconf .. _`error handlers`: https://docs.djangoproject.com/en/dev/topics/http/views/#customizing-error-views Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: Web Environment Classifier: Framework :: Django Classifier: Intended Audience :: Developers Classifier: Intended Audience :: System Administrators Classifier: License :: OSI Approved :: BSD License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.4 Classifier: Topic :: Internet :: WWW/HTTP Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content Requires: Django (>=1.4.2) django-maintenancemode-0.11.2/django_maintenancemode.egg-info/requires.txt0000644000076600000240000000004112637427177027166 0ustar bashustaff00000000000000django>=1.4.2 django-appconf ipy django-maintenancemode-0.11.2/django_maintenancemode.egg-info/SOURCES.txt0000644000076600000240000000122312637427177026455 0ustar bashustaff00000000000000AUTHORS CHANGES LICENSE MANIFEST.in README.rst setup.cfg setup.py django_maintenancemode.egg-info/PKG-INFO django_maintenancemode.egg-info/SOURCES.txt django_maintenancemode.egg-info/dependency_links.txt django_maintenancemode.egg-info/not-zip-safe django_maintenancemode.egg-info/requires.txt django_maintenancemode.egg-info/top_level.txt maintenancemode/__init__.py maintenancemode/conf.py maintenancemode/http.py maintenancemode/middleware.py maintenancemode/models.py maintenancemode/utils.py maintenancemode/views.py maintenancemode/management/__init__.py maintenancemode/management/commands/__init__.py maintenancemode/management/commands/maintenance.pydjango-maintenancemode-0.11.2/django_maintenancemode.egg-info/top_level.txt0000644000076600000240000000002012637427177027315 0ustar bashustaff00000000000000maintenancemode django-maintenancemode-0.11.2/LICENSE0000644000076600000240000000305312636423075017426 0ustar bashustaff00000000000000Copyright (c) 2008, Maykin Media Copyright (c) 2012, enn.io Copyright (c) 2015, Basil Shubin All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of other contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. django-maintenancemode-0.11.2/maintenancemode/0000755000076600000240000000000012637427177021557 5ustar bashustaff00000000000000django-maintenancemode-0.11.2/maintenancemode/__init__.py0000644000076600000240000000002712637426564023666 0ustar bashustaff00000000000000__version__ = '0.11.2' django-maintenancemode-0.11.2/maintenancemode/conf.py0000644000076600000240000000062112637426506023050 0ustar bashustaff00000000000000# -*- coding: utf-8 -*- import os from django.conf import settings # pylint: disable=W0611 from appconf import AppConf class MaintenanceSettings(AppConf): IGNORE_URLS = () LOCKFILE_PATH = os.path.join( os.path.abspath(os.path.dirname(__file__)), 'maintenance.lock') MODE = False class Meta: prefix = 'maintenance' holder = 'maintenancemode.conf.settings' django-maintenancemode-0.11.2/maintenancemode/http.py0000644000076600000240000000021412636423075023075 0ustar bashustaff00000000000000# -*- coding: utf-8 -*- from django.http import HttpResponse class HttpResponseTemporaryUnavailable(HttpResponse): status_code = 503 django-maintenancemode-0.11.2/maintenancemode/management/0000755000076600000240000000000012637427177023673 5ustar bashustaff00000000000000django-maintenancemode-0.11.2/maintenancemode/management/__init__.py0000644000076600000240000000000012636423075025762 0ustar bashustaff00000000000000django-maintenancemode-0.11.2/maintenancemode/management/commands/0000755000076600000240000000000012637427177025474 5ustar bashustaff00000000000000django-maintenancemode-0.11.2/maintenancemode/management/commands/__init__.py0000644000076600000240000000000012636423075027563 0ustar bashustaff00000000000000django-maintenancemode-0.11.2/maintenancemode/management/commands/maintenance.py0000644000076600000240000000220212637426506030317 0ustar bashustaff00000000000000# -*- coding: utf-8 -*- from django.core.management.base import BaseCommand, CommandError from maintenancemode import utils as maintenance class Command(BaseCommand): opts = ('on', 'off', 'activate', 'deactivate') def add_arguments(self, parser): parser.add_argument('command', nargs='?', help='|'.join(self.opts)) def handle(self, *args, **options): command = options.get('command', args[0] if len(args) > 0 else None) verbosity = int(options.get('verbosity')) if command is not None: if command.lower() in ('on', 'activate'): maintenance.activate() if verbosity > 0: self.stdout.write( "Maintenance mode was activated succesfully") elif command.lower() in ('off', 'deactivate'): maintenance.deactivate() if verbosity > 0: self.stdout.write( "Maintenance mode was deactivated succesfully") if command not in self.opts: raise CommandError( "Allowed commands are: %s" % '|'.join(self.opts)) django-maintenancemode-0.11.2/maintenancemode/middleware.py0000644000076600000240000000333212637426506024242 0ustar bashustaff00000000000000# -*- coding: utf-8 -*- import re import django from django.conf import urls from django.core import urlresolvers from .conf import settings from . import utils as maintenance urls.handler503 = 'maintenancemode.views.temporary_unavailable' urls.__all__.append('handler503') IGNORE_URLS = tuple([re.compile(u) for u in settings.MAINTENANCE_IGNORE_URLS]) class MaintenanceModeMiddleware(object): def process_request(self, request): # Allow access if middleware is not activated if not (settings.MAINTENANCE_MODE or maintenance.status()): return None INTERNAL_IPS = maintenance.IPList(settings.INTERNAL_IPS) # Preferentially check HTTP_X_FORWARDED_FOR b/c a proxy # server might have obscured REMOTE_ADDR for ip in request.META.get('HTTP_X_FORWARDED_FOR', '').split(','): if ip.strip() in INTERNAL_IPS: return None # Allow access if remote ip is in INTERNAL_IPS if request.META.get('REMOTE_ADDR') in INTERNAL_IPS: return None # Allow access if the user doing the request is logged in and a # staff member. if hasattr(request, 'user') and request.user.is_staff: return None # Check if a path is explicitly excluded from maintenance mode for url in IGNORE_URLS: if url.match(request.path_info): return None # Otherwise show the user the 503 page resolver = urlresolvers.get_resolver(None) if django.VERSION < (1, 8): callback, param_dict = resolver._resolve_special('503') else: callback, param_dict = resolver.resolve_error_handler('503') return callback(request, **param_dict) django-maintenancemode-0.11.2/maintenancemode/models.py0000644000076600000240000000000012636423075023372 0ustar bashustaff00000000000000django-maintenancemode-0.11.2/maintenancemode/utils.py0000644000076600000240000000162112636423075023261 0ustar bashustaff00000000000000# -*- coding: utf-8 -*- import os from .conf import settings class IPList(list): """Stolen from https://djangosnippets.org/snippets/1362/""" def __init__(self, ips): try: from IPy import IP for ip in ips: self.append(IP(ip)) except ImportError: pass def __contains__(self, ip): try: for net in self: if ip in net: return True except: pass return False def activate(): try: open(settings.MAINTENANCE_LOCKFILE_PATH, 'ab', 0).close() except OSError: pass # shit happens def deactivate(): if os.path.isfile(settings.MAINTENANCE_LOCKFILE_PATH): os.remove(settings.MAINTENANCE_LOCKFILE_PATH) def status(): return settings.MAINTENANCE_MODE or os.path.isfile( settings.MAINTENANCE_LOCKFILE_PATH) django-maintenancemode-0.11.2/maintenancemode/views.py0000644000076600000240000000172112637426506023262 0ustar bashustaff00000000000000# -*- coding: utf-8 -*- import django if django.get_version() >= '1.8': from django.template.loader import render_to_string else: from django.template import loader, RequestContext def render_to_string(template_name, context=None, request=None): context_instance = RequestContext(request) if request else None return loader.render_to_string( template_name, context, context_instance) from . import http def temporary_unavailable(request, template_name='503.html'): """ Default 503 handler, which looks for the requested URL in the redirects table, redirects if found, and displays 404 page if not redirected. Templates: ``503.html`` Context: request_path The path of the requested URL (e.g., '/app/pages/bad_page/') """ context = { 'request_path': request.path, } return http.HttpResponseTemporaryUnavailable( render_to_string(template_name, context)) django-maintenancemode-0.11.2/MANIFEST.in0000644000076600000240000000015312636423075020155 0ustar bashustaff00000000000000include AUTHORS include CHANGES include LICENSE include README.rst recursive-exclude maintenancemode test* django-maintenancemode-0.11.2/PKG-INFO0000644000076600000240000001330412637427177017526 0ustar bashustaff00000000000000Metadata-Version: 1.1 Name: django-maintenancemode Version: 0.11.2 Summary: django-maintenancemode allows you to temporary shutdown your site for maintenance work Home-page: http://github.com/shanx/django-maintenancemode Author: Basil Shubin Author-email: basil.shubin@gmail.com License: BSD License Download-URL: https://github.com/shanx/django-maintenancemode/zipball/master Description: django-maintenancemode ====================== django-maintenancemode is a middleware that allows you to temporary shutdown your site for maintenance work. Logged in users having staff credentials can still fully use the site as can users visiting the site from an IP address defined in Django's ``INTERNAL_IPS``. Authored by `Remco Wendt `_, and some great `contributors `_. .. image:: https://img.shields.io/pypi/v/django-maintenancemode.svg :target: https://pypi.python.org/pypi/django-maintenancemode/ .. image:: https://img.shields.io/pypi/dm/django-maintenancemode.svg :target: https://pypi.python.org/pypi/django-maintenancemode/ .. image:: https://img.shields.io/github/license/shanx/django-maintenancemode.svg :target: https://pypi.python.org/pypi/django-maintenancemode/ .. image:: https://img.shields.io/travis/shanx/django-maintenancemode.svg :target: https://travis-ci.org/shanx/django-maintenancemode/ How it works ------------ ``maintenancemode`` works the same way as handling 404 or 500 error in Django work. It adds a ``handler503`` which you can override in your main ``urls.py`` or you can add a ``503.html`` to your templates directory. * If user is logged in and staff member, the maintenance page is not displayed. * If user's IP is in ``INTERNAL_IPS``, the maintenance page is not displayed. * To override the default view which is used if the maintenance mode is enabled you can simply define a ``handler503`` variable in your ROOT_URLCONF_, similar to how you would customize other `error handlers`_, e.g. : .. code-block:: python handler503 = 'example.views.maintenance_mode' Installation ------------ 1. Either checkout ``maintenancemode`` from GitHub, or install using pip : .. code-block:: bash pip install django-maintenancemode 2. Add ``maintenancemode`` to your ``INSTALLED_APPS`` : .. code-block:: python INSTALLED_APPS = ( ... 'maintenancemode', ) 3. Add ``MaintenanceModeMiddleware`` to ``MIDDLEWARE_CLASSES``, make sure it comes after ``AuthenticationMiddleware`` : .. code-block:: python MIDDLEWARE_CLASSES = ( ... 'django.contrib.auth.middleware.AuthenticationMiddleware', 'maintenancemode.middleware.MaintenanceModeMiddleware', ) 4. Add variable called ``MAINTENANCE_MODE`` in your project's ``settings.py`` file : .. code-block:: python MAINTENANCE_MODE = True # Setting this variable to ``True`` activates the middleware. or set ``MAINTENANCE_MODE`` to ``False`` and use ``maintenance`` command : .. code-block:: shell python ./manage.py maintenance Please see ``example`` application. This application is used to manually test the functionalities of this package. This also serves as a good example... You need only Django 1.4 or above to run that. It might run on older versions but that is not tested. Configuration ------------- There are various optional configuration options you can set in your ``settings.py`` .. code-block:: python # Enable / disable maintenance mode. # Default: False MAINTENANCE_MODE = True # or ``False`` and use ``maintenance`` command # Sequence of URL path regexes to exclude from the maintenance mode. # Default: () MAINTENANCE_IGNORE_URLS = ( r'^/docs/.*', r'^/contact' ) License ------- ``django-maintenancemode`` is released under the BSD license. .. _ROOT_URLCONF: https://docs.djangoproject.com/en/dev/ref/settings/#root-urlconf .. _`error handlers`: https://docs.djangoproject.com/en/dev/topics/http/views/#customizing-error-views Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: Web Environment Classifier: Framework :: Django Classifier: Intended Audience :: Developers Classifier: Intended Audience :: System Administrators Classifier: License :: OSI Approved :: BSD License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.4 Classifier: Topic :: Internet :: WWW/HTTP Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content Requires: Django (>=1.4.2) django-maintenancemode-0.11.2/README.rst0000644000076600000240000000727212636423075020117 0ustar bashustaff00000000000000django-maintenancemode ====================== django-maintenancemode is a middleware that allows you to temporary shutdown your site for maintenance work. Logged in users having staff credentials can still fully use the site as can users visiting the site from an IP address defined in Django's ``INTERNAL_IPS``. Authored by `Remco Wendt `_, and some great `contributors `_. .. image:: https://img.shields.io/pypi/v/django-maintenancemode.svg :target: https://pypi.python.org/pypi/django-maintenancemode/ .. image:: https://img.shields.io/pypi/dm/django-maintenancemode.svg :target: https://pypi.python.org/pypi/django-maintenancemode/ .. image:: https://img.shields.io/github/license/shanx/django-maintenancemode.svg :target: https://pypi.python.org/pypi/django-maintenancemode/ .. image:: https://img.shields.io/travis/shanx/django-maintenancemode.svg :target: https://travis-ci.org/shanx/django-maintenancemode/ How it works ------------ ``maintenancemode`` works the same way as handling 404 or 500 error in Django work. It adds a ``handler503`` which you can override in your main ``urls.py`` or you can add a ``503.html`` to your templates directory. * If user is logged in and staff member, the maintenance page is not displayed. * If user's IP is in ``INTERNAL_IPS``, the maintenance page is not displayed. * To override the default view which is used if the maintenance mode is enabled you can simply define a ``handler503`` variable in your ROOT_URLCONF_, similar to how you would customize other `error handlers`_, e.g. : .. code-block:: python handler503 = 'example.views.maintenance_mode' Installation ------------ 1. Either checkout ``maintenancemode`` from GitHub, or install using pip : .. code-block:: bash pip install django-maintenancemode 2. Add ``maintenancemode`` to your ``INSTALLED_APPS`` : .. code-block:: python INSTALLED_APPS = ( ... 'maintenancemode', ) 3. Add ``MaintenanceModeMiddleware`` to ``MIDDLEWARE_CLASSES``, make sure it comes after ``AuthenticationMiddleware`` : .. code-block:: python MIDDLEWARE_CLASSES = ( ... 'django.contrib.auth.middleware.AuthenticationMiddleware', 'maintenancemode.middleware.MaintenanceModeMiddleware', ) 4. Add variable called ``MAINTENANCE_MODE`` in your project's ``settings.py`` file : .. code-block:: python MAINTENANCE_MODE = True # Setting this variable to ``True`` activates the middleware. or set ``MAINTENANCE_MODE`` to ``False`` and use ``maintenance`` command : .. code-block:: shell python ./manage.py maintenance Please see ``example`` application. This application is used to manually test the functionalities of this package. This also serves as a good example... You need only Django 1.4 or above to run that. It might run on older versions but that is not tested. Configuration ------------- There are various optional configuration options you can set in your ``settings.py`` .. code-block:: python # Enable / disable maintenance mode. # Default: False MAINTENANCE_MODE = True # or ``False`` and use ``maintenance`` command # Sequence of URL path regexes to exclude from the maintenance mode. # Default: () MAINTENANCE_IGNORE_URLS = ( r'^/docs/.*', r'^/contact' ) License ------- ``django-maintenancemode`` is released under the BSD license. .. _ROOT_URLCONF: https://docs.djangoproject.com/en/dev/ref/settings/#root-urlconf .. _`error handlers`: https://docs.djangoproject.com/en/dev/topics/http/views/#customizing-error-views django-maintenancemode-0.11.2/setup.cfg0000644000076600000240000000012212637427177020244 0ustar bashustaff00000000000000[wheel] universal = 1 [egg_info] tag_build = tag_date = 0 tag_svn_revision = 0 django-maintenancemode-0.11.2/setup.py0000644000076600000240000000446212636423075020140 0ustar bashustaff00000000000000#!/usr/bin/env python import os import re import sys import codecs import subprocess from setuptools import setup, find_packages from setuptools.command.test import test as TestCommand class TestRunner(TestCommand): user_options = [] def run(self): raise SystemExit(subprocess.call([sys.executable, 'runtests.py'])) def read(*parts): file_path = os.path.join(os.path.dirname(__file__), *parts) return codecs.open(file_path, encoding='utf-8').read() def find_version(*parts): version_file = read(*parts) version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M) if version_match: return str(version_match.group(1)) raise RuntimeError("Unable to find version string.") setup( name='django-maintenancemode', version=find_version('maintenancemode', '__init__.py'), license='BSD License', install_requires=[ 'django>=1.4.2', 'django-appconf', 'ipy', ], requires=[ 'Django (>=1.4.2)', ], description="django-maintenancemode allows you to temporary shutdown your site for maintenance work", long_description=read('README.rst'), author='Remco Wendt', author_email='remco@maykinmedia.nl', maintainer='Basil Shubin', maintainer_email='basil.shubin@gmail.com', url='http://github.com/shanx/django-maintenancemode', download_url='https://github.com/shanx/django-maintenancemode/zipball/master', packages=find_packages(exclude=('example*', '*.tests*')), include_package_data=True, tests_require=[ ], cmdclass={ 'test': TestRunner, }, zip_safe=False, classifiers=[ 'Development Status :: 5 - Production/Stable', 'Environment :: Web Environment', 'Framework :: Django', 'Intended Audience :: Developers', 'Intended Audience :: System Administrators', 'License :: OSI Approved :: BSD License', 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.4', 'Topic :: Internet :: WWW/HTTP', 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', ], )