Skip to content

Commit 2f7c863

Browse files
committed
Deploy files
1 parent 942bcc9 commit 2f7c863

File tree

6 files changed

+114
-2
lines changed

6 files changed

+114
-2
lines changed

LICENSE

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Copyright (c) 2016, Manyakhin K. All rights reserved.
2+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
3+
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
4+
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.
5+
Neither the name of the <ORGANIZATION> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
6+
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 HOLDER 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.

MANIFEST.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
include LICENSE
2+
include README.rst
3+
recursive-include django_dev_protector/templates *

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,19 @@ PROTECT_TEMPLATE_NAME = 'django_dev_protector/index.html'
3434
# redirects person after 10 sec
3535
PROTECT_REDIRECT_URL = None
3636
```
37+
By default server is unblocked
38+
39+
Usage
40+
-----
41+
You must generate and save your hash first
42+
```
43+
./manage.py generatehash
44+
```
45+
After you are able to block
46+
```
47+
http://127.0.0.1:8000/django_dev_protector/<hash>/on/
48+
```
49+
or unblock site with GET requests
50+
```
51+
http://127.0.0.1:8000/django_dev_protector/<hash>/off/
52+
```

README.rst

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
django-dev-protector
2+
====================
3+
The app for freelance developers, that blocks site if needed.
4+
5+
It can be used in situations when a client don't want to pay your work. The app blocks all requests to the site and shows a template.
6+
7+
Installation
8+
------------
9+
settings.py
10+
```
11+
INSTALLED_APPS = [
12+
...
13+
14+
# import django_dev_protector
15+
'django_dev_protector',
16+
]
17+
18+
19+
MIDDLEWARE = [
20+
# set middleware class
21+
'django_dev_protector.middleware.ControlMiddleware',
22+
23+
...
24+
]
25+
```
26+
27+
Settings
28+
--------
29+
```
30+
# render a simple template
31+
PROTECT_TEMPLATE_NAME = 'django_dev_protector/index.html'
32+
33+
# if redirect url is set, then default template would be
34+
# redirects person after 10 sec
35+
PROTECT_REDIRECT_URL = None
36+
```
37+
By default server is unblocked
38+
39+
Usage
40+
-----
41+
You must generate and save your hash first
42+
```
43+
./manage.py generatehash
44+
```
45+
After you are able to block
46+
```
47+
http://127.0.0.1:8000/django_dev_protector/<hash>/on/
48+
```
49+
or unblock site with GET requests
50+
```
51+
http://127.0.0.1:8000/django_dev_protector/<hash>/off/
52+
```

django_dev_protector/settings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
PROTECT_STATUS_FILE = '/protect_status.conf'
1111
PROTECT_HASH_FILE = '/protect_hash.conf'
1212

13-
TEMPLATE_NAME = 'django_dev_protector/index.html' if not settings.PROTECT_TEMPLATE_NAME else PROTECT_TEMPLATE_NAME
13+
TEMPLATE_NAME = 'django_dev_protector/index.html' if not hasattr(settings, 'PROTECT_TEMPLATE_NAME') else settings.PROTECT_TEMPLATE_NAME
1414

15-
REDIRECT_URL = None if not settings.PROTECT_REDIRECT_URL else PROTECT_REDIRECT_URL
15+
REDIRECT_URL = None if not hasattr(settings, 'PROTECT_REDIRECT_URL') else settings.PROTECT_REDIRECT_URL
1616

1717

1818
from django_dev_protector.setup import get_status, get_hash

setup.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import os
2+
from setuptools import setup
3+
4+
with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme:
5+
README = readme.read()
6+
7+
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
8+
9+
setup(
10+
name='django-dev-protector',
11+
version='0.1',
12+
packages=['django_dev_protector'],
13+
include_package_data=True,
14+
license='BSD License',
15+
description='Django app that protects freelance developers.',
16+
long_description=README,
17+
url='https://github.com/ElusiveSpirit/django-dev-protector',
18+
author='Manyakhin Konstantin',
19+
author_email='[email protected]',
20+
classifiers=[
21+
'Environment :: Web Environment',
22+
'Framework :: Django',
23+
'Intended Audience :: Developers',
24+
'License :: OSI Approved :: BSD License',
25+
'Operating System :: OS Independent',
26+
'Programming Language :: Python',
27+
'Programming Language :: Python :: 2',
28+
'Programming Language :: Python :: 2.7',
29+
'Programming Language :: Python :: 3',
30+
'Programming Language :: Python :: 3.4',
31+
'Programming Language :: Python :: 3.5',
32+
'Topic :: Internet :: WWW/HTTP',
33+
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
34+
],
35+
)

0 commit comments

Comments
 (0)