Projet

Général

Profil

« Précédent | Suivant » 

Révision bb762ce4

Ajouté par Thomas Noël il y a environ 9 ans

tenants in TENANT_BASE/hostname (#6398)

Voir les différences:

entrouvert/djommon/multitenant/management/commands/create_tenant.py
13 13
        if not args:
14 14
            raise CommandError("you must give at least one tenant hostname")
15 15

  
16
        for arg in args:
17
            hostname = arg
18
            tenant_name = TenantMiddleware.hostname2schema(hostname)
16
        for hostname in args:
19 17
            try:
20 18
                tenant_base = TenantMiddleware.base()
21 19
            except AttributeError:
22 20
                raise CommandError("you must configure TENANT_BASE in your settings")
23 21
            if not tenant_base:
24 22
                raise CommandError("you must set a value to TENANT_BASE in your settings")
25
            tenant_dir = os.path.join(tenant_base,
26
                    tenant_name)
23
            tenant_dir = os.path.join(tenant_base, hostname)
27 24
            if not os.path.exists(tenant_dir):
28 25
                os.mkdir(tenant_dir, 0755)
29 26
            for folder in ('media', 'static', 'templates'):
......
38 35
                    + self.style.SQL_TABLE(tenant.schema_name)
39 36
            if not tenant.create_schema(check_if_exists=True):
40 37
                print self.style.ERROR(' Nothing to do: %r already exist' % hostname)
41

  

Formats disponibles : Unified diff