import django settings module in importer
diff --git a/plstackapi/core/models.py b/plstackapi/core/models.py
index a0e332c..79edaca 100644
--- a/plstackapi/core/models.py
+++ b/plstackapi/core/models.py
@@ -2,7 +2,6 @@
from django.db import models
from plstackapi.openstack.driver import OpenStackDriver
-os.environ.setdefault("DJANGO_SETTINGS_MODULE", "plstackapi.planetstack.settings")
# Create your models here.
class PlCoreBase(models.Model):
diff --git a/plstackapi/importer/plclassic/importer.py b/plstackapi/importer/plclassic/importer.py
index 8831afd..599e548 100644
--- a/plstackapi/importer/plclassic/importer.py
+++ b/plstackapi/importer/plclassic/importer.py
@@ -1,4 +1,5 @@
import os
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "plstackapi.planetstack.settings")
import xmlrpclib
from plstackapi.importer.plclassic.site_importer import SiteImporter
from plstackapi.importer.plclassic.user_importer import UserImporter
@@ -16,19 +17,19 @@
return self.callable(*a)
class API():
- def __init__(self):
+ def __init__(self, username, password, url):
self.auth = {'AuthMethod': 'password',
- 'Username': None,
- 'AuthString': None}
- self.server = xmlrpclib.ServerProxy("URL", allow_none=True)
+ 'Username': username,
+ 'AuthString': password}
+ self.server = xmlrpclib.ServerProxy(url, allow_none=True)
def __getattr__(self, name):
return Call(getattr(self.server, name), self.auth)
class Importer:
- def __init__(self):
- api = API()
+ def __init__(self, username, password, url):
+ api = API(username, password, url)
self.sites = SiteImporter(api)
self.slices = SliceImporter(api, remote_sites=self.sites.remote_sites, local_sites=self.sites.local_sites)
self.users = UserImporter(api)