Commits

theoden committed ebdb70b

UwsgiDeployTest now works.

One need to recreate "fabtest-prepared-uwsgi" snapshot since uWSGI init script
was changed at this commit.

Comments (0)

Files changed (5)

fab_deploy/config_templates/uwsgi_init

 
 set -e
 
-DAEMON_OPTS="--emperor "/etc/uwsgi/apps-enabled/*.ini" --fastrouter 127.0.0.1:1336 --fastrouter-subscription-server 127.0.0.1:1337 --pidfile $PIDFILE --master --daemonize /var/log/uwsgi.log"
+DAEMON_OPTS="--emperor /etc/uwsgi/apps-enabled --fastrouter 127.0.0.1:1336 --fastrouter-subscription-server 127.0.0.1:1337 --pidfile $PIDFILE --master --daemonize /var/log/uwsgi.log"
 
 case "$1" in
   start)

fab_deploy/webserver/wsgi_backend.py

 # coding: utf-8
 from __future__ import with_statement, absolute_import
-import posixpath
+import posixpath, os
 
 from fabric.api import env, run
 
         """ Returns remote filename of the wsgi file. """
         return self.wsgi
 
+    def get_wsgi_module_name(self):
+        """ 
+        Returns remote filename without extension.
+        This is useful at least for uWSGI that can only import wsgi-file
+        as a module.
+        """
+        return os.path.splitext(self.wsgi)[0]
+
     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())

fab_deploy_tests/test_project/config_templates/uwsgi.ini

 # django < 1.4 options
 [uwsgi]
-plugins = python27
+uid = {{ USER }}
+logto = {{ HOME_DIR }}/%n.log
 virtualenv = {{ ENV_DIR }}
-chdir = {{ PROJECT_DIR }}
-module = {{ CURRENT_BACKEND.get_wsgi_full_file_name() }}
-touch-reload = {{ CURRENT_BACKEND.get_wsgi_full_file_name() }}
+pythonpath = {{ PROJECT_DIR }}
+pythonpath = {{ CURRENT_BACKEND.get_wsgi_dir() }}
+module = {{ CURRENT_BACKEND.get_wsgi_module_name() }}
+touch-reload = {{ CURRENT_BACKEND.get_wsgi_full_file_name() }}
+master = 1
+processes = {{ PROCESSES }}
+socket = 127.0.0.1:0
+st = 127.0.0.1:1337:{{ SERVER_NAME }} 

fab_deploy_tests/test_project/fabfile.py

 
 project = WebProject().expose_as_module('project')
 project_u = WebProject({
-    'django': Django(Nginx(), Uwsgi(wsgi='django_wsgi.py'))
+    'django': Django(Nginx('nginx_uwsgi.config'), Uwsgi(wsgi='django_wsgi.py'))
 }).expose_as_module('project_u')
 
 @define_host('foo@127.0.0.1:2222')

fab_deploy_tests/tests/deploy.py

 
         # config errors should not be silenced
         with answer_yes():
-            self.assertRaises(FabricAbortException, fab, project.deploy)
+            self.assertRaises(FabricAbortException, fab, self.project.deploy)
 
         # old sites still work
         self.assertInstanceWorks('bar')
         self.assertInstanceDoesntWork('invalid')
 
 
+class UwsgiDeployTest(DeployTest):
+    snapshot = 'fabtest-prepared-uwsgi'
+    project = project_u
+
+
 class CustomLayoutDeployTest(FabDeployProjectTest):
     project_dir = 'test_project2'
     project = project2
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.