mirror of
https://github.com/DarrenOfficial/dpaste.git
synced 2024-11-15 16:12:51 +11:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
d959eb9061
14 changed files with 220 additions and 214 deletions
|
@ -3,6 +3,7 @@ source = dpaste
|
||||||
branch = True
|
branch = True
|
||||||
omit =
|
omit =
|
||||||
dpaste/migrations/*
|
dpaste/migrations/*
|
||||||
|
dpaste/south_migrations/*
|
||||||
dpaste/tests/*
|
dpaste/tests/*
|
||||||
dpaste/settings/*
|
dpaste/settings/*
|
||||||
|
|
||||||
|
|
20
.travis.yml
20
.travis.yml
|
@ -1,25 +1,22 @@
|
||||||
|
sudo: false
|
||||||
|
|
||||||
language: python
|
language: python
|
||||||
|
|
||||||
python:
|
python:
|
||||||
- 2.7
|
- 2.7
|
||||||
- 3.3
|
|
||||||
- 3.4
|
- 3.4
|
||||||
|
|
||||||
env:
|
env:
|
||||||
- DJANGO=1.4.16
|
- DJANGO=1.4.21
|
||||||
- DJANGO=1.6.8
|
- DJANGO=1.7.9
|
||||||
- DJANGO=1.7.1
|
- DJANGO=1.8.3
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
exclude:
|
exclude:
|
||||||
- python: 3.3
|
|
||||||
env: DJANGO=1.4.16
|
|
||||||
- python: 3.3
|
|
||||||
env: DJANGO=1.6.8
|
|
||||||
- python: 3.4
|
- python: 3.4
|
||||||
env: DJANGO=1.4.16
|
env: DJANGO=1.4.21
|
||||||
- python: 3.4
|
- python: 3.4
|
||||||
env: DJANGO=1.6.8
|
env: DJANGO=1.7.9
|
||||||
|
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
|
@ -27,9 +24,8 @@ branches:
|
||||||
- develop
|
- develop
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- "pip install coverage==3.7"
|
|
||||||
- "pip install Django==$DJANGO"
|
- "pip install Django==$DJANGO"
|
||||||
- "pip install -e ."
|
- "pip install -e ."
|
||||||
|
|
||||||
script:
|
script:
|
||||||
coverage run --rcfile=.coverage.rc runtests.py
|
python runtests.py
|
||||||
|
|
11
CHANGELOG
11
CHANGELOG
|
@ -1,16 +1,21 @@
|
||||||
Changelog
|
Changelog
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
2.10 (...)
|
||||||
|
----------------
|
||||||
|
|
||||||
|
* tbd
|
||||||
|
|
||||||
2.9 (DEV)
|
2.9 (2015-08-12)
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
* Full Django 1.7 support
|
* Full Django 1.7 support
|
||||||
* Full Django 1.8 support
|
* Full Django 1.8 support
|
||||||
* New Django migrations, with fallback to South migrations if South is
|
* New Django migrations, with fallback to South migrations if South is
|
||||||
installed.
|
installed. If you want to switch from South to native Django migrations,
|
||||||
* Added i18n support and several languages
|
and have an existing databsae, fake the initial migrations:
|
||||||
|
`manage.py migrate --fake-initial`
|
||||||
|
* Added full i18n support and several languages
|
||||||
* More settings can be overrridden, like the jQuery URL, site name and wether
|
* More settings can be overrridden, like the jQuery URL, site name and wether
|
||||||
you want to enable Gthub Gist.
|
you want to enable Gthub Gist.
|
||||||
* Ships a middleware that blocks anonymous proxies and TOR nodes. Not enabled
|
* Ships a middleware that blocks anonymous proxies and TOR nodes. Not enabled
|
||||||
|
|
|
@ -4,10 +4,6 @@ dpaste
|
||||||
|
|
||||||
.. image:: https://travis-ci.org/bartTC/dpaste.png?branch=master
|
.. image:: https://travis-ci.org/bartTC/dpaste.png?branch=master
|
||||||
:target: https://travis-ci.org/bartTC/dpaste
|
:target: https://travis-ci.org/bartTC/dpaste
|
||||||
.. image:: https://coveralls.io/repos/bartTC/dpaste/badge.png?branch=master
|
|
||||||
:target: https://coveralls.io/r/bartTC/dpaste?branch=master
|
|
||||||
.. image:: https://api.flattr.com/button/flattr-badge-large.png
|
|
||||||
:target: https://flattr.com/submit/auto?user_id=bartTC&url=https%3A%2F%2Fgithub.com%2FbartTC%2Fdpaste
|
|
||||||
|
|
||||||
dpaste is a Django based pastebin. It's intended to run separately but its also
|
dpaste is a Django based pastebin. It's intended to run separately but its also
|
||||||
possible to be installed into an existing Django project like a regular app.
|
possible to be installed into an existing Django project like a regular app.
|
||||||
|
|
|
@ -10,7 +10,7 @@ necessary dependencies of dpaste as well::
|
||||||
|
|
||||||
pip install dpaste
|
pip install dpaste
|
||||||
|
|
||||||
Add ``dpaste`` and (preferred) ``south`` to your ``INSTALLED_APPS``::
|
Add ``dpaste`` and ``mptt`` to your ``INSTALLED_APPS``::
|
||||||
|
|
||||||
INSTALLED_APPS = (
|
INSTALLED_APPS = (
|
||||||
'django.contrib.sessions',
|
'django.contrib.sessions',
|
||||||
|
@ -19,10 +19,9 @@ Add ``dpaste`` and (preferred) ``south`` to your ``INSTALLED_APPS``::
|
||||||
|
|
||||||
'mptt',
|
'mptt',
|
||||||
'dpaste',
|
'dpaste',
|
||||||
# 'south', (supported)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
Add ``dpaste`` and if you want the ``dpaste_api`` to your urlpatterns::
|
Add ``dpaste`` — and if you want — the ``dpaste_api`` to your urlpatterns::
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
# ...
|
# ...
|
||||||
|
@ -31,7 +30,7 @@ Add ``dpaste`` and if you want the ``dpaste_api`` to your urlpatterns::
|
||||||
url(r'pastebin/api/', include('dpaste.urls.dpaste_api')),
|
url(r'pastebin/api/', include('dpaste.urls.dpaste_api')),
|
||||||
)
|
)
|
||||||
|
|
||||||
Finally just ``syncdb`` or if you use South, migrate::
|
Finally just migrate the database schema::
|
||||||
|
|
||||||
manage.py migrate dpaste
|
manage.py migrate dpaste
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,8 @@ tor_bl = (
|
||||||
'{remote_addr}.{server_port}.{server_ip}'
|
'{remote_addr}.{server_port}.{server_ip}'
|
||||||
'.ip-port.exitlist.torproject.org')
|
'.ip-port.exitlist.torproject.org')
|
||||||
open_proxy_bl = ('{remote_addr}.dnsbl.proxybl.org')
|
open_proxy_bl = ('{remote_addr}.dnsbl.proxybl.org')
|
||||||
rev_ip = lambda ip: '.'.join(reversed(ip.split('.')))
|
|
||||||
|
rev_ip = lambda ip: '.'.join(reversed(ip.split('.'))) # pragma: no cover
|
||||||
|
|
||||||
response = """<html><body><h1>Access denied</h1>
|
response = """<html><body><h1>Access denied</h1>
|
||||||
<p>It appears you're requesting this page from an open proxy or
|
<p>It appears you're requesting this page from an open proxy or
|
||||||
|
@ -15,7 +16,7 @@ statutory violation related posts in the past.</p>
|
||||||
<p>If you think this is wrong, <a href="https://github.com/bartTC/dpaste">file
|
<p>If you think this is wrong, <a href="https://github.com/bartTC/dpaste">file
|
||||||
a bug on Github please</a>.</p></body></html>"""
|
a bug on Github please</a>.</p></body></html>"""
|
||||||
|
|
||||||
def in_blacklist(request, bl, ip=None):
|
def in_blacklist(request, bl, ip=None): # pragma: no cover
|
||||||
ip = ip or request.META['REMOTE_ADDR']
|
ip = ip or request.META['REMOTE_ADDR']
|
||||||
try:
|
try:
|
||||||
server_ip = socket.gethostbyname(request.META['SERVER_NAME'])
|
server_ip = socket.gethostbyname(request.META['SERVER_NAME'])
|
||||||
|
@ -37,15 +38,13 @@ def in_blacklist(request, bl, ip=None):
|
||||||
return lookup == '127.0.0.2'
|
return lookup == '127.0.0.2'
|
||||||
|
|
||||||
|
|
||||||
class SuspiciousIPMiddleware(object):
|
class SuspiciousIPMiddleware(object): # pragma: no cover
|
||||||
|
|
||||||
def process_request(self, request):
|
def process_request(self, request):
|
||||||
|
|
||||||
def check_tor():
|
def check_tor():
|
||||||
if not hasattr(request, '_is_tor_exit_node'):
|
if not hasattr(request, '_is_tor_exit_node'):
|
||||||
request._is_tor_exit_node = in_blacklist(request, tor_bl)
|
request._is_tor_exit_node = in_blacklist(request, tor_bl)
|
||||||
return request._is_tor_exit_node
|
return request._is_tor_exit_node
|
||||||
|
|
||||||
request.is_tor_exit_node = check_tor
|
request.is_tor_exit_node = check_tor
|
||||||
|
|
||||||
def check_open_proxy():
|
def check_open_proxy():
|
||||||
|
@ -53,13 +52,11 @@ class SuspiciousIPMiddleware(object):
|
||||||
request._is_open_proxy = in_blacklist(
|
request._is_open_proxy = in_blacklist(
|
||||||
request, open_proxy_bl)
|
request, open_proxy_bl)
|
||||||
return request._is_open_proxy
|
return request._is_open_proxy
|
||||||
|
|
||||||
request.is_open_proxy = check_open_proxy
|
request.is_open_proxy = check_open_proxy
|
||||||
|
|
||||||
def check_suspicious():
|
def check_suspicious():
|
||||||
return request.is_tor_exit_node() or request.is_open_proxy()
|
return request.is_tor_exit_node() or request.is_open_proxy()
|
||||||
|
|
||||||
request.is_suspicious = check_suspicious
|
request.is_suspicious = check_suspicious
|
||||||
|
|
||||||
if request.method == 'POST' and request.is_suspicious():
|
if request.method == 'POST' and request.is_suspicious():
|
||||||
return HttpResponseBadRequest(response)
|
return HttpResponseBadRequest(response)
|
||||||
|
|
|
@ -1,151 +0,0 @@
|
||||||
# Import global settings to make it easier to extend settings.
|
|
||||||
from django.conf.global_settings import *
|
|
||||||
|
|
||||||
|
|
||||||
#==============================================================================
|
|
||||||
# Calculation of directories relative to the module location
|
|
||||||
#==============================================================================
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import dpaste
|
|
||||||
|
|
||||||
PROJECT_DIR, PROJECT_MODULE_NAME = os.path.split(
|
|
||||||
os.path.dirname(os.path.realpath(dpaste.__file__))
|
|
||||||
)
|
|
||||||
|
|
||||||
# Set the variable root to $VIRTUALENV/var.
|
|
||||||
PYTHON_BIN = os.path.dirname(sys.executable)
|
|
||||||
|
|
||||||
VAR_ROOT = os.path.join(os.path.dirname(PYTHON_BIN), 'var')
|
|
||||||
if not os.path.exists(VAR_ROOT):
|
|
||||||
os.mkdir(VAR_ROOT)
|
|
||||||
|
|
||||||
#==============================================================================
|
|
||||||
# Generic Django project settings
|
|
||||||
#==============================================================================
|
|
||||||
|
|
||||||
DEBUG = False
|
|
||||||
TEMPLATE_DEBUG = DEBUG
|
|
||||||
|
|
||||||
# Local time zone for this installation. Choices can be found here:
|
|
||||||
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
|
|
||||||
TIME_ZONE = 'UTC'
|
|
||||||
SITE_ID = 1
|
|
||||||
|
|
||||||
# Make this unique, and don't share it with anybody.
|
|
||||||
SECRET_KEY = ''
|
|
||||||
|
|
||||||
ALLOWED_HOSTS = (
|
|
||||||
'dpaste.de',
|
|
||||||
'www.dpaste.de',
|
|
||||||
'dpaste.org',
|
|
||||||
'www.dpaste.org',
|
|
||||||
'127.0.0.1',
|
|
||||||
)
|
|
||||||
|
|
||||||
SECRET_KEY = 'CHANGE_ME'
|
|
||||||
|
|
||||||
#==============================================================================
|
|
||||||
# I18N
|
|
||||||
#==============================================================================
|
|
||||||
|
|
||||||
USE_I18N = True
|
|
||||||
USE_L10N = False
|
|
||||||
|
|
||||||
LANGUAGE_CODE = 'en'
|
|
||||||
LANGUAGES = (
|
|
||||||
('en', 'English'),
|
|
||||||
('de', 'German'),
|
|
||||||
('es', 'Spanish'),
|
|
||||||
('pt-br', 'Portugese (Brasil)'),
|
|
||||||
)
|
|
||||||
|
|
||||||
LOCALE_PATHS = (
|
|
||||||
os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'locale')),
|
|
||||||
)
|
|
||||||
|
|
||||||
#==============================================================================
|
|
||||||
# Static files
|
|
||||||
#==============================================================================
|
|
||||||
|
|
||||||
STATIC_ROOT = os.path.join(VAR_ROOT, 'static')
|
|
||||||
|
|
||||||
#==============================================================================
|
|
||||||
# Project URLS and media settings
|
|
||||||
#==============================================================================
|
|
||||||
|
|
||||||
STATIC_URL = '/static/'
|
|
||||||
ADMIN_MEDIA_PREFIX = '/static/admin/'
|
|
||||||
|
|
||||||
ROOT_URLCONF = 'dpaste.urls'
|
|
||||||
|
|
||||||
LOGIN_URL = '/accounts/login/'
|
|
||||||
LOGOUT_URL = '/accounts/logout/'
|
|
||||||
LOGIN_REDIRECT_URL = '/'
|
|
||||||
|
|
||||||
#==============================================================================
|
|
||||||
# Templates
|
|
||||||
#==============================================================================
|
|
||||||
|
|
||||||
MIDDLEWARE_CLASSES = (
|
|
||||||
'django.middleware.csrf.CsrfViewMiddleware',
|
|
||||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
|
||||||
'django.middleware.common.CommonMiddleware',
|
|
||||||
'django.middleware.locale.LocaleMiddleware',
|
|
||||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
|
||||||
)
|
|
||||||
|
|
||||||
TEMPLATE_CONTEXT_PROCESSORS += (
|
|
||||||
'django.core.context_processors.request',
|
|
||||||
'django.core.context_processors.i18n',
|
|
||||||
)
|
|
||||||
|
|
||||||
INSTALLED_APPS = (
|
|
||||||
'django.contrib.staticfiles',
|
|
||||||
'django.contrib.sessions',
|
|
||||||
|
|
||||||
'mptt',
|
|
||||||
'gunicorn',
|
|
||||||
'dpaste',
|
|
||||||
)
|
|
||||||
|
|
||||||
DATABASES = {
|
|
||||||
'default': {
|
|
||||||
'ENGINE': 'django.db.backends.sqlite3',
|
|
||||||
'NAME': 'dev.db',
|
|
||||||
'USER': '',
|
|
||||||
'PASSWORD': '',
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#==============================================================================
|
|
||||||
# App specific settings
|
|
||||||
#==============================================================================
|
|
||||||
|
|
||||||
# How many recent snippets to save for every user? IDs of this snippets are
|
|
||||||
# stored in the user session.
|
|
||||||
MAX_SNIPPETS_PER_USER = 25
|
|
||||||
|
|
||||||
LOGGING = {
|
|
||||||
'version': 1,
|
|
||||||
'disable_existing_loggers': False,
|
|
||||||
'filters': {
|
|
||||||
'require_debug_false': {
|
|
||||||
'()': 'django.utils.log.RequireDebugFalse'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'handlers': {
|
|
||||||
'mail_admins': {
|
|
||||||
'level': 'ERROR',
|
|
||||||
'filters': ['require_debug_false'],
|
|
||||||
'class': 'django.utils.log.AdminEmailHandler'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'loggers': {
|
|
||||||
'django.request': {
|
|
||||||
'handlers': ['mail_admins'],
|
|
||||||
'level': 'ERROR',
|
|
||||||
'propagate': True,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
151
dpaste/settings/base.py
Normal file
151
dpaste/settings/base.py
Normal file
|
@ -0,0 +1,151 @@
|
||||||
|
# Import global settings to make it easier to extend settings.
|
||||||
|
from django.conf.global_settings import *
|
||||||
|
|
||||||
|
|
||||||
|
#==============================================================================
|
||||||
|
# Calculation of directories relative to the module location
|
||||||
|
#==============================================================================
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import dpaste
|
||||||
|
|
||||||
|
PROJECT_DIR, PROJECT_MODULE_NAME = os.path.split(
|
||||||
|
os.path.dirname(os.path.realpath(dpaste.__file__))
|
||||||
|
)
|
||||||
|
|
||||||
|
# Set the variable root to $VIRTUALENV/var.
|
||||||
|
PYTHON_BIN = os.path.dirname(sys.executable)
|
||||||
|
|
||||||
|
VAR_ROOT = os.path.join(os.path.dirname(PYTHON_BIN), 'var')
|
||||||
|
if not os.path.exists(VAR_ROOT):
|
||||||
|
os.mkdir(VAR_ROOT)
|
||||||
|
|
||||||
|
#==============================================================================
|
||||||
|
# Generic Django project settings
|
||||||
|
#==============================================================================
|
||||||
|
|
||||||
|
DEBUG = False
|
||||||
|
TEMPLATE_DEBUG = DEBUG
|
||||||
|
|
||||||
|
# Local time zone for this installation. Choices can be found here:
|
||||||
|
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
|
||||||
|
TIME_ZONE = 'UTC'
|
||||||
|
SITE_ID = 1
|
||||||
|
|
||||||
|
# Make this unique, and don't share it with anybody.
|
||||||
|
SECRET_KEY = ''
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = (
|
||||||
|
'dpaste.de',
|
||||||
|
'www.dpaste.de',
|
||||||
|
'dpaste.org',
|
||||||
|
'www.dpaste.org',
|
||||||
|
'127.0.0.1',
|
||||||
|
)
|
||||||
|
|
||||||
|
SECRET_KEY = 'CHANGE_ME'
|
||||||
|
|
||||||
|
#==============================================================================
|
||||||
|
# I18N
|
||||||
|
#==============================================================================
|
||||||
|
|
||||||
|
USE_I18N = True
|
||||||
|
USE_L10N = False
|
||||||
|
|
||||||
|
LANGUAGE_CODE = 'en'
|
||||||
|
LANGUAGES = (
|
||||||
|
('en', 'English'),
|
||||||
|
('de', 'German'),
|
||||||
|
('es', 'Spanish'),
|
||||||
|
('pt-br', 'Portugese (Brasil)'),
|
||||||
|
)
|
||||||
|
|
||||||
|
LOCALE_PATHS = (
|
||||||
|
os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'locale')),
|
||||||
|
)
|
||||||
|
|
||||||
|
#==============================================================================
|
||||||
|
# Static files
|
||||||
|
#==============================================================================
|
||||||
|
|
||||||
|
STATIC_ROOT = os.path.join(VAR_ROOT, 'static')
|
||||||
|
|
||||||
|
#==============================================================================
|
||||||
|
# Project URLS and media settings
|
||||||
|
#==============================================================================
|
||||||
|
|
||||||
|
STATIC_URL = '/static/'
|
||||||
|
ADMIN_MEDIA_PREFIX = '/static/admin/'
|
||||||
|
|
||||||
|
ROOT_URLCONF = 'dpaste.urls'
|
||||||
|
|
||||||
|
LOGIN_URL = '/accounts/login/'
|
||||||
|
LOGOUT_URL = '/accounts/logout/'
|
||||||
|
LOGIN_REDIRECT_URL = '/'
|
||||||
|
|
||||||
|
#==============================================================================
|
||||||
|
# Templates
|
||||||
|
#==============================================================================
|
||||||
|
|
||||||
|
MIDDLEWARE_CLASSES = (
|
||||||
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
'django.middleware.locale.LocaleMiddleware',
|
||||||
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
)
|
||||||
|
|
||||||
|
TEMPLATE_CONTEXT_PROCESSORS += (
|
||||||
|
'django.core.context_processors.request',
|
||||||
|
'django.core.context_processors.i18n',
|
||||||
|
)
|
||||||
|
|
||||||
|
INSTALLED_APPS = (
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
|
||||||
|
'mptt',
|
||||||
|
'gunicorn',
|
||||||
|
'dpaste',
|
||||||
|
)
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
|
'NAME': 'dev.db',
|
||||||
|
'USER': '',
|
||||||
|
'PASSWORD': '',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#==============================================================================
|
||||||
|
# App specific settings
|
||||||
|
#==============================================================================
|
||||||
|
|
||||||
|
# How many recent snippets to save for every user? IDs of this snippets are
|
||||||
|
# stored in the user session.
|
||||||
|
MAX_SNIPPETS_PER_USER = 25
|
||||||
|
|
||||||
|
LOGGING = {
|
||||||
|
'version': 1,
|
||||||
|
'disable_existing_loggers': False,
|
||||||
|
'filters': {
|
||||||
|
'require_debug_false': {
|
||||||
|
'()': 'django.utils.log.RequireDebugFalse'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'handlers': {
|
||||||
|
'mail_admins': {
|
||||||
|
'level': 'ERROR',
|
||||||
|
'filters': ['require_debug_false'],
|
||||||
|
'class': 'django.utils.log.AdminEmailHandler'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'loggers': {
|
||||||
|
'django.request': {
|
||||||
|
'handlers': ['mail_admins'],
|
||||||
|
'level': 'ERROR',
|
||||||
|
'propagate': True,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
from .settings import *
|
from dpaste.settings.base import *
|
||||||
|
|
||||||
DEBUG = True
|
DEBUG = True
|
||||||
TEMPLATE_DEBUG = DEBUG
|
TEMPLATE_DEBUG = DEBUG
|
||||||
|
|
|
@ -11,12 +11,12 @@ pygments==2.0.1
|
||||||
requests==2.5.1
|
requests==2.5.1
|
||||||
|
|
||||||
# Testing
|
# Testing
|
||||||
python-coveralls==2.4.3
|
coverage
|
||||||
coverage==3.7.1
|
tox
|
||||||
tox==1.8.1
|
docutils
|
||||||
docutils==0.12
|
sphinx
|
||||||
sphinx==1.2.3
|
|
||||||
sphinx_rtd_theme
|
sphinx_rtd_theme
|
||||||
|
mysql-python
|
||||||
|
|
||||||
# Deployment specific
|
# Deployment specific
|
||||||
django-redis==3.8.0
|
django-redis==3.8.0
|
||||||
|
|
33
runtests.py
33
runtests.py
|
@ -3,30 +3,39 @@ import sys
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
if not settings.configured:
|
SETTINGS = {
|
||||||
settings.configure(
|
'DATABASES': {
|
||||||
DATABASES={
|
|
||||||
'default': {
|
'default': {
|
||||||
'ENGINE': 'django.db.backends.sqlite3',
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
'NAME': 'dev.db',
|
'NAME': 'dev.db',
|
||||||
}
|
|
||||||
},
|
},
|
||||||
INSTALLED_APPS=[
|
# 'default': {
|
||||||
|
# 'ENGINE': 'django.db.backends.mysql',
|
||||||
|
# 'NAME': 'dpaste',
|
||||||
|
# 'USER': 'root',
|
||||||
|
# 'PASSWORD': '',
|
||||||
|
# }
|
||||||
|
},
|
||||||
|
'INSTALLED_APPS': [
|
||||||
'django.contrib.sessions',
|
'django.contrib.sessions',
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
'mptt',
|
'mptt',
|
||||||
'dpaste',
|
'dpaste',
|
||||||
],
|
],
|
||||||
MIDDLEWARE_CLASSES=(
|
'MIDDLEWARE_CLASSES': (
|
||||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
),
|
),
|
||||||
STATIC_ROOT='/tmp/dpaste_test_static/',
|
'STATIC_ROOT': '/tmp/dpaste_test_static/',
|
||||||
STATIC_URL='/static/',
|
'STATIC_URL': '/static/',
|
||||||
ROOT_URLCONF='dpaste.urls',
|
'ROOT_URLCONF': 'dpaste.urls'
|
||||||
)
|
}
|
||||||
|
|
||||||
def runtests(*test_args):
|
def runtests(*test_args):
|
||||||
# New Django 1.7 app registry
|
# Setup settings
|
||||||
|
if not settings.configured:
|
||||||
|
settings.configure(**SETTINGS)
|
||||||
|
|
||||||
|
# New Django 1.7 app registry setup
|
||||||
try:
|
try:
|
||||||
from django import setup
|
from django import setup
|
||||||
setup()
|
setup()
|
||||||
|
@ -40,7 +49,7 @@ def runtests(*test_args):
|
||||||
from django.test.simple import DjangoTestSuiteRunner as TestRunner
|
from django.test.simple import DjangoTestSuiteRunner as TestRunner
|
||||||
|
|
||||||
test_runner = TestRunner(verbosity=1)
|
test_runner = TestRunner(verbosity=1)
|
||||||
failures = test_runner.run_tests(['dpaste', ])
|
failures = test_runner.run_tests(['dpaste'])
|
||||||
if failures:
|
if failures:
|
||||||
sys.exit(failures)
|
sys.exit(failures)
|
||||||
|
|
||||||
|
|
3
runtests.sh
Normal file
3
runtests.sh
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
coverage run --rcfile=./.coverage.rc runtests.py && \
|
||||||
|
coverage html --rcfile=./.coverage.rc
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -24,7 +24,7 @@ long_description = u'\n\n'.join((
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='dpaste',
|
name='dpaste',
|
||||||
version='2.9',
|
version='2.10',
|
||||||
description='dpaste is a Django based pastebin. It\'s intended to run '
|
description='dpaste is a Django based pastebin. It\'s intended to run '
|
||||||
'separately but its also possible to be installed into an '
|
'separately but its also possible to be installed into an '
|
||||||
'existing Django project like a regular app.',
|
'existing Django project like a regular app.',
|
||||||
|
|
8
tox.ini
8
tox.ini
|
@ -3,8 +3,8 @@ toxworkdir=/tmp/tox/dpaste
|
||||||
envlist=
|
envlist=
|
||||||
py27-django-1.4,
|
py27-django-1.4,
|
||||||
py27-django-1.7,
|
py27-django-1.7,
|
||||||
py27-django-latest,
|
py27-django-1.8,
|
||||||
py34-django-latest
|
py34-django-1.8
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
commands=
|
commands=
|
||||||
|
@ -16,8 +16,8 @@ deps=django==1.4.21
|
||||||
[testenv:py27-django-1.7]
|
[testenv:py27-django-1.7]
|
||||||
deps=django==1.7.9
|
deps=django==1.7.9
|
||||||
|
|
||||||
[testenv:py27-django-latest]
|
[testenv:py27-django-1.8]
|
||||||
deps=django==1.8.3
|
deps=django==1.8.3
|
||||||
|
|
||||||
[testenv:py34-django-latest]
|
[testenv:py34-django-1.8]
|
||||||
deps=django==1.8.3
|
deps=django==1.8.3
|
||||||
|
|
Loading…
Reference in a new issue