diff --git a/.travis.yml b/.travis.yml index 18f353f..d7432af 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,9 +2,8 @@ language: python python: - "2.7" env: - - DJANGO="Django>=1.6,<1.7" - - DJANGO="Django>=1.7,<1.8" - DJANGO="Django>=1.8,<1.9" + - DJANGO="Django>=1.9,<1.10" install: - pip install -q $DJANGO - pip install -r requirements.txt diff --git a/Dockerfile b/Dockerfile index c3748e6..fc84e8b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,29 +4,20 @@ MAINTAINER Jeffrey Forman ENV DEBIAN_FRONTEND noninteractive -RUN apt-get update && apt-get install -y \ +RUN apt-get update && apt-get install -y --no-install-recommends \ git \ - python-bs4 \ - python-dev \ - python-django \ - python-dnspython \ - python-lxml \ - python-pip \ - python-sqlite + python-pip -RUN pip install \ - pybindxml +RUN git clone https://github.com/jforman/binder.git /opt/binder/ -WORKDIR /opt +RUN pip install -r /opt/binder/requirements.txt -RUN git clone https://github.com/jforman/binder.git +ENV PYTHONPATH $PYTHONPATH:/opt/binder +ENV DJANGO_SETTINGS_MODULE binder.settings -env PYTHONPATH $PYTHONPATH:/opt/binder -env DJANGO_SETTINGS_MODULE binder.settings +RUN ["/opt/binder/manage.py", "migrate"] +RUN ["/opt/binder/manage.py", "loaddata", "/opt/binder/binder/fixtures/initial_data.json"] -run ["/opt/binder/manage.py", "migrate"] -run ["/opt/binder/manage.py", "loaddata", "/opt/binder/binder/fixtures/initial_data.json"] +EXPOSE :8000 -expose :8000 - -CMD ["/opt/binder/manage.py", "runserver", "0.0.0.0:8000"] \ No newline at end of file +CMD ["/opt/binder/manage.py", "runserver", "0.0.0.0:8000"] diff --git a/README.markdown b/README.markdown index eb435e7..18e9313 100644 --- a/README.markdown +++ b/README.markdown @@ -11,7 +11,7 @@ Binder supports adding and deleting DNS records (and eventually editing in place Packages: -* [Django](http://www.djangoproject.com) +* [Django](http://www.djangoproject.com) >=1.8 * Python Modules * [pybindxml](https://pypi.python.org/pypi?name=pybindxml&:action=display): This is a shared library I wrote to scrape and stick into Python dict objects various server/zone data from a BIND DNS server. * Beautifulsoup4: This library is included as a dependency of pybindmlx when you when you install pybindxml. @@ -42,7 +42,7 @@ binder/ The development server is run as most Django dev servers are run. - /opt/binder/manage.py syncdb + /opt/binder/manage.py migrate /opt/binder/manage.py runserver Once you have the Django server up and running, you will want to configure at least one BIND server in the Django Admin app. This includes a hostname, TCP statistics port and a default TSIG transfer key to be used when doing AXFR actions (if necessary). diff --git a/binder/settings.py b/binder/settings.py index d0ecfaa..5b1c511 100644 --- a/binder/settings.py +++ b/binder/settings.py @@ -4,7 +4,6 @@ from django.contrib.messages import constants as messages SITE_ROOT = os.path.dirname(os.path.realpath(__file__)) DEBUG = True -TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', 'your_email@domain.com'), @@ -56,11 +55,25 @@ except IOError: except IOError: Exception('Please create a %s file with random characters to generate your secret key!' % SECRET_FILE) -# List of callables that know how to import templates from various sources. -TEMPLATE_LOADERS = ( - 'django.template.loaders.filesystem.Loader', - 'django.template.loaders.app_directories.Loader', -) +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'APP_DIRS': True, + 'DIRS': os.path.join(SITE_ROOT, "templates"), + 'OPTIONS': { + 'context_processors': [ + 'django.contrib.auth.context_processors.auth', + 'django.template.context_processors.debug', + 'django.template.context_processors.i18n', + 'django.template.context_processors.media', + 'django.template.context_processors.static', + 'django.template.context_processors.tz', + 'django.contrib.messages.context_processors.messages' + ], + 'debug': True + } + } +] MIDDLEWARE_CLASSES = ( 'django.middleware.csrf.CsrfViewMiddleware', @@ -73,10 +86,6 @@ MIDDLEWARE_CLASSES = ( ROOT_URLCONF = 'binder.urls' -TEMPLATE_DIRS = ( - os.path.join(SITE_ROOT, "templates"), -) - INSTALLED_APPS = ( 'django.contrib.contenttypes', 'django.contrib.auth', diff --git a/binder/templates/registration/login.html b/binder/templates/registration/login.html index 525db3a..75b6ff1 100644 --- a/binder/templates/registration/login.html +++ b/binder/templates/registration/login.html @@ -1,8 +1,9 @@ +{% load static from staticfiles %} Binder DNS Admin – Login - +
diff --git a/binder/urls.py b/binder/urls.py index 379b84a..8989ac5 100644 --- a/binder/urls.py +++ b/binder/urls.py @@ -1,20 +1,22 @@ -from django.conf.urls import patterns, include, url +from django.conf.urls import include, url from django.contrib import admin +import django.contrib.auth.views +import binder.views admin.autodiscover() -urlpatterns = patterns('', +urlpatterns = [ url(r'^admin/', include(admin.site.urls)), - url(r'^accounts/login/$', 'django.contrib.auth.views.login', name='login'), - url(r'^accounts/logout/$', 'django.contrib.auth.views.logout_then_login', name='logout'), + url(r'^accounts/login/$', django.contrib.auth.views.login, name='login'), + url(r'^accounts/logout/$', django.contrib.auth.views.logout_then_login, name='logout'), - url(r'^$', 'binder.views.home_index', name="index"), - url(r'^server_list/$', 'binder.views.view_server_list', name="server_list"), + url(r'^$', binder.views.home_index, name="index"), + url(r'^server_list/$', binder.views.view_server_list, name="server_list"), - url(r'^info/(?P[a-zA-Z0-9.-]+)/$', 'binder.views.view_server_zones', name="server_zone_list"), - url(r'^info/(?P[a-zA-Z0-9.-]+)/(?P[a-zA-Z0-9.-]+)/$', 'binder.views.view_zone_records', name="zone_list"), + url(r'^info/(?P[a-zA-Z0-9.-]+)/$', binder.views.view_server_zones, name="server_zone_list"), + url(r'^info/(?P[a-zA-Z0-9.-]+)/(?P[a-zA-Z0-9.-]+)/$', binder.views.view_zone_records, name="zone_list"), - url(r'^add_record/(?P[a-zA-Z0-9.-]+)/(?P[a-zA-Z0-9.-]+)/$', 'binder.views.view_add_record', name="add_record"), - url(r'^add_cname/(?P[a-zA-Z0-9.-]+)/(?P[a-zA-Z0-9.-]+)/(?P.*?)/$', 'binder.views.view_add_cname_record', name="add_cname"), - url(r'^delete_record/(?P[a-zA-Z0-9.-]+)/(?P[a-zA-Z0-9.-]+)/$', 'binder.views.view_delete_record', name="delete_record"), -) + url(r'^add_record/(?P[a-zA-Z0-9.-]+)/(?P[a-zA-Z0-9.-]+)/$', binder.views.view_add_record, name="add_record"), + url(r'^add_cname/(?P[a-zA-Z0-9.-]+)/(?P[a-zA-Z0-9.-]+)/(?P.*?)/$', binder.views.view_add_cname_record, name="add_cname"), + url(r'^delete_record/(?P[a-zA-Z0-9.-]+)/(?P[a-zA-Z0-9.-]+)/$', binder.views.view_delete_record, name="delete_record"), +] \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index e607e79..e8545af 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -Django>=1.6 +Django>=1.8 dnspython>=1.11 pybindxml>=0.4 diff --git a/wsgi.py b/wsgi.py index bc56fdb..2a209da 100644 --- a/wsgi.py +++ b/wsgi.py @@ -4,7 +4,7 @@ WSGI config for binder project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see -https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/ +https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/ """ import os