{"id":2282,"date":"2014-09-19T20:25:17","date_gmt":"2014-09-19T16:25:17","guid":{"rendered":"https:\/\/blog.alwawee.ru\/?p=2282"},"modified":"2014-09-19T20:38:09","modified_gmt":"2014-09-19T16:38:09","slug":"running-django-project-apache-production-server","status":"publish","type":"post","link":"https:\/\/blog.alwawee.ru\/?p=2282","title":{"rendered":"Running Django project on Apache production server with mod_wsgi"},"content":{"rendered":"<p><a href=\"https:\/\/blog.alwawee.ru\/wp-content\/uploads\/2014\/09\/django.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.alwawee.ru\/wp-content\/uploads\/2014\/09\/django.jpg\" alt=\"django\" width=\"280\" height=\"150\" class=\"aligncenter size-full wp-image-2290\" \/><\/a><\/p>\n<p>This is <a href=\"https:\/\/docs.djangoproject.com\/en\/1.4\/howto\/deployment\/wsgi\/modwsgi\/\" title=\"https:\/\/docs.djangoproject.com\/en\/1.4\/howto\/deployment\/wsgi\/modwsgi\/\" target=\"_blank\">official tutorial<\/a>. But it didn&#8217;t work for me for 100 %. But there is some useful information on wsgi and daemon process that should be created. <\/p>\n<p>There is a <a href=\"https:\/\/www.digitalocean.com\/community\/tutorials\/how-to-run-django-with-mod_wsgi-and-apache-with-a-virtualenv-python-environment-on-a-debian-vps\" title=\"https:\/\/www.digitalocean.com\/community\/tutorials\/how-to-run-django-with-mod_wsgi-and-apache-with-a-virtualenv-python-environment-on-a-debian-vps\" target=\"_blank\">good tutorial<\/a>, that I followed and it actually works. But I decided to write my own post with instructions for my personal project: <\/p>\n<p>First we enter the production server via SSL and create a virtual environment there: <\/p>\n<pre>\r\nvirtualenv env\r\n<\/pre>\n<p>Then we activate it: <\/p>\n<pre>\r\nsource env\/bin\/activate\r\n<\/pre>\n<p>Check the Django version. It must be the same as in your local server: <\/p>\n<pre>\r\npython -c \"import django; print(django.get_version())\"\r\n<\/pre>\n<p>Save somewhere a path to a Django project:<\/p>\n<pre>\r\n\/root\/www\/den.ladby.ru\/public\/common-app-server\/app_server\r\n<\/pre>\n<p>Your path will be different.<\/p>\n<p>This is an example of a sites-available\/*.conf file setting to run Django with WSGI:<br \/>\n<a href=\"https:\/\/blog.alwawee.ru\/wp-content\/uploads\/2014\/09\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-2014-09-19-\u0432-20.25.49.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.alwawee.ru\/wp-content\/uploads\/2014\/09\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-2014-09-19-\u0432-20.25.49-300x186.png\" alt=\"\u0421\u043d\u0438\u043c\u043e\u043a \u044d\u043a\u0440\u0430\u043d\u0430 2014-09-19 \u0432 20.25.49\" width=\"300\" height=\"186\" class=\"aligncenter size-medium wp-image-2284\" srcset=\"https:\/\/blog.alwawee.ru\/wp-content\/uploads\/2014\/09\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-2014-09-19-\u0432-20.25.49-300x186.png 300w, https:\/\/blog.alwawee.ru\/wp-content\/uploads\/2014\/09\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-2014-09-19-\u0432-20.25.49.png 554w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Here <strong>app_server<\/strong> is the name of my Django project or you can name it a site. But in my case it is not site but server for a mobile application.<\/p>\n<p>Python and Django version on server and virtual environment may be different. You should do everything inside virtual environments with the same versions on local and production servers.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is official tutorial. But it didn&#8217;t work for me for 100 %. But there is some useful information on wsgi and daemon process that should be created. There is a good tutorial, that I followed and it actually works. But I decided to write my own post with instructions for my personal project: First [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[74],"tags":[121,110,75],"class_list":["post-2282","post","type-post","status-publish","format-standard","hentry","category-web-development","tag-django","tag-python","tag-web"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Running Django project on Apache production server with mod_wsgi - Denis Kutlubaev<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.alwawee.ru\/?p=2282\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Running Django project on Apache production server with mod_wsgi - Denis Kutlubaev\" \/>\n<meta property=\"og:description\" content=\"This is official tutorial. But it didn&#8217;t work for me for 100 %. But there is some useful information on wsgi and daemon process that should be created. There is a good tutorial, that I followed and it actually works. But I decided to write my own post with instructions for my personal project: First [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.alwawee.ru\/?p=2282\" \/>\n<meta property=\"og:site_name\" content=\"Denis Kutlubaev\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/alwaweemobile\" \/>\n<meta property=\"article:published_time\" content=\"2014-09-19T16:25:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2014-09-19T16:38:09+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/blog.alwawee.ru\/wp-content\/uploads\/2014\/09\/django.jpg\" \/>\n<meta name=\"author\" content=\"Denis Kutlubaev\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Denis Kutlubaev\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/?p=2282#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/?p=2282\"},\"author\":{\"name\":\"Denis Kutlubaev\",\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/#\\\/schema\\\/person\\\/58f1f1f57155b48afab83ba53b3e26a7\"},\"headline\":\"Running Django project on Apache production server with mod_wsgi\",\"datePublished\":\"2014-09-19T16:25:17+00:00\",\"dateModified\":\"2014-09-19T16:38:09+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/?p=2282\"},\"wordCount\":182,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/?p=2282#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/blog.alwawee.ru\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/django.jpg\",\"keywords\":[\"Django\",\"Python\",\"Web\"],\"articleSection\":[\"Web Development\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/blog.alwawee.ru\\\/?p=2282#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/?p=2282\",\"url\":\"https:\\\/\\\/blog.alwawee.ru\\\/?p=2282\",\"name\":\"Running Django project on Apache production server with mod_wsgi - Denis Kutlubaev\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/?p=2282#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/?p=2282#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/blog.alwawee.ru\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/django.jpg\",\"datePublished\":\"2014-09-19T16:25:17+00:00\",\"dateModified\":\"2014-09-19T16:38:09+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/#\\\/schema\\\/person\\\/58f1f1f57155b48afab83ba53b3e26a7\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/?p=2282#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/blog.alwawee.ru\\\/?p=2282\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/?p=2282#primaryimage\",\"url\":\"https:\\\/\\\/blog.alwawee.ru\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/django.jpg\",\"contentUrl\":\"https:\\\/\\\/blog.alwawee.ru\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/django.jpg\",\"width\":280,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/?p=2282#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/blog.alwawee.ru\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Running Django project on Apache production server with mod_wsgi\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/#website\",\"url\":\"https:\\\/\\\/blog.alwawee.ru\\\/\",\"name\":\"Denis Kutlubaev\",\"description\":\"iOS Development\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/blog.alwawee.ru\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/#\\\/schema\\\/person\\\/58f1f1f57155b48afab83ba53b3e26a7\",\"name\":\"Denis Kutlubaev\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/346de75d27c818be0aa7fddeada2e50e30cc15b4da6b3b8110c5d766cd2afa34?s=96&d=mm&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/346de75d27c818be0aa7fddeada2e50e30cc15b4da6b3b8110c5d766cd2afa34?s=96&d=mm&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/346de75d27c818be0aa7fddeada2e50e30cc15b4da6b3b8110c5d766cd2afa34?s=96&d=mm&r=pg\",\"caption\":\"Denis Kutlubaev\"},\"description\":\"iOS Developer, creator of Tornado Browser and many other popular apps\",\"sameAs\":[\"http:\\\/\\\/dennis.alwawee.com\"],\"url\":\"https:\\\/\\\/blog.alwawee.ru\\\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Running Django project on Apache production server with mod_wsgi - Denis Kutlubaev","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blog.alwawee.ru\/?p=2282","og_locale":"en_US","og_type":"article","og_title":"Running Django project on Apache production server with mod_wsgi - Denis Kutlubaev","og_description":"This is official tutorial. But it didn&#8217;t work for me for 100 %. But there is some useful information on wsgi and daemon process that should be created. There is a good tutorial, that I followed and it actually works. But I decided to write my own post with instructions for my personal project: First [&hellip;]","og_url":"https:\/\/blog.alwawee.ru\/?p=2282","og_site_name":"Denis Kutlubaev","article_publisher":"https:\/\/www.facebook.com\/alwaweemobile","article_published_time":"2014-09-19T16:25:17+00:00","article_modified_time":"2014-09-19T16:38:09+00:00","og_image":[{"url":"https:\/\/blog.alwawee.ru\/wp-content\/uploads\/2014\/09\/django.jpg","type":"","width":"","height":""}],"author":"Denis Kutlubaev","twitter_misc":{"Written by":"Denis Kutlubaev","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blog.alwawee.ru\/?p=2282#article","isPartOf":{"@id":"https:\/\/blog.alwawee.ru\/?p=2282"},"author":{"name":"Denis Kutlubaev","@id":"https:\/\/blog.alwawee.ru\/#\/schema\/person\/58f1f1f57155b48afab83ba53b3e26a7"},"headline":"Running Django project on Apache production server with mod_wsgi","datePublished":"2014-09-19T16:25:17+00:00","dateModified":"2014-09-19T16:38:09+00:00","mainEntityOfPage":{"@id":"https:\/\/blog.alwawee.ru\/?p=2282"},"wordCount":182,"commentCount":0,"image":{"@id":"https:\/\/blog.alwawee.ru\/?p=2282#primaryimage"},"thumbnailUrl":"https:\/\/blog.alwawee.ru\/wp-content\/uploads\/2014\/09\/django.jpg","keywords":["Django","Python","Web"],"articleSection":["Web Development"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/blog.alwawee.ru\/?p=2282#respond"]}]},{"@type":"WebPage","@id":"https:\/\/blog.alwawee.ru\/?p=2282","url":"https:\/\/blog.alwawee.ru\/?p=2282","name":"Running Django project on Apache production server with mod_wsgi - Denis Kutlubaev","isPartOf":{"@id":"https:\/\/blog.alwawee.ru\/#website"},"primaryImageOfPage":{"@id":"https:\/\/blog.alwawee.ru\/?p=2282#primaryimage"},"image":{"@id":"https:\/\/blog.alwawee.ru\/?p=2282#primaryimage"},"thumbnailUrl":"https:\/\/blog.alwawee.ru\/wp-content\/uploads\/2014\/09\/django.jpg","datePublished":"2014-09-19T16:25:17+00:00","dateModified":"2014-09-19T16:38:09+00:00","author":{"@id":"https:\/\/blog.alwawee.ru\/#\/schema\/person\/58f1f1f57155b48afab83ba53b3e26a7"},"breadcrumb":{"@id":"https:\/\/blog.alwawee.ru\/?p=2282#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.alwawee.ru\/?p=2282"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blog.alwawee.ru\/?p=2282#primaryimage","url":"https:\/\/blog.alwawee.ru\/wp-content\/uploads\/2014\/09\/django.jpg","contentUrl":"https:\/\/blog.alwawee.ru\/wp-content\/uploads\/2014\/09\/django.jpg","width":280,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/blog.alwawee.ru\/?p=2282#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blog.alwawee.ru\/"},{"@type":"ListItem","position":2,"name":"Running Django project on Apache production server with mod_wsgi"}]},{"@type":"WebSite","@id":"https:\/\/blog.alwawee.ru\/#website","url":"https:\/\/blog.alwawee.ru\/","name":"Denis Kutlubaev","description":"iOS Development","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.alwawee.ru\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/blog.alwawee.ru\/#\/schema\/person\/58f1f1f57155b48afab83ba53b3e26a7","name":"Denis Kutlubaev","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/346de75d27c818be0aa7fddeada2e50e30cc15b4da6b3b8110c5d766cd2afa34?s=96&d=mm&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/346de75d27c818be0aa7fddeada2e50e30cc15b4da6b3b8110c5d766cd2afa34?s=96&d=mm&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/346de75d27c818be0aa7fddeada2e50e30cc15b4da6b3b8110c5d766cd2afa34?s=96&d=mm&r=pg","caption":"Denis Kutlubaev"},"description":"iOS Developer, creator of Tornado Browser and many other popular apps","sameAs":["http:\/\/dennis.alwawee.com"],"url":"https:\/\/blog.alwawee.ru\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/blog.alwawee.ru\/index.php?rest_route=\/wp\/v2\/posts\/2282","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.alwawee.ru\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.alwawee.ru\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.alwawee.ru\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.alwawee.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2282"}],"version-history":[{"count":0,"href":"https:\/\/blog.alwawee.ru\/index.php?rest_route=\/wp\/v2\/posts\/2282\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.alwawee.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2282"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.alwawee.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2282"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.alwawee.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2282"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}