<?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>Sửa lỗi Django &#8211; Nhật Phúc</title>
	<atom:link href="https://nhatphuc.com/bai-viet/sua-loi-django/feed/" rel="self" type="application/rss+xml" />
	<link>https://nhatphuc.com</link>
	<description></description>
	<lastBuildDate>Mon, 25 Dec 2023 04:11:30 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.1</generator>

<image>
	<url>https://nhatphuc.com/wp-content/uploads/2019/08/favicon-75x75.png</url>
	<title>Sửa lỗi Django &#8211; Nhật Phúc</title>
	<link>https://nhatphuc.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Sửa lỗi Invalid HTTP_HOST header trên Django</title>
		<link>https://nhatphuc.com/sua-loi-invalid-http_host-header-tren-django/</link>
					<comments>https://nhatphuc.com/sua-loi-invalid-http_host-header-tren-django/#respond</comments>
		
		<dc:creator><![CDATA[Linh Nguyễn]]></dc:creator>
		<pubDate>Wed, 02 Jan 2019 11:33:12 +0000</pubDate>
				<category><![CDATA[Học công nghệ]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[Developer]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Sửa lỗi Django]]></category>
		<category><![CDATA[Thủ thuật Django]]></category>
		<guid isPermaLink="false">http://nhatphuc.com/?p=52</guid>

					<description><![CDATA[<p>Hôm nay mình có việc cần nghiên cứu một tí về Django. Mình sẽ hướng [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://nhatphuc.com/sua-loi-invalid-http_host-header-tren-django/">Sửa lỗi Invalid HTTP_HOST header trên Django</a> appeared first on <a rel="nofollow" href="https://nhatphuc.com">Nhật Phúc</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h5>Hôm nay mình có việc cần nghiên cứu một tí về Django. Mình sẽ hướng dẫn lại quá trình cài đặt sau dành cho các bạn muốn tham khảo. Tuy nhiên mình dính một lỗi khi cho chạy webserver đó là lỗi Invalid HTTP_HOST header, mình note lại cách xử lý để sau này tiện tra cứu lại cũng như bạn nào gặp phải thì dễ dàng xử lý nhé.</h5>
<p>Đại loại lỗi này khi bạn cho chạy webserver một project Django, bạn sẽ nhận một thông báo dạng như:</p>
<blockquote><p>DisallowedHost at / Invalid HTTP_HOST header: &#8216;198.211.99.20&#8217;. You may need to add u&#8217;198.211.99.20&#8242; to ALLOWED_HOSTS.</p></blockquote>
<p>Thường khi bạn tạo một project Django mới, bạn dùng lệnh:</p>
<blockquote><p><strong>django-admin startproject prj1</strong></p></blockquote>
<p>Lệnh này sẽ tạo một thư mục Prj1 chứa tất cả các file cần thiết cho một project Django. Để xử lý lỗi trên, bạn vào thư mục này, tìm file có tên <strong>settings.py</strong>. Mở nó lên và tìm đến dòng:</p>
<p><strong>ALLOWED_HOSTS = []</strong></p>
<p>Chỉnh sửa dòng này lại thành</p>
<p><strong>ALLOWED_HOSTS = [&#8216;198.211.99.20&#8217;]</strong></p>
<p>Trong đó <strong>198.211.99.20</strong> chính là địa chỉ IP của VPS/Server Linux của bạn. Chỉnh sửa xong khi khởi chạy lại project bạn sẽ thấy không còn xuất hiện lỗi này nữa.</p>
<p>Hy vọng ghi chú lập trình này giúp ích cho bạn.</p>
<p>The post <a rel="nofollow" href="https://nhatphuc.com/sua-loi-invalid-http_host-header-tren-django/">Sửa lỗi Invalid HTTP_HOST header trên Django</a> appeared first on <a rel="nofollow" href="https://nhatphuc.com">Nhật Phúc</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://nhatphuc.com/sua-loi-invalid-http_host-header-tren-django/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
