<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Lưu trữ python - Hướng dẫn TENTEN</title>
	<atom:link href="https://help.tenten.vn/tag/python/feed/" rel="self" type="application/rss+xml" />
	<link>https://help.tenten.vn/tag/python/</link>
	<description>Tài liệu hỗ trợ khách hàng</description>
	<lastBuildDate>Thu, 31 Aug 2023 08:47:50 +0000</lastBuildDate>
	<language>vi</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://help.tenten.vn/wp-content/uploads/2023/09/favicontenten.png</url>
	<title>Lưu trữ python - Hướng dẫn TENTEN</title>
	<link>https://help.tenten.vn/tag/python/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Hướng Dẫn Cài Đặt Django Trên Giao Diện cPanel</title>
		<link>https://help.tenten.vn/huong-dan-cai-dat-django-tren-giao-dien-cpanel/</link>
		
		<dc:creator><![CDATA[Hoàng Việt]]></dc:creator>
		<pubDate>Thu, 31 Aug 2023 08:47:50 +0000</pubDate>
				<category><![CDATA[Gen Hosting]]></category>
		<category><![CDATA[cPanel]]></category>
		<category><![CDATA[python]]></category>
		<guid isPermaLink="false">https://help.tenten.vn/?p=12393</guid>

					<description><![CDATA[<p>Cài Đặt Django Trên Giao Diện cPanel Các bước thực hiện như sau: Bước 1: Cài đặt ssh trên gói hosting Bước 2: Chọn utility “Setup Python App” Bước 3: Chọn “Create Application”   Bước 4: Điền các thông số cần thiết cho python app và chọn “Create” + Python version: Phiên bản python sẽ chạy app này. &#8230;</p>
<p>Bài viết <a href="https://help.tenten.vn/huong-dan-cai-dat-django-tren-giao-dien-cpanel/">Hướng Dẫn Cài Đặt Django Trên Giao Diện cPanel</a> đã xuất hiện đầu tiên vào ngày <a href="https://help.tenten.vn">Hướng dẫn TENTEN</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h1 id="ftoc-heading-1" class="ftwp-heading"><strong>Cài Đặt Django Trên Giao Diện cPanel</strong></h1>
<p>Các bước thực hiện như sau:</p>
<h4><strong>Bước 1:</strong> Cài đặt ssh trên gói hosting</h4>
<h4><strong>Bước 2:</strong> Chọn utility “Setup Python App”</h4>
<h4><strong>Bước 3: </strong>Chọn “Create Application”</h4>
<p><img loading="lazy" decoding="async" class="size-full wp-image-12397 aligncenter" src="https://help.tenten.vn/wp-content/uploads/2023/08/Capture1.png" alt="" width="717" height="501" srcset="https://help.tenten.vn/wp-content/uploads/2023/08/Capture1.png 717w, https://help.tenten.vn/wp-content/uploads/2023/08/Capture1-300x210.png 300w" sizes="auto, (max-width: 717px) 100vw, 717px" /></p>
<p><strong> </strong></p>
<h4><strong>Bước 4</strong>: Điền các thông số cần thiết cho python app và chọn “<strong>Create</strong>”</h4>
<p>+ Python version: Phiên bản python sẽ chạy app này.</p>
<p>+ Application root: Tên thư mục chính của python app.</p>
<p>+ Application URL: Đường dẫn url của python app (mặc định sẽ tự tạo).</p>
<p>+ Application startup file: Tên file wsgi để cPanel kết nối và gọi app python (mặc định sẽ tự tạo).</p>
<p>+ Application Entry point: wsgi callable object cho python app.</p>
<p>+ Passenger log file: file log cho app trong quá trình sử dụng.</p>
<p><img loading="lazy" decoding="async" class="size-medium wp-image-12407 aligncenter" src="https://help.tenten.vn/wp-content/uploads/2023/08/Capture.png" alt="" width="749" height="639" srcset="https://help.tenten.vn/wp-content/uploads/2023/08/Capture.png 749w, https://help.tenten.vn/wp-content/uploads/2023/08/Capture-300x256.png 300w" sizes="auto, (max-width: 749px) 100vw, 749px" /></p>
<h4><strong>Bước 5:</strong> Copy lệnh truy cập vào môi trường ảo vừa tạo cho python app và thực thi lệnh qua giao hiện ssh trên cPanel</h4>
<h4><strong> <img loading="lazy" decoding="async" class="size-medium wp-image-12404 aligncenter" src="https://help.tenten.vn/wp-content/uploads/2023/08/Capt212ure.png" alt="" width="800" height="524" srcset="https://help.tenten.vn/wp-content/uploads/2023/08/Capt212ure.png 800w, https://help.tenten.vn/wp-content/uploads/2023/08/Capt212ure-300x197.png 300w, https://help.tenten.vn/wp-content/uploads/2023/08/Capt212ure-768x503.png 768w" sizes="auto, (max-width: 800px) 100vw, 800px" /></strong></h4>
<h4><strong>Bước 6:</strong> Dùng lệnh pip install module Django.</h4>
<pre>pip install --upgrade pip

pip install django</pre>
<h4><strong>Bước 7:</strong> Tạo Django project tại thư mục chính (trong ví dụ này thư mục chính là main_site và tên project là demo_project) sử dụng lệnh:</h4>
<pre>django-admin startproject demo_project .</pre>
<ul>
<li><strong>Lưu ý: Câu lệnh có dấu chấm ở cuối câu.</strong></li>
</ul>
<p>Sau khi tạo project các file hiện có trong thư mục gốc như sau</p>
<p><img loading="lazy" decoding="async" class="size-medium wp-image-12399 aligncenter" src="https://help.tenten.vn/wp-content/uploads/2023/08/C3apture.png" alt="" width="505" height="40" srcset="https://help.tenten.vn/wp-content/uploads/2023/08/C3apture.png 505w, https://help.tenten.vn/wp-content/uploads/2023/08/C3apture-300x24.png 300w" sizes="auto, (max-width: 505px) 100vw, 505px" /></p>
<h4><strong>Bước 8:</strong> Thực hiện chỉnh sửa cấu hình các file cho phù hợp.</h4>
<ol>
<li>Xóa nội dung file passenger_wsgi.py và thay bằng:</li>
</ol>
<pre>from demo_project.wsgi import application</pre>
<ol start="2">
<li>Chình sửa file demo_project/settings.py</li>
</ol>
<p>+ Tại dòng “ALLOWED_HOSTS” thêm vào tên domain muốn truy cập đến</p>
<p><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-12406 aligncenter" src="https://help.tenten.vn/wp-content/uploads/2023/08/Captur4e.png" alt="" width="421" height="26" srcset="https://help.tenten.vn/wp-content/uploads/2023/08/Captur4e.png 421w, https://help.tenten.vn/wp-content/uploads/2023/08/Captur4e-300x19.png 300w" sizes="auto, (max-width: 421px) 100vw, 421px" /></p>
<p>+ Di chuyển đến cuối file và add thêm dòng sau:</p>
<pre>STATIC_ROOT = ‘&lt;đường dẫn đến public_html&gt;/static’</pre>
<p>+ Save và quit</p>
<ol start="3">
<li>Thêm quyền execute cho file manage.py</li>
</ol>
<pre>chmod +x manage.py</pre>
<ol start="4">
<li>Thực hiện cập nhật các thay đổi mới cấu hình</li>
</ol>
<pre>./manage.py migrate</pre>
<ol start="5">
<li>Thực hiện update nội dung css và js liên quan đến static_root</li>
</ol>
<pre>./manage.py collectstatic</pre>
<h4><strong>Bước 9:</strong> restart python app và thử truy cập website</h4>
<p><img loading="lazy" decoding="async" class="size-full wp-image-12663 aligncenter" src="https://help.tenten.vn/wp-content/uploads/2023/08/Screenshot_1.png" alt="" width="926" height="550" srcset="https://help.tenten.vn/wp-content/uploads/2023/08/Screenshot_1.png 926w, https://help.tenten.vn/wp-content/uploads/2023/08/Screenshot_1-300x178.png 300w, https://help.tenten.vn/wp-content/uploads/2023/08/Screenshot_1-768x456.png 768w" sizes="auto, (max-width: 926px) 100vw, 926px" /></p>
<h1 id="ftoc-heading-2" class="ftwp-heading"><strong>Cài đặt Django trên cPanel sử dụng MySQL Database</strong></h1>
<p>Mặc định khi cài đặt django trên python app cPanel, website sẽ sử dụng Sqlite Database, chúng ta có thể tạo mysql database và thiết lập để Django sử dụng Mysql Database này. Lưu ý, quá trình đổi database sẽ mất dữ liệu trong database hiện tại.</p>
<h4><strong>Bước 1: </strong>Tạo database</h4>
<p><img loading="lazy" decoding="async" class="size-medium wp-image-12401 aligncenter" src="https://help.tenten.vn/wp-content/uploads/2023/08/Ca6pture.png" alt="" width="905" height="240" srcset="https://help.tenten.vn/wp-content/uploads/2023/08/Ca6pture.png 905w, https://help.tenten.vn/wp-content/uploads/2023/08/Ca6pture-300x80.png 300w, https://help.tenten.vn/wp-content/uploads/2023/08/Ca6pture-768x204.png 768w" sizes="auto, (max-width: 905px) 100vw, 905px" /></p>
<h4><strong> Bước 2: </strong>Sử dụng Terminal, truy cập môi trường ảo python app, chỉnh sửa thông tin database trong file setting: &lt;tên project&gt;/settings.py</h4>
<h4><strong> <img loading="lazy" decoding="async" class="size-medium wp-image-12403 aligncenter" src="https://help.tenten.vn/wp-content/uploads/2023/08/Cap7ture.png" alt="" width="576" height="252" srcset="https://help.tenten.vn/wp-content/uploads/2023/08/Cap7ture.png 576w, https://help.tenten.vn/wp-content/uploads/2023/08/Cap7ture-300x131.png 300w" sizes="auto, (max-width: 576px) 100vw, 576px" /></strong></h4>
<h4><strong>Bước 3: </strong>Đăng nhập server hosting, truy cập môi trường ảo python app, và thực hiện lệnh: pip install mysqlclient</h4>
<p><img loading="lazy" decoding="async" class="size-medium wp-image-12398 aligncenter" src="https://help.tenten.vn/wp-content/uploads/2023/08/88Capture.png" alt="" width="939" height="94" srcset="https://help.tenten.vn/wp-content/uploads/2023/08/88Capture.png 939w, https://help.tenten.vn/wp-content/uploads/2023/08/88Capture-300x30.png 300w, https://help.tenten.vn/wp-content/uploads/2023/08/88Capture-768x77.png 768w" sizes="auto, (max-width: 939px) 100vw, 939px" /></p>
<h4><strong>Bước 4: </strong>Reset python app và thử truy cập lại website</h4>
<p><img loading="lazy" decoding="async" class="wp-image-3542 size-full aligncenter" src="https://blog.vinahost.vn/wp-content/uploads/2021/04/cai-dat-Django-10.png" sizes="auto, (max-width: 938px) 100vw, 938px" srcset="https://blog.vinahost.vn/wp-content/uploads/2021/04/cai-dat-Django-10.png 938w, https://blog.vinahost.vn/wp-content/uploads/2021/04/cai-dat-Django-10-300x178.png 300w, https://blog.vinahost.vn/wp-content/uploads/2021/04/cai-dat-Django-10-768x457.png 768w" alt="Django" width="938" height="558" /></p>
<p>Chúc bạn thành công!</p>
<p>Bài viết <a href="https://help.tenten.vn/huong-dan-cai-dat-django-tren-giao-dien-cpanel/">Hướng Dẫn Cài Đặt Django Trên Giao Diện cPanel</a> đã xuất hiện đầu tiên vào ngày <a href="https://help.tenten.vn">Hướng dẫn TENTEN</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
