Merge pull request #47 from Dunedan/django-1.9

Adds support for Django 1.9 while dropping support for unsupported versions.
This commit is contained in:
Jeffrey Forman 2016-02-12 20:34:54 -05:00
commit 54c3bc18cc
8 changed files with 49 additions and 47 deletions

View File

@ -2,9 +2,8 @@ language: python
python: python:
- "2.7" - "2.7"
env: env:
- DJANGO="Django>=1.6,<1.7"
- DJANGO="Django>=1.7,<1.8"
- DJANGO="Django>=1.8,<1.9" - DJANGO="Django>=1.8,<1.9"
- DJANGO="Django>=1.9,<1.10"
install: install:
- pip install -q $DJANGO - pip install -q $DJANGO
- pip install -r requirements.txt - pip install -r requirements.txt

View File

@ -4,29 +4,20 @@ MAINTAINER Jeffrey Forman <code@jeffreyforman.net>
ENV DEBIAN_FRONTEND noninteractive ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y --no-install-recommends \
git \ git \
python-bs4 \ python-pip
python-dev \
python-django \
python-dnspython \
python-lxml \
python-pip \
python-sqlite
RUN pip install \ RUN git clone https://github.com/jforman/binder.git /opt/binder/
pybindxml
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 RUN ["/opt/binder/manage.py", "migrate"]
env DJANGO_SETTINGS_MODULE binder.settings RUN ["/opt/binder/manage.py", "loaddata", "/opt/binder/binder/fixtures/initial_data.json"]
run ["/opt/binder/manage.py", "migrate"] EXPOSE :8000
run ["/opt/binder/manage.py", "loaddata", "/opt/binder/binder/fixtures/initial_data.json"]
expose :8000 CMD ["/opt/binder/manage.py", "runserver", "0.0.0.0:8000"]
CMD ["/opt/binder/manage.py", "runserver", "0.0.0.0:8000"]

View File

@ -27,7 +27,7 @@ Once the git repository has been cloned these can be installed with one command
Packages installed: Packages installed:
* [Django](http://www.djangoproject.com) * [Django](http://www.djangoproject.com) >=1.8
* Python Modules * 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. * [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. * Beautifulsoup4: This library is included as a dependency of pybindmlx when you when you install pybindxml.

View File

@ -4,7 +4,6 @@ from django.contrib.messages import constants as messages
SITE_ROOT = os.path.dirname(os.path.realpath(__file__)) SITE_ROOT = os.path.dirname(os.path.realpath(__file__))
DEBUG = True DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = ( ADMINS = (
# ('Your Name', 'your_email@domain.com'), # ('Your Name', 'your_email@domain.com'),
@ -56,11 +55,25 @@ except IOError:
except IOError: except IOError:
Exception('Please create a %s file with random characters to generate your secret key!' % SECRET_FILE) 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. TEMPLATES = [
TEMPLATE_LOADERS = ( {
'django.template.loaders.filesystem.Loader', 'BACKEND': 'django.template.backends.django.DjangoTemplates',
'django.template.loaders.app_directories.Loader', '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 = ( MIDDLEWARE_CLASSES = (
'django.middleware.csrf.CsrfViewMiddleware', 'django.middleware.csrf.CsrfViewMiddleware',
@ -73,10 +86,6 @@ MIDDLEWARE_CLASSES = (
ROOT_URLCONF = 'binder.urls' ROOT_URLCONF = 'binder.urls'
TEMPLATE_DIRS = (
os.path.join(SITE_ROOT, "templates"),
)
INSTALLED_APPS = ( INSTALLED_APPS = (
'django.contrib.contenttypes', 'django.contrib.contenttypes',
'django.contrib.auth', 'django.contrib.auth',

View File

@ -1,8 +1,9 @@
{% load static from staticfiles %}
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<title>Binder DNS Admin Login</title> <title>Binder DNS Admin Login</title>
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}bootstrap/css/bootstrap.css" /> <link rel="stylesheet" type="text/css" href="{% static "bootstrap/css/bootstrap.css" %}" />
</head> </head>
<body> <body>
<div class="container"> <div class="container">

View File

@ -1,20 +1,22 @@
from django.conf.urls import patterns, include, url from django.conf.urls import include, url
from django.contrib import admin from django.contrib import admin
import django.contrib.auth.views
import binder.views
admin.autodiscover() admin.autodiscover()
urlpatterns = patterns('', urlpatterns = [
url(r'^admin/', include(admin.site.urls)), url(r'^admin/', include(admin.site.urls)),
url(r'^accounts/login/$', 'django.contrib.auth.views.login', name='login'), 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/logout/$', django.contrib.auth.views.logout_then_login, name='logout'),
url(r'^$', 'binder.views.home_index', name="index"), url(r'^$', binder.views.home_index, name="index"),
url(r'^server_list/$', 'binder.views.view_server_list', name="server_list"), url(r'^server_list/$', binder.views.view_server_list, name="server_list"),
url(r'^info/(?P<dns_server>[a-zA-Z0-9.-]+)/$', 'binder.views.view_server_zones', name="server_zone_list"), url(r'^info/(?P<dns_server>[a-zA-Z0-9.-]+)/$', binder.views.view_server_zones, name="server_zone_list"),
url(r'^info/(?P<dns_server>[a-zA-Z0-9.-]+)/(?P<zone_name>[a-zA-Z0-9.-]+)/$', 'binder.views.view_zone_records', name="zone_list"), url(r'^info/(?P<dns_server>[a-zA-Z0-9.-]+)/(?P<zone_name>[a-zA-Z0-9.-]+)/$', binder.views.view_zone_records, name="zone_list"),
url(r'^add_record/(?P<dns_server>[a-zA-Z0-9.-]+)/(?P<zone_name>[a-zA-Z0-9.-]+)/$', 'binder.views.view_add_record', name="add_record"), url(r'^add_record/(?P<dns_server>[a-zA-Z0-9.-]+)/(?P<zone_name>[a-zA-Z0-9.-]+)/$', binder.views.view_add_record, name="add_record"),
url(r'^add_cname/(?P<dns_server>[a-zA-Z0-9.-]+)/(?P<zone_name>[a-zA-Z0-9.-]+)/(?P<record_name>.*?)/$', 'binder.views.view_add_cname_record', name="add_cname"), url(r'^add_cname/(?P<dns_server>[a-zA-Z0-9.-]+)/(?P<zone_name>[a-zA-Z0-9.-]+)/(?P<record_name>.*?)/$', binder.views.view_add_cname_record, name="add_cname"),
url(r'^delete_record/(?P<dns_server>[a-zA-Z0-9.-]+)/(?P<zone_name>[a-zA-Z0-9.-]+)/$', 'binder.views.view_delete_record', name="delete_record"), url(r'^delete_record/(?P<dns_server>[a-zA-Z0-9.-]+)/(?P<zone_name>[a-zA-Z0-9.-]+)/$', binder.views.view_delete_record, name="delete_record"),
) ]

View File

@ -1,3 +1,3 @@
Django>=1.6 Django>=1.8
dnspython>=1.11 dnspython>=1.11
pybindxml>=0.4 pybindxml>=0.4

View File

@ -4,7 +4,7 @@ WSGI config for binder project.
It exposes the WSGI callable as a module-level variable named ``application``. It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see 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 import os