{"id":37045,"date":"2021-05-25T15:00:08","date_gmt":"2021-05-25T12:00:08","guid":{"rendered":"https:\/\/tuthost.ua\/faq\/how-do-i-install-django-on-my-hosting\/"},"modified":"2024-07-19T21:59:10","modified_gmt":"2024-07-19T18:59:10","slug":"kak-ustanovit-django-na-hosting","status":"publish","type":"ht_kb","link":"https:\/\/tuthost.ua\/en\/faq\/kak-ustanovit-django-na-hosting\/","title":{"rendered":"How do I install Django on my hosting?"},"content":{"rendered":"<p>Django is a popular framework for developing websites and web applications. In this tutorial we will tell you how you can install it on your hosting.<\/p>\n<ol>\n<li>Go to the Setup Python App menu item<\/li>\n<li>Click the Create Application button<\/li>\n<li>Enter the name of the directory where Django will be installed, starting with the domain folder. There is no need to put a slash at the beginning and at the end of the path. We recommend that you place the application in a folder with your domain name, on the same level as the public_html folder, but not inside it.<br \/>\nDo not fill in the fields: &#8220;Application launch file&#8221; and &#8220;Application entry point&#8221;.<br \/>\nSpecify the path to the log file, note that part of the path is already prescribed. We recommend placing logs in the logs folder<a href=\"https:\/\/tuthost.ua\/wp-content\/uploads\/2021\/05\/django1-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-29145\" src=\"https:\/\/tuthost.ua\/wp-content\/uploads\/2021\/05\/django1-1.png\" alt=\"\" width=\"601\" height=\"427\" title=\"\" srcset=\"https:\/\/tuthost.ua\/wp-content\/uploads\/2021\/05\/django1-1.png 750w, https:\/\/tuthost.ua\/wp-content\/uploads\/2021\/05\/django1-1-300x213.png 300w, https:\/\/tuthost.ua\/wp-content\/uploads\/2021\/05\/django1-1-150x107.png 150w, https:\/\/tuthost.ua\/wp-content\/uploads\/2021\/05\/django1-1-125x89.png 125w, https:\/\/tuthost.ua\/wp-content\/uploads\/2021\/05\/django1-1-75x53.png 75w\" sizes=\"auto, (max-width: 601px) 100vw, 601px\" \/><\/a><\/li>\n<li>After creating the application &#8211; go to it and copy the link to enter the virtual environment<br \/>\n<a href=\"https:\/\/tuthost.ua\/wp-content\/uploads\/2021\/05\/django2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-29148\" src=\"https:\/\/tuthost.ua\/wp-content\/uploads\/2021\/05\/django2.png\" alt=\"\" width=\"754\" height=\"94\" title=\"\" srcset=\"https:\/\/tuthost.ua\/wp-content\/uploads\/2021\/05\/django2.png 754w, https:\/\/tuthost.ua\/wp-content\/uploads\/2021\/05\/django2-300x37.png 300w, https:\/\/tuthost.ua\/wp-content\/uploads\/2021\/05\/django2-150x19.png 150w, https:\/\/tuthost.ua\/wp-content\/uploads\/2021\/05\/django2-125x16.png 125w, https:\/\/tuthost.ua\/wp-content\/uploads\/2021\/05\/django2-75x9.png 75w\" sizes=\"auto, (max-width: 754px) 100vw, 754px\" \/><\/a><\/li>\n<li>Go to the Directadmin home page and go to Web SSH Client. If you do not have this option &#8211; write a request to support to activate it. SSH access is granted only to clients who have been fully verified.<\/li>\n<li>In the SSH console, enter your login and password (the same as for Directadmin).<br \/>\nEnter the command to log in to the virtual environment that you copied earlier. For example, a command might look like this:<br \/>\n<code><strong>source \/home\/username\/virtualenv\/domains\/example.com\/django\/3.8\/bin\/activate &amp;&amp; cd \/home\/username\/domains\/example.com\/django<\/strong><\/code><br \/>\nTo install Django, enter the command:<br \/>\n<code><strong>pip install django<\/strong><\/code><br \/>\nTo create a new Django project, enter the command:<br \/>\n<code><strong>django-admin startproject myapp ~\/domains\/example.com\/django<\/strong><\/code><br \/>\nWhere <strong>myapp<\/strong> is the name of your application, <strong>example.com\/django<\/strong><strong> <\/strong>&#8211; the name of the domain and folder where you created the Python application.<\/li>\n<li>Now you need to make settings in the file  <span>settings.py. For our example, it will be available in the ~\/domains\/example.com\/django\/myapp\/settings.py folder<br \/>\nIn this file, in the variable ALLOWED_HOSTS = [&#8216;example.com&#8217;, &#8216;www.example.com&#8217;] &#8211; enter your domain, which should open the site.<\/span><\/li>\n<li>Copy the contents of the <b>wsgi.py <\/b>file <b>intopassenger_wsgi <\/b><b>.py.<br \/>\n For<\/b>our example:<br \/>\n<code><strong>cp ~\/domains\/example.com\/django\/myapp\/wsgi.py ~\/domains\/example.com\/django\/passenger_wsgi.py<\/strong><\/code>\n<\/li>\n<li>And the last step is to run the command in order to perform the migration:<br \/>\n<code><strong>python ~\/domains\/example.com\/django\/manage.py migrate<\/strong><\/code><br \/>\nAfter that you can start configuring and populating your Django site<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Django is a popular framework for developing websites and web applications. In this tutorial we will tell you how you can install it on your hosting. Go to the Setup Python App menu item Click the Create Application button Enter the name of the directory where Django will be installed, starting with the domain folder&#8230;.<\/p>\n","protected":false},"author":1,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":{"inline_featured_image":false,"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","ghostkit_customizer_options":"","ghostkit_custom_css":"","ghostkit_custom_js_head":"","ghostkit_custom_js_foot":"","ghostkit_typography":"","_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"footnotes":""},"ht-kb-category":[10669],"ht-kb-tag":[],"class_list":["post-37045","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-hosting-en"],"taxonomy_info":{"ht_kb_category":[{"value":10669,"label":"Hosting"}]},"featured_image_src_large":[],"author_info":{"display_name":"Denys Semeniuk","author_link":"https:\/\/tuthost.ua\/en\/author\/semden\/"},"comment_info":0,"_links":{"self":[{"href":"https:\/\/tuthost.ua\/en\/wp-json\/wp\/v2\/ht-kb\/37045","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tuthost.ua\/en\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/tuthost.ua\/en\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/tuthost.ua\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tuthost.ua\/en\/wp-json\/wp\/v2\/comments?post=37045"}],"version-history":[{"count":2,"href":"https:\/\/tuthost.ua\/en\/wp-json\/wp\/v2\/ht-kb\/37045\/revisions"}],"predecessor-version":[{"id":52535,"href":"https:\/\/tuthost.ua\/en\/wp-json\/wp\/v2\/ht-kb\/37045\/revisions\/52535"}],"wp:attachment":[{"href":"https:\/\/tuthost.ua\/en\/wp-json\/wp\/v2\/media?parent=37045"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/tuthost.ua\/en\/wp-json\/wp\/v2\/ht-kb-category?post=37045"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/tuthost.ua\/en\/wp-json\/wp\/v2\/ht-kb-tag?post=37045"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}