{"id":7030,"date":"2022-04-27T05:02:38","date_gmt":"2022-04-27T05:02:38","guid":{"rendered":"https:\/\/truehost.com\/support\/?post_type=ht_kb&#038;p=7030"},"modified":"2024-06-07T13:03:01","modified_gmt":"2024-06-07T13:03:01","password":"","slug":"how-to-deploy-django-web-application-on-shared-hosting-cpanel","status":"publish","type":"docs","link":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-deploy-django-web-application-on-shared-hosting-cpanel\/","title":{"rendered":"How to deploy Django web application on shared hosting (Cpanel)"},"content":{"rendered":"\n<p>Requirements:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Compressed website files (tested and working on localhost). Zip format<br>recommended.<\/li><li>requirements.txt (a list of the Django packages for your application)<\/li><\/ol>\n\n\n\n<p><strong>Procedure:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Login to your Cpanel; Under Software, select \u2018Setup python App\u2019<\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"727\" height=\"250\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2022\/04\/django-python-1-1.png\" alt=\"\" class=\"wp-image-7033\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2022\/04\/django-python-1-1.png 727w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2022\/04\/django-python-1-1-300x103.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2022\/04\/django-python-1-1-50x17.png 50w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2022\/04\/django-python-1-1-600x206.png 600w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2022\/04\/django-python-1-1-320x110.png 320w\" sizes=\"auto, (max-width: 727px) 100vw, 727px\" \/><\/figure>\n\n\n\n<p>2. Click on \u2018Create Application\u2019<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"734\" height=\"139\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2022\/04\/image-3.png\" alt=\"\" class=\"wp-image-7040\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2022\/04\/image-3.png 734w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2022\/04\/image-3-300x57.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2022\/04\/image-3-50x9.png 50w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2022\/04\/image-3-600x114.png 600w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2022\/04\/image-3-320x61.png 320w\" sizes=\"auto, (max-width: 734px) 100vw, 734px\" \/><\/figure>\n\n\n\n<p>3. In the create Application Page :<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li><strong>Python Version<\/strong>:  Select the python version (Depending with the version you used to develop your web application. It is advisable you use the latest version)<\/li><li><strong>Application root<\/strong>: Set the root application folder for your application. It is advisable to use the domain name.<\/li><li><strong>Application Url<\/strong>: select the domain on which you wish to install the Django application on.<\/li><li>Leave the other fields blank; they will be pre-filled once the application has been created; then click on \u2018CREATE\u2019<\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"664\" height=\"300\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2022\/04\/image.png\" alt=\"\" class=\"wp-image-7036\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2022\/04\/image.png 664w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2022\/04\/image-300x136.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2022\/04\/image-50x23.png 50w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2022\/04\/image-600x271.png 600w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2022\/04\/image-320x145.png 320w\" sizes=\"auto, (max-width: 664px) 100vw, 664px\" \/><\/figure>\n\n\n\n<p>4. Copy the highlighted text below for use in a later stage<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"715\" height=\"298\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2022\/04\/image-1.png\" alt=\"\" class=\"wp-image-7037\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2022\/04\/image-1.png 715w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2022\/04\/image-1-300x125.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2022\/04\/image-1-50x21.png 50w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2022\/04\/image-1-600x250.png 600w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2022\/04\/image-1-320x133.png 320w\" sizes=\"auto, (max-width: 715px) 100vw, 715px\" \/><\/figure>\n\n\n\n<p>5.  Navigate to the root folder of your project and upload the compressed project<br>folder; extract the files.<\/p>\n\n\n\n<p>6. On your root directory; select and edit passenger_wsgi.py ; delete the content and<br>add the following line;<\/p>\n\n\n\n<p><em>from testproject.wsgi import application<\/em><br>where testproject is the folder containing the wsgi file, usually the parent folder created by django-admin startproject testproject<\/p>\n\n\n\n<p>7. On your cpanel homepage, select terminal under Advanced group<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"659\" height=\"136\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2022\/04\/image-2.png\" alt=\"\" class=\"wp-image-7038\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2022\/04\/image-2.png 659w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2022\/04\/image-2-300x62.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2022\/04\/image-2-50x10.png 50w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2022\/04\/image-2-600x124.png 600w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2022\/04\/image-2-320x66.png 320w\" sizes=\"auto, (max-width: 659px) 100vw, 659px\" \/><\/figure>\n\n\n\n<p>8. Paste the text copied in step 4. -If you did not copy, go back to setup python app<br>script and click edit application and copy the link. This launches the virtual<br>environment created for our Django project; ready to execute commands and run<br>the following lines of code;<\/p>\n\n\n\n<p>I. <em>pip install -r requirements.txt<\/em> \u2192 to install all the modules for our project<br>II. <em>python manage.py makemigrations<\/em> \u2192 To create project tables<br>III. <em>python manage.py migrate<\/em> \u2192 to map project tables to our database<br>IV. <em>python manage.py createsuperuser <\/em>\u2192 To create an super user \/administrator<br>account <\/p>\n\n\n\n<p>V. <em>python manage.py collectstatic<\/em> \u2192 To map django static files in the respective<br>folders ; -This is defined during development<\/p>\n\n\n\n<p>9. Navigate back to the root folder for your project; and locate the parent folder ,<br>testproject in this case, select and edit the settings.py and edit the following line;<\/p>\n\n\n\n<p>I. ALLOWED_HOSTS = [&#8216;enter your domain name here eg mydomain.com&#8217;]<br>II. DEBUG = False \u2192 Let this remain True for debugging but do not forget to<br>turn it off when done ;<\/p>\n\n\n\n<p>In this stage, our site should be up . When DEBUG= True, we will be able to tell in case<br>there is an issue .<\/p>\n\n\n\n<p>Lastly, you will realize that if you try to access the admin page youdomain.com\/admin;<br>the static files may be missing.<\/p>\n\n\n\n<p>To fix this click on F12 on your computer; here you will see where your site is trying to retrieve<br>the static files; This depends on the location you had set in your settings.py . Copy<br>the django default static files to the respective folder for the static files to load correctly.<br>Lastly in the settings.py , remember to set DEBUG to False DEBUG = False<\/p>\n\n\n\n<p><strong><span style=\"text-decoration: underline;\">Quick Troubleshooting<\/span><\/strong><\/p>\n\n\n\n<p>If your site still throws errors; ( server error 500) launch the terminal (step 7 and step 8) and enter the<br>following command:<\/p>\n\n\n\n<p><em>python manage.py runserver<\/em><\/p>\n\n\n\n<p>In case of server error 503, recreate the python application using a lower\/higher python version.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Requirements: Compressed website files (tested and working on localhost). Zip formatrecommended. requirements.txt (a list of the Django packages for your application) Procedure: Login to your Cpanel; Under Software, select \u2018Setup python App\u2019 2. Click on \u2018Create Application\u2019 3. In the create Application Page : Python Version: Select the python version (Depending with the version you [&hellip;]<\/p>\n","protected":false},"author":14,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"_eb_attr":"","_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"doc_category":[],"doc_tag":[],"class_list":["post-7030","docs","type-docs","status-publish","hentry"],"year_month":"2026-06","word_count":503,"total_views":"0","reactions":{"happy":"2","normal":"0","sad":"0"},"author_info":{"name":"Daniel","author_nicename":"daniel","author_url":"https:\/\/truehost.com\/support\/author\/daniel\/"},"doc_category_info":[],"doc_tag_info":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to deploy Django web application on shared hosting (Cpanel) -<\/title>\n<meta name=\"description\" content=\"Django application can now work on shared hosting. Using the guide provided herein, you will get an insight of how to deploy django on a shared hosting in 10 minutes.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/truehost.com\/support\/knowledge-base\/how-to-deploy-django-web-application-on-shared-hosting-cpanel\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to deploy Django web application on shared hosting (Cpanel) -\" \/>\n<meta property=\"og:description\" content=\"Django application can now work on shared hosting. Using the guide provided herein, you will get an insight of how to deploy django on a shared hosting in 10 minutes.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/truehost.com\/support\/knowledge-base\/how-to-deploy-django-web-application-on-shared-hosting-cpanel\/\" \/>\n<meta property=\"article:modified_time\" content=\"2024-06-07T13:03:01+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2022\/04\/django-python-1-1.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-deploy-django-web-application-on-shared-hosting-cpanel\\\/\",\"url\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-deploy-django-web-application-on-shared-hosting-cpanel\\\/\",\"name\":\"How to deploy Django web application on shared hosting (Cpanel) -\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.truehost.com\\\/support\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-deploy-django-web-application-on-shared-hosting-cpanel\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-deploy-django-web-application-on-shared-hosting-cpanel\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/truehost.com\\\/support\\\/wp-content\\\/uploads\\\/2022\\\/04\\\/django-python-1-1.png\",\"datePublished\":\"2022-04-27T05:02:38+00:00\",\"dateModified\":\"2024-06-07T13:03:01+00:00\",\"description\":\"Django application can now work on shared hosting. Using the guide provided herein, you will get an insight of how to deploy django on a shared hosting in 10 minutes.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-deploy-django-web-application-on-shared-hosting-cpanel\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-deploy-django-web-application-on-shared-hosting-cpanel\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-deploy-django-web-application-on-shared-hosting-cpanel\\\/#primaryimage\",\"url\":\"https:\\\/\\\/truehost.com\\\/support\\\/wp-content\\\/uploads\\\/2022\\\/04\\\/django-python-1-1.png\",\"contentUrl\":\"https:\\\/\\\/truehost.com\\\/support\\\/wp-content\\\/uploads\\\/2022\\\/04\\\/django-python-1-1.png\",\"width\":727,\"height\":250},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-deploy-django-web-application-on-shared-hosting-cpanel\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.truehost.com\\\/support\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to deploy Django web application on shared hosting (Cpanel)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.truehost.com\\\/support\\\/#website\",\"url\":\"https:\\\/\\\/www.truehost.com\\\/support\\\/\",\"name\":\"\",\"description\":\"Help In a Click\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.truehost.com\\\/support\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.truehost.com\\\/support\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.truehost.com\\\/support\\\/#organization\",\"name\":\"Truehost Kenya\",\"url\":\"https:\\\/\\\/www.truehost.com\\\/support\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.truehost.com\\\/support\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/truehost.com\\\/support\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/cropped-image_2026-04-16_174808866.png\",\"contentUrl\":\"https:\\\/\\\/truehost.com\\\/support\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/cropped-image_2026-04-16_174808866.png\",\"width\":240,\"height\":48,\"caption\":\"Truehost Kenya\"},\"image\":{\"@id\":\"https:\\\/\\\/www.truehost.com\\\/support\\\/#\\\/schema\\\/logo\\\/image\\\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to deploy Django web application on shared hosting (Cpanel) -","description":"Django application can now work on shared hosting. Using the guide provided herein, you will get an insight of how to deploy django on a shared hosting in 10 minutes.","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:\/\/truehost.com\/support\/knowledge-base\/how-to-deploy-django-web-application-on-shared-hosting-cpanel\/","og_locale":"en_US","og_type":"article","og_title":"How to deploy Django web application on shared hosting (Cpanel) -","og_description":"Django application can now work on shared hosting. Using the guide provided herein, you will get an insight of how to deploy django on a shared hosting in 10 minutes.","og_url":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-deploy-django-web-application-on-shared-hosting-cpanel\/","article_modified_time":"2024-06-07T13:03:01+00:00","og_image":[{"url":"https:\/\/truehost.com\/support\/wp-content\/uploads\/2022\/04\/django-python-1-1.png","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-deploy-django-web-application-on-shared-hosting-cpanel\/","url":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-deploy-django-web-application-on-shared-hosting-cpanel\/","name":"How to deploy Django web application on shared hosting (Cpanel) -","isPartOf":{"@id":"https:\/\/www.truehost.com\/support\/#website"},"primaryImageOfPage":{"@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-deploy-django-web-application-on-shared-hosting-cpanel\/#primaryimage"},"image":{"@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-deploy-django-web-application-on-shared-hosting-cpanel\/#primaryimage"},"thumbnailUrl":"https:\/\/truehost.com\/support\/wp-content\/uploads\/2022\/04\/django-python-1-1.png","datePublished":"2022-04-27T05:02:38+00:00","dateModified":"2024-06-07T13:03:01+00:00","description":"Django application can now work on shared hosting. Using the guide provided herein, you will get an insight of how to deploy django on a shared hosting in 10 minutes.","breadcrumb":{"@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-deploy-django-web-application-on-shared-hosting-cpanel\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/truehost.com\/support\/knowledge-base\/how-to-deploy-django-web-application-on-shared-hosting-cpanel\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-deploy-django-web-application-on-shared-hosting-cpanel\/#primaryimage","url":"https:\/\/truehost.com\/support\/wp-content\/uploads\/2022\/04\/django-python-1-1.png","contentUrl":"https:\/\/truehost.com\/support\/wp-content\/uploads\/2022\/04\/django-python-1-1.png","width":727,"height":250},{"@type":"BreadcrumbList","@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-deploy-django-web-application-on-shared-hosting-cpanel\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.truehost.com\/support\/"},{"@type":"ListItem","position":2,"name":"How to deploy Django web application on shared hosting (Cpanel)"}]},{"@type":"WebSite","@id":"https:\/\/www.truehost.com\/support\/#website","url":"https:\/\/www.truehost.com\/support\/","name":"","description":"Help In a Click","publisher":{"@id":"https:\/\/www.truehost.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.truehost.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.truehost.com\/support\/#organization","name":"Truehost Kenya","url":"https:\/\/www.truehost.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.truehost.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/truehost.com\/support\/wp-content\/uploads\/2026\/04\/cropped-image_2026-04-16_174808866.png","contentUrl":"https:\/\/truehost.com\/support\/wp-content\/uploads\/2026\/04\/cropped-image_2026-04-16_174808866.png","width":240,"height":48,"caption":"Truehost Kenya"},"image":{"@id":"https:\/\/www.truehost.com\/support\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs\/7030","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/users\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/comments?post=7030"}],"version-history":[{"count":5,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs\/7030\/revisions"}],"predecessor-version":[{"id":7043,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs\/7030\/revisions\/7043"}],"wp:attachment":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/media?parent=7030"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/doc_category?post=7030"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/doc_tag?post=7030"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}