Project

General

Profile

Development #6398

les répertoires des tenants doivent avoir le même nom que le domaine

Added by Serghei Mihai almost 9 years ago. Updated almost 9 years ago.

Status:
Fermé
Priority:
Normal
Assignee:
Start date:
02 February 2015
Due date:
% Done:

0%

Estimated time:
Patch proposed:
Yes
Planning:

Description

Afin de faciliter la configuratin des statics des tenants au niveau du serveur web(nginx) ça serait bien de nommer le répertoire du tenant d'après son domaine


Files

Associated revisions

Revision bb762ce4 (diff)
Added by Thomas Noël almost 9 years ago

tenants in TENANT_BASE/hostname (#6398)

Revision ad0757e7 (diff)
Added by Thomas Noël almost 9 years ago

remove useless get_tenant_by_domain command (#6398)

History

#1

Updated by Serghei Mihai almost 9 years ago

A premiere vue un patch du genre devrait suffire:

diff --git a/entrouvert/djommon/multitenant/management/commands/create_tenant.py b/entrouvert/djommon/multitenant/management/commands/create_tenant.py
index 5f67f51..500a13d 100644
--- a/entrouvert/djommon/multitenant/management/commands/create_tenant.py
+++ b/entrouvert/djommon/multitenant/management/commands/create_tenant.py
@@ -15,7 +15,6 @@ class Command(BaseCommand):

         for arg in args:
             hostname = arg
-            tenant_name = TenantMiddleware.hostname2schema(hostname)
             try:
                 tenant_base = TenantMiddleware.base()
             except AttributeError:
@@ -23,7 +22,7 @@ class Command(BaseCommand):
             if not tenant_base:
                 raise CommandError("you must set a value to TENANT_BASE in your settings")
             tenant_dir = os.path.join(tenant_base,
-                    tenant_name)
+                    hostname)
             if not os.path.exists(tenant_dir):
                 os.mkdir(tenant_dir, 0755)
             for folder in ('media', 'static', 'templates'):
diff --git a/entrouvert/djommon/multitenant/middleware.py b/entrouvert/djommon/multitenant/middleware.py
index 2800e35..bf9a9d4 100644
--- a/entrouvert/djommon/multitenant/middleware.py
+++ b/entrouvert/djommon/multitenant/middleware.py
@@ -118,7 +118,7 @@ class FileBasedTenantSettingBaseMiddleware(TenantSettingBaseMiddleware):
     FILENAME = None

     def load_tenant_settings(self, wrapped, tenant, tenant_settings, last_time):
-        path = os.path.join(settings.TENANT_BASE, tenant.schema_name, self.FILENAME)
+        path = os.path.join(settings.TENANT_BASE, tenant.domain_url, self.FILENAME)
         try:
             new_time = os.stat(path).st_mtime
         except OSError:

#3

Updated by Thomas Noël almost 9 years ago

  • Patch proposed changed from No to Yes
#4

Updated by Thomas Noël almost 9 years ago

  • Status changed from Nouveau to Information nécessaire
  • Assignee changed from Serghei Mihai to Thomas Noël
#5

Updated by Thomas Noël almost 9 years ago

  • Status changed from Information nécessaire to En cours
#6

Updated by Thomas Noël almost 9 years ago

  • Status changed from En cours to Solution déployée
#7

Updated by Thomas Noël almost 9 years ago

  • Status changed from Solution déployée to Fermé

Also available in: Atom PDF