From 7803e3a57cb4645227b4ea12e7a44265dfd05633 Mon Sep 17 00:00:00 2001 From: Retspen Date: Wed, 25 Mar 2015 22:30:57 +0200 Subject: [PATCH] Added settings-dev and updated Django --- development/requirements.txt | 2 +- instances/views.py | 17 +++++++++-------- webvirtcloud/settings-dev.py | 9 +++++++++ webvirtcloud/settings.py | 4 ++-- 4 files changed, 21 insertions(+), 11 deletions(-) create mode 100644 webvirtcloud/settings-dev.py diff --git a/development/requirements.txt b/development/requirements.txt index 830e966..fad841d 100644 --- a/development/requirements.txt +++ b/development/requirements.txt @@ -1,2 +1,2 @@ -Django==1.7.5 +Django==1.7.7 websockify==0.6.0 \ No newline at end of file diff --git a/instances/views.py b/instances/views.py index 98dfafc..248f99c 100644 --- a/instances/views.py +++ b/instances/views.py @@ -60,15 +60,16 @@ def instances(request): if connection_manager.host_is_up(comp.type, comp.hostname): try: conn = wvmHostDetails(comp, comp.login, comp.password, comp.type) - all_host_vms[comp.id, comp.name] = conn.get_host_instances() - for vm, info in conn.get_host_instances().items(): - try: - check_uuid = Instance.objects.get(compute_id=comp.id, name=vm) - if check_uuid.uuid != info['uuid']: + if conn.get_host_instances(): + all_host_vms[comp.id, comp.name] = conn.get_host_instances() + for vm, info in conn.get_host_instances().items(): + try: + check_uuid = Instance.objects.get(compute_id=comp.id, name=vm) + if check_uuid.uuid != info['uuid']: + check_uuid.save() + except Instance.DoesNotExist: + check_uuid = Instance(compute_id=comp.id, name=vm, uuid=info['uuid']) check_uuid.save() - except Instance.DoesNotExist: - check_uuid = Instance(compute_id=comp.id, name=vm, uuid=info['uuid']) - check_uuid.save() conn.close() except libvirtError as lib_err: error_messages.append(lib_err) diff --git a/webvirtcloud/settings-dev.py b/webvirtcloud/settings-dev.py new file mode 100644 index 0000000..749ce09 --- /dev/null +++ b/webvirtcloud/settings-dev.py @@ -0,0 +1,9 @@ +""" +Django dev settings for webvirtcloud project. + +""" + +from settings import * + +DEBUG = True +TEMPLATE_DEBUG = True \ No newline at end of file diff --git a/webvirtcloud/settings.py b/webvirtcloud/settings.py index 8dd70b9..8a7d9b5 100644 --- a/webvirtcloud/settings.py +++ b/webvirtcloud/settings.py @@ -8,9 +8,9 @@ BASE_DIR = os.path.dirname(os.path.dirname(__file__)) SECRET_KEY = '4y(f4rfqc6f2!i8_vfuu)kav6tdv5#sc=n%o451dm+th0&3uci' -DEBUG = True +DEBUG = False -TEMPLATE_DEBUG = True +TEMPLATE_DEBUG = False ALLOWED_HOSTS = ['*']