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:
- "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

View File

@ -4,29 +4,20 @@ MAINTAINER Jeffrey Forman <code@jeffreyforman.net>
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"]
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:
* [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.

View File

@ -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',

View File

@ -1,8 +1,9 @@
{% load static from staticfiles %}
<!DOCTYPE html>
<html lang="en">
<head>
<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>
<body>
<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
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<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.-]+)/$', 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'^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'^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'^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'^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
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``.
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