Commit 75d45516 by Őry Máté

django: use settings api

parent 88998966
...@@ -239,7 +239,7 @@ CACHES = { ...@@ -239,7 +239,7 @@ CACHES = {
} }
store_settings = { STORE_SETTINGS = {
"basic_auth": "True", "basic_auth": "True",
"verify_ssl": "False", "verify_ssl": "False",
"ssl_auth": "False", "ssl_auth": "False",
...@@ -251,7 +251,7 @@ store_settings = { ...@@ -251,7 +251,7 @@ store_settings = {
"store_public": "store.ik.bme.hu", "store_public": "store.ik.bme.hu",
} }
firewall_settings = { FIREWALL_SETTINGS = {
"default_vlangroup": "publikus", "default_vlangroup": "publikus",
"reload_sleep": "10", "reload_sleep": "10",
"dns_hostname": "dns1.ik.bme.hu", "dns_hostname": "dns1.ik.bme.hu",
......
from django.contrib import auth from django.contrib import auth
from firewall import models from firewall import models
import os import os
from django.conf.settings import firewall_settings as settings import django.conf
import subprocess import subprocess
import re import re
...@@ -10,6 +11,7 @@ from datetime import datetime, timedelta ...@@ -10,6 +11,7 @@ from datetime import datetime, timedelta
from django.db.models import Q from django.db.models import Q
settings = django.conf.settings.FIREWALL_SETTINGS
class Firewall: class Firewall:
IPV6=False IPV6=False
RULES = None RULES = None
......
...@@ -7,11 +7,12 @@ from django.utils.translation import ugettext_lazy as _ ...@@ -7,11 +7,12 @@ from django.utils.translation import ugettext_lazy as _
from firewall.fields import * from firewall.fields import *
from south.modelsinspector import add_introspection_rules from south.modelsinspector import add_introspection_rules
from django.core.validators import MinValueValidator, MaxValueValidator from django.core.validators import MinValueValidator, MaxValueValidator
from django.conf.settings import firewall_settings as settings import django.conf
from django.db.models.signals import post_save from django.db.models.signals import post_save
import re import re
import random import random
settings = django.conf.settings.FIREWALL_SETTINGS
class Rule(models.Model): class Rule(models.Model):
CHOICES_type = (('host', 'host'), ('firewall', 'firewall'), CHOICES_type = (('host', 'host'), ('firewall', 'firewall'),
('vlan', 'vlan')) ('vlan', 'vlan'))
......
...@@ -4,7 +4,9 @@ from django.core.cache import cache ...@@ -4,7 +4,9 @@ from django.core.cache import cache
import os import os
import time import time
from firewall.fw import * from firewall.fw import *
from django.conf.settings import firewall_settings as settings import django.conf
settings = django.conf.settings.FIREWALL_SETTINGS
@celery.task @celery.task
def reload_dns_task(data): def reload_dns_task(data):
......
...@@ -18,7 +18,9 @@ from firewall.models import Host, Rule, Vlan, Record ...@@ -18,7 +18,9 @@ from firewall.models import Host, Rule, Vlan, Record
from school.models import Person, Group from school.models import Person, Group
from store.api import StoreApi from store.api import StoreApi
from .util import keygen from .util import keygen
from django.conf.settings import CLOUD_URL import django.conf
CLOUD_URL = django.conf.settings.CLOUD_URL
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
pwgen = User.objects.make_random_password pwgen = User.objects.make_random_password
......
...@@ -20,7 +20,6 @@ from django.utils.translation import ugettext_lazy as _ ...@@ -20,7 +20,6 @@ from django.utils.translation import ugettext_lazy as _
from django.views.decorators.http import * from django.views.decorators.http import *
from django.views.generic import * from django.views.generic import *
from firewall.tasks import * from firewall.tasks import *
from django.conf.settings import store_settings
from one.models import * from one.models import *
from school.models import * from school.models import *
import django.contrib.auth as auth import django.contrib.auth as auth
...@@ -28,6 +27,7 @@ import json ...@@ -28,6 +27,7 @@ import json
import logging import logging
import subprocess import subprocess
store_settings = settings.STORE_SETTINGS
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
def _list_instances(request): def _list_instances(request):
......
from django.db import models from django.db import models
from django.http import Http404 from django.http import Http404
import json, requests, time import json, requests, time
from django.conf.settings import store_settings as settings import django.conf
settings = django.conf.settings.STORE_SETTINGS
# Create your models here. # Create your models here.
#TODO Handle exceptions locally #TODO Handle exceptions locally
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment