{"id":72,"date":"2020-08-19T14:16:54","date_gmt":"2020-08-19T14:16:54","guid":{"rendered":"https:\/\/idez.biz\/?p=72"},"modified":"2020-08-19T14:16:55","modified_gmt":"2020-08-19T14:16:55","slug":"dealing-in-pitfalls-in-setting-up-wsgi-for-django","status":"publish","type":"post","link":"https:\/\/idez.biz\/index.php\/dealing-in-pitfalls-in-setting-up-wsgi-for-django\/","title":{"rendered":"Dealing in pitfalls in setting up WSGI for Django"},"content":{"rendered":"\n<p>After the Django installation and running smoothly on standalone mode, one of the steps to move it into production is to <a href=\"https:\/\/docs.djangoproject.com\/en\/3.1\/howto\/deployment\/wsgi\/modwsgi\/\">deploy Django with mod_wsgi on Apache<\/a>. <\/p>\n\n\n\n<p>As I have described in the previous <a href=\"https:\/\/idez.biz\/how-to-install-mysqldb-module-on-django\/\" data-type=\"post\" data-id=\"1\">article <\/a>of setting up mysqlclient module for use by Django, there were some issues in moving deploying Django with mod_wsgi on Apache. I faced the same issue that the mysqlclient module was not found. My original WSGIDaemonProcess setting is as below:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>WSGIDaemonProcess example python-path=\/opt\/python\/example:\/opt\/rh\/rh-python36\/root\/usr\/lib\/python3.6\/site-packages\r\n<\/code><\/pre>\n\n\n\n<p>Upon further investigation, I found that the mysqlclient packages were installed in lib64 path of the python installation. So i proceeded to add the path &#8220;\/opt\/rh\/rh-python36\/root\/usr\/lib64\/python3.6\/site-packages to the python-path variable as below:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>WSGIDaemonProcess example python-path=\/opt\/python\/example:\/opt\/rh\/rh-python36\/root\/usr\/lib\/python3.6\/site-packages\r:\/opt\/rh\/rh-python36\/root\/usr\/lib64\/python3.6\/site-packages\r<\/code><\/pre>\n\n\n\n<p>It works for me, and while I was writing this article, I reviewed the documentation and noticed the &#8220;python-home&#8221; parameter and another fix is possible:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>WSGIDaemonProcess example python-path=\/opt\/python\/example python-home=\/opt\/rh\/rh-python36\/root<\/code><\/pre>\n\n\n\n<p>I think this is a neater fix, and should have read the documentation more thoroughly. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>After the Django installation and running smoothly on standalone mode, one of the steps to move it into production is to deploy Django with mod_wsgi on Apache. As I have described in the previous article of setting up mysqlclient module for use by Django, there were some issues in moving deploying Django with mod_wsgi on &#8230; <a title=\"Dealing in pitfalls in setting up WSGI for Django\" class=\"read-more\" href=\"https:\/\/idez.biz\/index.php\/dealing-in-pitfalls-in-setting-up-wsgi-for-django\/\" aria-label=\"Read more about Dealing in pitfalls in setting up WSGI for Django\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[6,5,7,11],"tags":[9,8,12],"class_list":["post-72","post","type-post","status-publish","format-standard","hentry","category-django","category-mysql","category-setup","category-wsgi","tag-django","tag-mysqldb","tag-wsgi"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":false,"jetpack-related-posts":[],"jetpack_shortlink":"https:\/\/wp.me\/pcj45d-1a","_links":{"self":[{"href":"https:\/\/idez.biz\/index.php\/wp-json\/wp\/v2\/posts\/72","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idez.biz\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idez.biz\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idez.biz\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idez.biz\/index.php\/wp-json\/wp\/v2\/comments?post=72"}],"version-history":[{"count":1,"href":"https:\/\/idez.biz\/index.php\/wp-json\/wp\/v2\/posts\/72\/revisions"}],"predecessor-version":[{"id":73,"href":"https:\/\/idez.biz\/index.php\/wp-json\/wp\/v2\/posts\/72\/revisions\/73"}],"wp:attachment":[{"href":"https:\/\/idez.biz\/index.php\/wp-json\/wp\/v2\/media?parent=72"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idez.biz\/index.php\/wp-json\/wp\/v2\/categories?post=72"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idez.biz\/index.php\/wp-json\/wp\/v2\/tags?post=72"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}