예제 #1
0
 def setUpClass(cls):
     domain = 'apptest'
     cls.domain = Domain.get_or_create_with_name(domain, is_active=True)
     cls.cc_2_build = add_build(version='2.7.0', build_number=20655)
     with open(os.path.join(os.path.dirname(__file__), 'data', 'yesno.json')) as f:
         source = json.load(f)
     cls.app = Application.wrap(source)
     cls.app.domain = domain
     cls.app.save()
     cls.build = cls.app.make_build()
     cls.build.save(increment_version=False)
예제 #2
0
 def setUp(self):
     domain = 'apptest'
     self.domain = Domain.get_or_create_with_name(domain, is_active=True)
     self.cc_2_build = add_build(version='2.7.0', build_number=20655)
     with open(os.path.join(os.path.dirname(__file__), 'data',
                            'yesno.json')) as f:
         source = json.load(f)
     self.app = Application.wrap(source)
     self.app.domain = domain
     self.app.save()
     self.build = self.app.make_build()
     self.build.save(increment_version=False)
예제 #3
0
    def handle(self, *args, **options):
        from corehq.apps.users.models import WebUser
        if len(args) != 3:
            raise CommandError(
                'Usage: manage.py bootstrap <domain> <email> <password>')
        domain_name, username, passwd = args
        domain = Domain.get_or_create_with_name(domain_name, is_active=True)
        couch_user = WebUser.create(domain_name, username, passwd)
        couch_user.add_domain_membership(domain_name, is_admin=True)
        couch_user.is_superuser = True
        couch_user.is_staff = True
        couch_user.save()

        print "user %s created and added to domain %s" % (couch_user.username,
                                                          domain)

        if not getattr(settings, 'BASE_ADDRESS', None):
            print(
                "Warning: You must set BASE_ADDRESS setting "
                "in your localsettings.py file in order for commcare-hq "
                "to be able to generate absolute urls. "
                "This is necessary for a number of features.")
예제 #4
0
    def handle(self, *args, **options):
        from corehq.apps.users.models import WebUser

        if len(args) != 3:
            raise CommandError("Usage: manage.py bootstrap <domain> <email> <password>")
        domain_name, username, passwd = args
        domain = Domain.get_or_create_with_name(domain_name, is_active=True)
        couch_user = WebUser.create(domain_name, username, passwd)
        couch_user.add_domain_membership(domain_name, is_admin=True)
        couch_user.is_superuser = True
        couch_user.is_staff = True
        couch_user.save()

        print "user %s created and added to domain %s" % (couch_user.username, domain)

        if not getattr(settings, "BASE_ADDRESS", None):
            print (
                "Warning: You must set BASE_ADDRESS setting "
                "in your localsettings.py file in order for commcare-hq "
                "to be able to generate absolute urls. "
                "This is necessary for a number of features."
            )
예제 #5
0
    def handle(self, *args, **options):
        from corehq.apps.users.models import WebUser
        from corehq.apps.domain.shortcuts import create_domain
        if len(args) != 3:
            raise CommandError('Usage: manage.py bootstrap <domain> <email> <password>')
        domain_name, username, passwd = args
        domain = Domain.get_or_create_with_name(domain_name, is_active=True)
        couch_user = WebUser.create(domain_name, username, passwd)
        couch_user.add_domain_membership(domain_name, is_admin=True)
        couch_user.is_superuser = True
        couch_user.is_staff = True
        couch_user.save()
        
        print "user %s created and added to domain %s" % (couch_user.username, domain)

        try:
            site = Site.objects.get(pk=1)
        except ObjectDoesNotExist:
            site = Site()
            site.save()
        site.name = 'localhost:8000'
        site.domain = 'localhost:8000'
        site.save()