{"id":1525,"date":"2013-02-23T15:48:26","date_gmt":"2013-02-23T20:48:26","guid":{"rendered":"http:\/\/cd34.com\/blog\/?p=1525"},"modified":"2013-02-23T15:48:26","modified_gmt":"2013-02-23T20:48:26","slug":"uwsgi-version-1-2-3-debian-and-pyramid","status":"publish","type":"post","link":"https:\/\/cd34.com\/blog\/framework\/uwsgi-version-1-2-3-debian-and-pyramid\/","title":{"rendered":"uwsgi version 1.2.3, Debian, and Pyramid"},"content":{"rendered":"<p>First, we need to install uwsgi:<\/p>\n<pre>\r\napt-get update\r\napt-get install uwsgi uwsgi-plugin-python\r\n<\/pre>\n<p>Then we need to create a .ini file that goes into \/etc\/uwsgi\/apps-available:<\/p>\n<pre>\r\n[uwsgi]\r\nuid = username\r\ngid = username\r\nworkers = 4\r\nbuffer-size = 25000\r\nchmod-socket = 666\r\nsingle-interpreter = true\r\nmaster = true\r\nsocket = \/tmp\/project.sock\r\nplugin = python\r\npythonpath = \/var\/www\/virtualenv\/bin\r\npaste = config:\/var\/www\/virtualenv\/project\/production.ini\r\nhome = \/var\/www\/virtualenv\r\n<\/pre>\n<p>Then create the symlink:<\/p>\n<pre>\r\nln -s \/etc\/uwsgi\/apps-available\/project.ini \/etc\/uwsgi\/apps-enabled\/project.ini\r\n<\/pre>\n<p>Then restart uwsgi:<\/p>\n<pre>\r\n\/etc\/init.d\/uwsgi restart\r\n<\/pre>\n<p>If it doesn&#8217;t work, a few things might need to be checked. First, you need to make sure your virtualenv is using Python 2.7.<\/p>\n<p>If you still need to debug, you can do<\/p>\n<pre>\r\nuwsgi --ini \/etc\/uwsgi\/apps-enabled\/project.ini\r\n<\/pre>\n<p>which will give you some output at which point you should be able to determine the issue.<\/p>\n<p>For Nginx, the config on your site should contain something like the following:<\/p>\n<pre>\r\n    location \/ {\r\n        uwsgi_pass  unix:\/tmp\/project.sock;\r\n        include     uwsgi_params;\r\n    }\r\n<\/pre>\n<p>and \/etc\/nginx\/uwsgi_params should contain<\/p>\n<pre>\r\nuwsgi_param  QUERY_STRING       $query_string;\r\nuwsgi_param  REQUEST_METHOD     $request_method;\r\nuwsgi_param  CONTENT_TYPE       $content_type;\r\nuwsgi_param  CONTENT_LENGTH     $content_length;\r\n\r\nuwsgi_param  REQUEST_URI        $request_uri;\r\nuwsgi_param  PATH_INFO\t\t$document_uri;\r\nuwsgi_param  DOCUMENT_ROOT      $document_root;\r\nuwsgi_param  SERVER_PROTOCOL    $server_protocol;\r\n\r\nuwsgi_param  REMOTE_ADDR        $remote_addr;\r\nuwsgi_param  REMOTE_PORT        $remote_port;\r\nuwsgi_param  SERVER_PORT        $server_port;\r\nuwsgi_param  SERVER_NAME        $server_name;\r\n\r\nuwsgi_param  SCRIPT_NAME\t'';\r\n<\/pre>\n<div style=\"float:left;\">\n<div id=\"fb-root\"><\/div>\n<fb:like href=\"https:\/\/cd34.com\/blog\/framework\/uwsgi-version-1-2-3-debian-and-pyramid\/\" width=\"250\" send=\"false\" show_faces=\"false\" layout=\"button_count\" action=\"recommend\"><\/fb:like>\n<\/div><div style=\"clear:both;\"><\/div>","protected":false},"excerpt":{"rendered":"<p>First, we need to install uwsgi: apt-get update apt-get install uwsgi uwsgi-plugin-python Then we need to create a .ini file that goes into \/etc\/uwsgi\/apps-available: [uwsgi] uid = username gid = username workers = 4 buffer-size = 25000 chmod-socket = 666 single-interpreter = true master = true socket = \/tmp\/project.sock plugin = python pythonpath = \/var\/www\/virtualenv\/bin [&hellip;]<\/p>\n<div style=\"float:left;\">\n<div id=\"fb-root\"><\/div>\n<fb:like href=\"https:\/\/cd34.com\/blog\/framework\/uwsgi-version-1-2-3-debian-and-pyramid\/\" width=\"250\" send=\"false\" show_faces=\"false\" layout=\"button_count\" action=\"recommend\"><\/fb:like>\n<\/div><div style=\"clear:both;\"><\/div>","protected":false},"author":15,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[22,148,117],"class_list":["post-1525","post","type-post","status-publish","format-standard","hentry","category-framework","tag-nginx","tag-pyramid","tag-uwsgi"],"_links":{"self":[{"href":"https:\/\/cd34.com\/blog\/wp-json\/wp\/v2\/posts\/1525","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cd34.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cd34.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cd34.com\/blog\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/cd34.com\/blog\/wp-json\/wp\/v2\/comments?post=1525"}],"version-history":[{"count":1,"href":"https:\/\/cd34.com\/blog\/wp-json\/wp\/v2\/posts\/1525\/revisions"}],"predecessor-version":[{"id":1526,"href":"https:\/\/cd34.com\/blog\/wp-json\/wp\/v2\/posts\/1525\/revisions\/1526"}],"wp:attachment":[{"href":"https:\/\/cd34.com\/blog\/wp-json\/wp\/v2\/media?parent=1525"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cd34.com\/blog\/wp-json\/wp\/v2\/categories?post=1525"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cd34.com\/blog\/wp-json\/wp\/v2\/tags?post=1525"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}