Commits

theoden committed e323acb

UwsgiDjango14LayoutDeployTest is green.
All uWSGI tests are included in "deploy" test-set.

From now on at this branch Squeeze "all" tests are and should stay green.

Comments (0)

Files changed (5)

fab_deploy_tests/runtests.py

                     MysqlNonRootTest, PostgresSetupTest,
                 ])),
         'deploy': TestSuite(load([
-                    DeployTest, CustomLayoutDeployTest, Django14LayoutDeployTest
+                    DeployTest, CustomLayoutDeployTest, Django14LayoutDeployTest,
+                    UwsgiDeployTest, UwsgiCustomLayoutDeployTest, UwsgiDjango14LayoutDeployTest
                 ])),
         'prepare': TestSuite(load(initial + [PrepareServerTest, UwsgiPrepareTest])),
     }

fab_deploy_tests/test_project3/fabfile.py

+# coding: utf-8
 from fab_deploy.utils import define_host
 from fab_deploy.webserver.apache import Apache
 from fab_deploy.webserver.nginx import Nginx
+from fab_deploy.webserver.uwsgi import Uwsgi
 from fab_deploy.django import Django
 from fab_deploy.project import WebProject
 
 )
 project = WebProject(apps=apps).expose_as_module('project')
 
+uwsgi_apps = dict(
+    django=Django(
+        Nginx(config='nginx_uwsgi.config'), 
+        Uwsgi(config='uwsgi.ini', wsgi='django_wsgi.py'),
+        local_config='test_project3/config.py',
+        remote_config='test_project3/config.server.py'
+    )
+)
+project_u = WebProject(apps=uwsgi_apps).expose_as_module('project_u')
+
 @define_host('baz@127.0.0.1:2222', COMMON)
 def postgres_site():
     return dict(

fab_deploy_tests/test_project3/test_project3/config_templates/nginx_uwsgi.config

+server {
+    listen 80;
+    server_name {{ SERVER_NAME }} www.{{ SERVER_NAME }};
+    access_log /var/log/nginx/{{ SERVER_NAME }}.access.log;
+    charset utf-8;
+    client_max_body_size 8m;
+
+    gzip_types text/plain text/xml text/css application/javascript application/x-javascript application/json;
+
+    location / {
+      include uwsgi_params;
+      uwsgi_param UWSGI_FASTROUTER_KEY $host;
+      uwsgi_pass 127.0.0.1:1336;
+   } 
+
+    # change /static to your static folder name
+    location /static {
+        root {{ PROJECT_DIR }};
+        autoindex off;
+        expires 1M;
+    }
+
+    # admin media serving
+    # (this location is available if django is installed from svn)
+    location /media {
+        root {{ ENV_DIR }}/src/django/django/contrib/admin;
+        expires 10m;
+        autoindex off;
+    }
+
+    # alternative django admin media path
+#    location /static/admin {
+#        root {{ PROJECT_DIR }};
+#        autoindex off;
+#        expires 10m;
+#    }
+
+    #error_page  404  /404.html;
+
+    # redirect server error pages to the static page /50x.html
+    error_page   500 502 503 504  /50x.html;
+    location = /50x.html {
+        root   /var/www/nginx-default;
+    }
+}

fab_deploy_tests/test_project3/test_project3/config_templates/uwsgi.ini

+# django < 1.4 options
+[uwsgi]
+uid = {{ USER }}
+logto = {{ HOME_DIR }}/%n.log
+virtualenv = {{ ENV_DIR }}
+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 }}
+unsubscribe-on-graceful-reload

fab_deploy_tests/tests/deploy.py

 from ..utils import setup_ssh, setup_sudo
 from ..test_project.fabfile import foo_site, bar_site, invalid_site, project, project_u
 from ..test_project2.fabfile import foo_site as foo_site2, project as project2, project_u as project_u2
-from ..test_project3.fabfile import postgis_site, postgres_site, project as project3
+from ..test_project3.fabfile import postgis_site, postgres_site, project as project3, project_u as project_u3
 
 @contextlib.contextmanager
 def answer_yes():
 
         url = 'http://baz.example.com/geo/distance/'
         self.assertResponse(url, '3417')
+
+
+class UwsgiDjango14LayoutDeployTest(Django14LayoutDeployTest):
+    snapshot = 'fabtest-prepared-uwsgi'
+    project = project_u3