From d5d63b4dca23766be58b850a5ee6d5ef8d7f4e64 Mon Sep 17 00:00:00 2001 From: Nikolai R Kristiansen Date: Sun, 12 Aug 2018 23:26:12 +0200 Subject: [PATCH] Try bumping to django 2.0 --- Pipfile | 20 +++ Pipfile.lock | 147 ++++++++++++++++++++++ mdb/migrations/0001_initial.py | 32 ++--- mdb/migrations/0006_auto_20151001_2235.py | 2 +- mdb/migrations/0010_auto_20151004_1709.py | 2 +- mdb/models.py | 51 +++----- mdbsite/settings.py | 41 +++--- mdbsite/urls.py | 8 +- requirements.txt | 9 -- 9 files changed, 224 insertions(+), 88 deletions(-) create mode 100644 Pipfile create mode 100644 Pipfile.lock delete mode 100644 requirements.txt diff --git a/Pipfile b/Pipfile new file mode 100644 index 0000000..1a813f3 --- /dev/null +++ b/Pipfile @@ -0,0 +1,20 @@ +[[source]] +url = "https://pypi.org/simple" +verify_ssl = true +name = "pypi" + +[packages] +django = "==2.0.8" +django-auth-ldap = "==1.7.0" +django-extensions = "==2.1.0" +djangorestframework = "==3.8.2" +gunicorn = "==19.9.0" +ipaddress = "==1.0.22" +mysqlclient = "==1.3.13" +raven = "==6.9.0" +django-suit = "*" + +[dev-packages] + +[requires] +python_version = "3.6" diff --git a/Pipfile.lock b/Pipfile.lock new file mode 100644 index 0000000..2ae4705 --- /dev/null +++ b/Pipfile.lock @@ -0,0 +1,147 @@ +{ + "_meta": { + "hash": { + "sha256": "2280ffc42c9d702c0cfeba59fdb86215b1a8cad743ae3dc49fd6790aa00cf885" + }, + "pipfile-spec": 6, + "requires": { + "python_version": "3.6" + }, + "sources": [ + { + "name": "pypi", + "url": "https://pypi.org/simple", + "verify_ssl": true + } + ] + }, + "default": { + "django": { + "hashes": [ + "sha256:0c5b65847d00845ee404bbc0b4a85686f15eb3001ffddda3db4e9baa265bf136", + "sha256:68aeea369a8130259354b6ba1fa9babe0c5ee6bced505dea4afcd00f765ae38b" + ], + "index": "pypi", + "version": "==2.0.8" + }, + "django-auth-ldap": { + "hashes": [ + "sha256:72848b3b036d299114be3c6ef38b12f83f6cf1cf1696c5f92e06fe45a1b8e27b", + "sha256:f96398ce957bb8aaaee2e9d93e3eaf9955ab95a6d342303b5519350eb834f5d1" + ], + "index": "pypi", + "version": "==1.7.0" + }, + "django-extensions": { + "hashes": [ + "sha256:c3c8524056ab1174c6fc769b0599e60f7e7797ce34f38db2effc48885a0a982c", + "sha256:e279344c6d825adb27694755aa924702d3cc401f8fad5ad9ef2d577948778a5f" + ], + "index": "pypi", + "version": "==2.1.0" + }, + "django-suit": { + "hashes": [ + "sha256:19ed865a478dfca81cb5f50a70317700dd70da92c465093251d0e14330a2b92b" + ], + "index": "pypi", + "version": "==0.2.26" + }, + "djangorestframework": { + "hashes": [ + "sha256:b6714c3e4b0f8d524f193c91ecf5f5450092c2145439ac2769711f7eba89a9d9", + "sha256:c375e4f95a3a64fccac412e36fb42ba36881e52313ec021ef410b40f67cddca4" + ], + "index": "pypi", + "version": "==3.8.2" + }, + "gunicorn": { + "hashes": [ + "sha256:aa8e0b40b4157b36a5df5e599f45c9c76d6af43845ba3b3b0efe2c70473c2471", + "sha256:fa2662097c66f920f53f70621c6c58ca4a3c4d3434205e608e121b5b3b71f4f3" + ], + "index": "pypi", + "version": "==19.9.0" + }, + "ipaddress": { + "hashes": [ + "sha256:64b28eec5e78e7510698f6d4da08800a5c575caa4a286c93d651c5d3ff7b6794", + "sha256:b146c751ea45cad6188dd6cf2d9b757f6f4f8d6ffb96a023e6f2e26eea02a72c" + ], + "index": "pypi", + "version": "==1.0.22" + }, + "mysqlclient": { + "hashes": [ + "sha256:ff8ee1be84215e6c30a746b728c41eb0701a46ca76e343af445b35ce6250644f" + ], + "index": "pypi", + "version": "==1.3.13" + }, + "pyasn1": { + "hashes": [ + "sha256:0ad0fe0593dde1e599cac0bf65bb1a4ec663032f0bc68ee44850db4251e8c501", + "sha256:13794d835643ee970b2c059dbfe4eb5d751e16c693c8baee61c526abd209e5c7", + "sha256:49a8ed515f26913049113820b462f698e6ed26df62c389dafb6fa3685ddca8de", + "sha256:74ac8521a0480f228549be20bea555ae35678f0e754c2fbc6f1576b0959bec43", + "sha256:89399ca8ecd4524f974e926d4ef9e7a787903e01f0a9cdff3131ad1361792fe5", + "sha256:8f291e0338d519a1a0d07f0b9d03c9265f6be26eb32fdd21af6d3259d14ea49c", + "sha256:b9d3abc5031e61927c82d4d96c1cec1e55676c1a991623cfed28faea73cdd7ca", + "sha256:d3bbd726c1a760d4ca596a4d450c380b81737612fe0182f5bb3caebc17461fd9", + "sha256:dea873d6c907c1cf1341fd88742a61efce33227d7743cb37564ab7d7e77dd9fd", + "sha256:ded5eea5cb88bc1ce9aa074b5a3092f95ce4741887e317e9b49c7ece75d7ea0e", + "sha256:e8b69ea2200d42201cbedd486eedb8980f320d4534f83ce2fb468e96aa5545d0", + "sha256:edad117649643230493aeb4955456ce19ab4b12e94489dde6f7094cdb5a3c87e", + "sha256:f58f2a3d12fd754aa123e9fa74fb7345333000a035f3921dbdaa08597aa53137" + ], + "version": "==0.4.4" + }, + "pyasn1-modules": { + "hashes": [ + "sha256:077250b34432520430bc1c80dcbda4e354090785567c33ded35faa6df8d24753", + "sha256:0da2f947e8ad2697e86fe5fd0e55a4093a2fd79d839c9e19c34e28097db7002c", + "sha256:35ff894a0b5df8e28b700126b2869c7dcfb2b2db5bc82e5d5e82547069241553", + "sha256:44688b94841349648b1e1a5a7a3d96e6596d5d4f21d0b59a82307e153c4dc74b", + "sha256:833716dde880a7f2f2ccdeea9a096842626981ff2a477d8b318c0906367ac11b", + "sha256:a0cf3e1842e7c60fde97cb22d275eb6f9524f5c5250489e292529de841417547", + "sha256:a38a8811ea784c0136abfdba73963876328f66172db21a05a82f9515909bfb4e", + "sha256:a728bb9502d1fdc104c66f24a176b6a70a32e89d1d8a5b55c959233ed51c67be", + "sha256:c30a098435ea0989c37005a971843e9d3966c7f6d056ddbf052e5061c06e3291", + "sha256:c355a45b32c5bc1d9893eceb704b0cfcd1126f91b5a7b9ee64c1c05383283381", + "sha256:e64679de1940f41ead5170fce364d54e7b9e2e862f064727b6bcb5cee753b7a2", + "sha256:ed71d20225c356881c29f0b1d7a0d6521563a389d9478e8f95d798cc5ba07b88", + "sha256:f183f0940b9f5ed2ad9d04c80cab2451440fa9af4fc959d85113fadd2e777962" + ], + "version": "==0.2.2" + }, + "python-ldap": { + "hashes": [ + "sha256:41975e79406502c092732c57ef0c2c2eb318d91e8e765f81f5d4ab6c1db727c5" + ], + "version": "==3.1.0" + }, + "pytz": { + "hashes": [ + "sha256:a061aa0a9e06881eb8b3b2b43f05b9439d6583c206d0a6c340ff72a7b6669053", + "sha256:ffb9ef1de172603304d9d2819af6f5ece76f2e85ec10692a524dd876e72bf277" + ], + "version": "==2018.5" + }, + "raven": { + "hashes": [ + "sha256:3fd787d19ebb49919268f06f19310e8112d619ef364f7989246fc8753d469888", + "sha256:95f44f3ea2c1b176d5450df4becdb96c15bf2632888f9ab193e9dd22300ce46a" + ], + "index": "pypi", + "version": "==6.9.0" + }, + "six": { + "hashes": [ + "sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9", + "sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb" + ], + "version": "==1.11.0" + } + }, + "develop": {} +} diff --git a/mdb/migrations/0001_initial.py b/mdb/migrations/0001_initial.py index b53b891..2e1ca5b 100644 --- a/mdb/migrations/0001_initial.py +++ b/mdb/migrations/0001_initial.py @@ -81,7 +81,7 @@ class Migration(migrations.Migration): ('name', models.CharField(max_length=256)), ('target', models.CharField(max_length=256)), ('created_date', models.DateTimeField(auto_now_add=True)), - ('domain', models.ForeignKey(to='mdb.Domain')), + ('domain', models.ForeignKey(to='mdb.Domain', on_delete=models.CASCADE)), ], options={ }, @@ -94,7 +94,7 @@ class Migration(migrations.Migration): ('name', models.CharField(max_length=256)), ('target', models.CharField(max_length=256)), ('created_date', models.DateTimeField(auto_now_add=True)), - ('domain', models.ForeignKey(to='mdb.Domain')), + ('domain', models.ForeignKey(to='mdb.Domain', on_delete=models.CASCADE)), ], options={ }, @@ -112,7 +112,7 @@ class Migration(migrations.Migration): ('port', models.IntegerField()), ('target', models.CharField(max_length=256)), ('created_date', models.DateTimeField(auto_now_add=True)), - ('domain', models.ForeignKey(to='mdb.Domain')), + ('domain', models.ForeignKey(to='mdb.Domain', on_delete=models.CASCADE)), ], options={ }, @@ -125,7 +125,7 @@ class Migration(migrations.Migration): ('name', models.CharField(max_length=256)), ('target', models.CharField(max_length=256)), ('created_date', models.DateTimeField(auto_now_add=True)), - ('domain', models.ForeignKey(to='mdb.Domain')), + ('domain', models.ForeignKey(to='mdb.Domain', on_delete=models.CASCADE)), ], options={ }, @@ -174,8 +174,8 @@ class Migration(migrations.Migration): ('pxe_filename', models.CharField(max_length=64, blank=True)), ('dhcp_client', models.BooleanField(default=False)), ('created_date', models.DateTimeField(auto_now_add=True)), - ('domain', models.ForeignKey(to='mdb.Domain')), - ('host', models.ForeignKey(to='mdb.Host')), + ('domain', models.ForeignKey(to='mdb.Domain', on_delete=models.CASCADE)), + ('host', models.ForeignKey(to='mdb.Host', on_delete=models.CASCADE)), ], options={ }, @@ -217,7 +217,7 @@ class Migration(migrations.Migration): ('dhcp_dynamic', models.BooleanField(default=False)), ('dhcp_dynamic_start', models.IPAddressField(null=True, blank=True)), ('dhcp_dynamic_end', models.IPAddressField(null=True, blank=True)), - ('dhcp_config', models.ForeignKey(to='mdb.DhcpConfig')), + ('dhcp_config', models.ForeignKey(to='mdb.DhcpConfig', on_delete=models.CASCADE)), ], options={ 'verbose_name': 'IPv4 subnet', @@ -229,7 +229,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('address', models.CharField(max_length=64)), - ('interface', models.ForeignKey(to='mdb.Interface')), + ('interface', models.ForeignKey(to='mdb.Interface', on_delete=models.CASCADE)), ], options={ 'verbose_name': 'IPv6 address', @@ -309,7 +309,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='operatingsystem', name='architecture', - field=models.ForeignKey(to='mdb.OsArchitecture'), + field=models.ForeignKey(to='mdb.OsArchitecture', on_delete=models.CASCADE), preserve_default=True, ), migrations.AddField( @@ -321,7 +321,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='ip6address', name='subnet', - field=models.ForeignKey(to='mdb.Ip6Subnet'), + field=models.ForeignKey(to='mdb.Ip6Subnet', on_delete=models.CASCADE), preserve_default=True, ), migrations.AddField( @@ -333,25 +333,25 @@ class Migration(migrations.Migration): migrations.AddField( model_name='ip4address', name='subnet', - field=models.ForeignKey(to='mdb.Ip4Subnet'), + field=models.ForeignKey(to='mdb.Ip4Subnet', on_delete=models.CASCADE), preserve_default=True, ), migrations.AddField( model_name='interface', name='ip4address', - field=models.ForeignKey(null=True, blank=True, to='mdb.Ip4Address', unique=True), + field=models.ForeignKey(null=True, blank=True, to='mdb.Ip4Address', unique=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='host', name='host_type', - field=models.ForeignKey(to='mdb.HostType'), + field=models.ForeignKey(to='mdb.HostType', on_delete=models.CASCADE), preserve_default=True, ), migrations.AddField( model_name='host', name='operating_system', - field=models.ForeignKey(to='mdb.OperatingSystem'), + field=models.ForeignKey(to='mdb.OperatingSystem', on_delete=models.CASCADE), preserve_default=True, ), migrations.AddField( @@ -369,13 +369,13 @@ class Migration(migrations.Migration): migrations.AddField( model_name='dhcpoption', name='ip4subnet', - field=models.ForeignKey(to='mdb.Ip4Subnet'), + field=models.ForeignKey(to='mdb.Ip4Subnet', on_delete=models.CASCADE), preserve_default=True, ), migrations.AddField( model_name='dhcpcustomfield', name='ip4subnet', - field=models.ForeignKey(to='mdb.Ip4Subnet'), + field=models.ForeignKey(to='mdb.Ip4Subnet', on_delete=models.CASCADE), preserve_default=True, ), ] diff --git a/mdb/migrations/0006_auto_20151001_2235.py b/mdb/migrations/0006_auto_20151001_2235.py index bb38709..7ab7487 100644 --- a/mdb/migrations/0006_auto_20151001_2235.py +++ b/mdb/migrations/0006_auto_20151001_2235.py @@ -35,7 +35,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='interface', name='ip4address', - field=models.OneToOneField(to='mdb.Ip4Address', null=True, blank=True), + field=models.OneToOneField(to='mdb.Ip4Address', null=True, blank=True, on_delete=models.SET_NULL), ), migrations.AlterField( model_name='interface', diff --git a/mdb/migrations/0010_auto_20151004_1709.py b/mdb/migrations/0010_auto_20151004_1709.py index 5bf4fec..1e0db6f 100644 --- a/mdb/migrations/0010_auto_20151004_1709.py +++ b/mdb/migrations/0010_auto_20151004_1709.py @@ -18,7 +18,7 @@ class Migration(migrations.Migration): ('name', models.CharField(max_length=256)), ('target', models.GenericIPAddressField(protocol='IPv6')), ('created_date', models.DateTimeField(auto_now_add=True)), - ('domain', models.ForeignKey(to='mdb.Domain')), + ('domain', models.ForeignKey(to='mdb.Domain', on_delete=models.CASCADE)), ], ), migrations.AlterField( diff --git a/mdb/models.py b/mdb/models.py index 0b9b470..4956be9 100644 --- a/mdb/models.py +++ b/mdb/models.py @@ -1,5 +1,4 @@ from django.db import models -from django.utils.encoding import python_2_unicode_compatible from django.utils.translation import ugettext_lazy as _ from mdb.pxe import host_as_pxe_files @@ -9,7 +8,6 @@ import ipaddress import datetime -@python_2_unicode_compatible class Nameserver(models.Model): hostname = models.CharField(max_length=256) @@ -17,7 +15,6 @@ class Nameserver(models.Model): return self.hostname -@python_2_unicode_compatible class MailExchange(models.Model): priority = models.IntegerField() hostname = models.CharField(max_length=256) @@ -26,7 +23,6 @@ class MailExchange(models.Model): return "(" + str(self.priority) + ") " + self.hostname -@python_2_unicode_compatible class Domain(models.Model): domain_name = models.CharField(max_length=256) domain_soa = models.CharField(max_length=256) @@ -124,7 +120,6 @@ class Domain(models.Model): return content -@python_2_unicode_compatible class DomainSrvRecord(models.Model): srvce = models.CharField(max_length=64) prot = models.CharField(max_length=64) @@ -133,7 +128,7 @@ class DomainSrvRecord(models.Model): weight = models.IntegerField() port = models.IntegerField() target = models.CharField(max_length=256) - domain = models.ForeignKey(Domain) + domain = models.ForeignKey(Domain, on_delete=models.CASCADE) created_date = models.DateTimeField(auto_now_add=True) def as_record(self): @@ -152,11 +147,10 @@ class DomainSrvRecord(models.Model): return self.as_record() -@python_2_unicode_compatible class DomainTxtRecord(models.Model): name = models.CharField(max_length=256) target = models.CharField(max_length=256) - domain = models.ForeignKey(Domain) + domain = models.ForeignKey(Domain, on_delete=models.CASCADE) created_date = models.DateTimeField(auto_now_add=True) def as_record(self): @@ -166,11 +160,10 @@ class DomainTxtRecord(models.Model): return self.as_record() -@python_2_unicode_compatible class DomainCnameRecord(models.Model): name = models.CharField(max_length=256) target = models.CharField(max_length=256) - domain = models.ForeignKey(Domain) + domain = models.ForeignKey(Domain, on_delete=models.CASCADE) created_date = models.DateTimeField(auto_now_add=True) def as_record(self): @@ -180,11 +173,10 @@ class DomainCnameRecord(models.Model): return self.as_record() -@python_2_unicode_compatible class DomainARecord(models.Model): name = models.CharField(max_length=256) target = models.GenericIPAddressField(protocol='IPv4') - domain = models.ForeignKey(Domain) + domain = models.ForeignKey(Domain, on_delete=models.CASCADE) created_date = models.DateTimeField(auto_now_add=True) def as_record(self): @@ -194,11 +186,10 @@ class DomainARecord(models.Model): return self.as_record() -@python_2_unicode_compatible class DomainAAAARecord(models.Model): name = models.CharField(max_length=256) target = models.GenericIPAddressField(protocol='IPv6') - domain = models.ForeignKey(Domain) + domain = models.ForeignKey(Domain, on_delete=models.CASCADE) created_date = models.DateTimeField(auto_now_add=True) def as_record(self): @@ -208,7 +199,6 @@ class DomainAAAARecord(models.Model): return self.as_record() -@python_2_unicode_compatible class DhcpConfig(models.Model): serial = models.IntegerField() active_serial = models.IntegerField() @@ -270,7 +260,6 @@ class DhcpConfig(models.Model): verbose_name = 'DHCP config' -@python_2_unicode_compatible class Ip6Subnet(models.Model): name = models.CharField(max_length=255) network = models.CharField(max_length=255) @@ -340,7 +329,6 @@ class Ip6Subnet(models.Model): verbose_name = 'IPv6 subnet' -@python_2_unicode_compatible class Ip4Subnet(models.Model): name = models.CharField(max_length=256) netmask = models.GenericIPAddressField(protocol='IPv4') @@ -362,7 +350,7 @@ class Ip4Subnet(models.Model): dhcp_dynamic = models.BooleanField(default=False) dhcp_dynamic_start = models.GenericIPAddressField(protocol='IPv4', null=True, blank=True) dhcp_dynamic_end = models.GenericIPAddressField(protocol='IPv4', null=True, blank=True) - dhcp_config = models.ForeignKey(DhcpConfig) + dhcp_config = models.ForeignKey(DhcpConfig, on_delete=models.CASCADE) def __str__(self): return self.network + " (" + self.name + ")" @@ -409,11 +397,10 @@ class Ip4Subnet(models.Model): verbose_name = 'IPv4 subnet' -@python_2_unicode_compatible class DhcpOption(models.Model): key = models.CharField(max_length=255) value = models.CharField(max_length=255) - ip4subnet = models.ForeignKey(Ip4Subnet) + ip4subnet = models.ForeignKey(Ip4Subnet, on_delete=models.CASCADE) def __str__(self): return self.key + " " + self.value @@ -424,15 +411,14 @@ class DhcpOption(models.Model): class DhcpCustomField(models.Model): value = models.CharField(max_length=255) - ip4subnet = models.ForeignKey(Ip4Subnet) + ip4subnet = models.ForeignKey(Ip4Subnet, on_delete=models.CASCADE) class Meta: verbose_name = 'DHCP custom field' -@python_2_unicode_compatible class Ip4Address(models.Model): - subnet = models.ForeignKey(Ip4Subnet) + subnet = models.ForeignKey(Ip4Subnet, on_delete=models.CASCADE) address = models.GenericIPAddressField(protocol='IPv4') last_contact = models.DateTimeField(null=True, blank=True) ping_avg_rtt = models.FloatField(null=True, blank=True) @@ -445,7 +431,6 @@ class Ip4Address(models.Model): verbose_name_plural = 'IPv4 addresses' -@python_2_unicode_compatible class HostType(models.Model): host_type = models.CharField(max_length=64) description = models.CharField(max_length=1024) @@ -460,7 +445,6 @@ class HostType(models.Model): ordering = ("host_type",) -@python_2_unicode_compatible class OperatingSystem(models.Model): OS_ARCHITECTURES = ( ('mips', _('MIPS')), @@ -488,7 +472,6 @@ class OperatingSystem(models.Model): ordering = ("name", "version") -@python_2_unicode_compatible class Host(models.Model): location = models.CharField(max_length=1024) brand = models.CharField(max_length=1024) @@ -498,9 +481,9 @@ class Host(models.Model): serial_number = models.CharField(max_length=256) description = models.CharField(max_length=1024) created_date = models.DateTimeField(auto_now_add=True) - host_type = models.ForeignKey(HostType) + host_type = models.ForeignKey(HostType, on_delete=models.CASCADE) virtual = models.BooleanField(default=False) - operating_system = models.ForeignKey(OperatingSystem) + operating_system = models.ForeignKey(OperatingSystem, on_delete=models.CASCADE) request_kerberos_principal = models.BooleanField(default=False) kerberos_principal_created = models.BooleanField(default=False, editable=False) @@ -517,16 +500,15 @@ class Host(models.Model): return host_as_pxe_files(self) -@python_2_unicode_compatible class Interface(models.Model): name = models.CharField(max_length=128) macaddr = models.CharField(max_length=17, validators=[validate_macaddr]) pxe_filename = models.CharField(max_length=64, blank=True) dhcp_client = models.BooleanField(default=False) - host = models.ForeignKey(Host) - ip4address = models.OneToOneField(Ip4Address, blank=True, null=True) + host = models.ForeignKey(Host, on_delete=models.CASCADE) + ip4address = models.OneToOneField(Ip4Address, blank=True, null=True, on_delete=models.SET_NULL) created_date = models.DateTimeField(auto_now_add=True) - domain = models.ForeignKey(Domain) + domain = models.ForeignKey(Domain, on_delete=models.CASCADE) def __str__(self): return "%s (%s on %s)" % (self.macaddr, self.name, self.host.hostname) @@ -535,11 +517,10 @@ class Interface(models.Model): return self.ip6address_set.exists() -@python_2_unicode_compatible class Ip6Address(models.Model): - subnet = models.ForeignKey(Ip6Subnet) + subnet = models.ForeignKey(Ip6Subnet, on_delete=models.CASCADE) address = models.GenericIPAddressField(protocol='IPv6') - interface = models.ForeignKey(Interface) + interface = models.ForeignKey(Interface, on_delete=models.CASCADE) def full_address(self): return self.subnet.network + self.address diff --git a/mdbsite/settings.py b/mdbsite/settings.py index a1ae56c..08533c2 100644 --- a/mdbsite/settings.py +++ b/mdbsite/settings.py @@ -1,5 +1,4 @@ import os -from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS as TCP import raven BASE_DIR = os.path.dirname(os.path.dirname(__file__)) @@ -33,38 +32,40 @@ ADMIN_MEDIA_PREFIX = '/media/' STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') STATIC_URL = '/static/' - - -# Additional locations of static files -STATICFILES_DIRS = ( -) - -# List of finder classes that know how to find static files in -# various locations. STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', -# 'django.contrib.staticfiles.finders.DefaultStorageFinder', ) # Make this unique, and don't share it with anybody. SECRET_KEY = '@4ps=ebofcpv8sb#y7gm896=l&l*u0u-pgo7bcdj%+(k+2lqnl' -MIDDLEWARE_CLASSES = ( +MIDDLEWARE = [ 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', -) +] ROOT_URLCONF = 'mdbsite.urls' -TEMPLATE_DIRS = ( - # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". - # Always use forward slashes, even on Windows. - # Don't forget to use absolute paths, not relative paths. -) +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] INSTALLED_APPS = ( 'django.contrib.auth', @@ -84,10 +85,6 @@ INSTALLED_APPS = ( EMAIL_SUBJECT_PREFIX = '[MDB] ' -TEMPLATE_CONTEXT_PROCESSORS = TCP + ( - 'django.core.context_processors.request', # for django-suit -) - # Logging LOGGING = { 'version': 1, @@ -120,7 +117,7 @@ LOGGING = { 'propagate': False, }, 'raven': { - 'level': 'DEBUG', + 'level': 'WARNING', 'handlers': ['console'], 'propagate': False, }, diff --git a/mdbsite/urls.py b/mdbsite/urls.py index 4deb08c..e3c5f5c 100644 --- a/mdbsite/urls.py +++ b/mdbsite/urls.py @@ -1,15 +1,15 @@ -from django.conf.urls import include, url from django.contrib import admin from django.contrib.staticfiles.urls import staticfiles_urlpatterns +from django.urls import re_path, path from django.views.generic.base import RedirectView from mdb.api.views import HostPXEValidate admin.autodiscover() urlpatterns = [ - url(r'^$', RedirectView.as_view(url='admin/', permanent=True)), - url(r'^admin/', include(admin.site.urls)), - url(r'^api/validate-host-secret/', HostPXEValidate.as_view(), name='api-validate-host-secret') + re_path(r'^$', RedirectView.as_view(url='admin/', permanent=True)), + path('admin/', admin.site.urls), + path('api/validate-host-secret/', HostPXEValidate.as_view(), name='api-validate-host-secret') ] urlpatterns += staticfiles_urlpatterns() diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 48c70b7..0000000 --- a/requirements.txt +++ /dev/null @@ -1,9 +0,0 @@ -Django>=1.8,<1.9 -django-auth-ldap==1.2.8 -django-extensions==1.7.5 -djangorestframework==3.5.3 -django-suit==0.2.23 -gunicorn==19.6.0 -ipaddress==1.0.17 -mysqlclient==1.3.9 -raven==5.32.0 \ No newline at end of file