Commits

theoden  committed 7a83f97

+ Apache.upload_config now provides upload_config_template with extra_context argument
+ get_wsgi_full_file_name was added to WsgiBackend class
* all apache configs were changed to use CURRENT_BACKEND template variable

  • Participants
  • Parent commits 21a8dfd
  • Branches multiple web-servers

Comments (0)

Files changed (6)

File fab_deploy/config_templates/apache.config

     WSGIDaemonProcess {{ INSTANCE_NAME }} user={{ USER }} group={{ USER }} processes={{ PROCESSES }} threads={{ THREADS }}
     WSGIProcessGroup {{ INSTANCE_NAME }}
 
-    WSGIScriptAlias / {{ ENV_DIR }}/var/wsgi/{{ INSTANCE_NAME }}.py
-    <Directory {{ ENV_DIR }}/var/wsgi/>
+    WSGIScriptAlias / {{ CURRENT_BACKEND.get_wsgi_full_file_name() }}
+    <Directory {{ CURRENT_BACKEND.get_wsgi_dir() }}>
         Order deny,allow
         allow from all
     </Directory>

File fab_deploy/webserver/apache.py

         name = self._get_server_config_name()
         utils.upload_config_template(self.config,
                                      '/etc/apache2/sites-available/%s' % name,
+                                     extra_context={'CURRENT_BACKEND': self},
                                      use_sudo=True)
         sudo('a2ensite %s' % name)
 

File fab_deploy/webserver/wsgi_backend.py

     def __init__(self, wsgi):
         self.wsgi = wsgi
 
+    def get_wsgi_dir(self):
+        return posixpath.join(
+            env.conf['ENV_DIR'], 'var', 'wsgi', env.conf['INSTANCE_NAME']
+        )
+
     def get_wsgi_file_name(self):
+        """ Returns remote filename of the wsgi file. """
         return self.wsgi
 
-    def get_wsgi_dir(self):
-        return posixpath.join(
-            env.conf['ENV_DIR'],
-            'var', 'wsgi',
-            env.conf['INSTANCE_NAME']
-        )
+    def get_wsgi_full_file_name(self):
+        """ Returns full remote filename of the wsgi file (with path). """
+        return posixpath.join(self.get_wsgi_dir(), self.get_wsgi_file_name())
 
     @task_method
     def touch(self, wsgi_file=None):
         overriden to provide same effect in other way (restart, reload, etc).
         """
         if wsgi_file is None:
-            wsgi_file = posixpath.join(
-                self.get_wsgi_dir(),
-                self.get_wsgi_file_name()
-            )
+            wsgi_file = self.get_wsgi_full_file_name()
         run('touch ' + wsgi_file)
 
     @task_method

File fab_deploy_tests/test_project/config_templates/apache.config

     WSGIDaemonProcess {{ INSTANCE_NAME }} user={{ USER }} group={{ USER }} processes={{ PROCESSES }} threads={{ THREADS }}
     WSGIProcessGroup {{ INSTANCE_NAME }}
 
-    WSGIScriptAlias / {{ ENV_DIR }}/var/wsgi/{{ INSTANCE_NAME }}/django_wsgi.py
-    <Directory {{ ENV_DIR }}/var/wsgi/{{ INSTANCE_NAME }}/>
+    WSGIScriptAlias / {{ CURRENT_BACKEND.get_wsgi_full_file_name() }}
+    <Directory {{ CURRENT_BACKEND.get_wsgi_dir() }}/>
         Order deny,allow
         allow from all
     </Directory>

File fab_deploy_tests/test_project2/hosting/apache.config

     WSGIDaemonProcess {{ INSTANCE_NAME }} user={{ USER }} group={{ USER }} processes={{ PROCESSES }} threads={{ THREADS }}
     WSGIProcessGroup {{ INSTANCE_NAME }}
 
-    WSGIScriptAlias / {{ ENV_DIR }}/var/wsgi/{{ INSTANCE_NAME }}/django_wsgi.py
-    <Directory {{ ENV_DIR }}/var/wsgi/{{ INSTANCE_NAME }}/>
+    WSGIScriptAlias / {{ CURRENT_BACKEND.get_wsgi_full_file_name() }}
+    <Directory {{ CURRENT_BACKEND.get_wsgi_dir() }}/>
         Order deny,allow
         allow from all
     </Directory>

File fab_deploy_tests/test_project3/test_project3/config_templates/apache.config

     WSGIDaemonProcess {{ INSTANCE_NAME }} user={{ USER }} group={{ USER }} processes={{ PROCESSES }} threads={{ THREADS }}
     WSGIProcessGroup {{ INSTANCE_NAME }}
 
-    WSGIScriptAlias / {{ ENV_DIR }}/var/wsgi/{{ INSTANCE_NAME }}/django_wsgi.py
-    <Directory {{ ENV_DIR }}/var/wsgi/{{ INSTANCE_NAME }}/>
+    WSGIScriptAlias / {{ CURRENT_BACKEND.get_wsgi_full_file_name() }}
+    <Directory {{ CURRENT_BACKEND.get_wsgi_dir() }}/>
         Order deny,allow
         allow from all
     </Directory>