{"id":181556,"date":"2013-05-31T14:51:03","date_gmt":"2013-05-31T10:51:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=181556"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=181556","title":{"rendered":"<span class=\"post_title\">\u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u0431\u043b\u043e\u0433 \u0441 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u043c\u0438 \u043d\u0430 Django: \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0438 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u0441\u0430\u043c\u044b\u0445 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0445<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0430 \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432 \u0432 web-\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0438 \u043e\u0441\u0432\u0435\u0449\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0431\u043b\u043e\u0433\u0430 \u043d\u0430 <a href=\"http:\/\/ru.wikipedia.org\/wiki\/Django\">Django<\/a> \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c <a href=\"http:\/\/ru.wikipedia.org\/wiki\/Twitter_bootstrap\">Twitter Bootstrap<\/a> \u0438 \u0435\u0433\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u043d\u0430 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e\u043c \u0445\u043e\u0441\u0442\u0438\u043d\u0433\u0435 <a href=\"http:\/\/www.pythonanywhere.com\">PythonAnywhere<\/a>. \u042f \u0441\u0442\u0430\u0440\u0430\u043b\u0441\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0449\u0435 \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u0435\u0435. \u0411\u043e\u043b\u0435\u0435 \u043e\u043f\u044b\u0442\u043d\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u0434\u0430\u043d\u043d\u043e\u0435 \u0447\u0442\u0438\u0432\u043e \u043d\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u043e\u0432\u043e\u0433\u043e, \u0434\u0430 \u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u0435\u043c\u044b \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043a\u0430\u0436\u0443\u0442\u0441\u044f \u043d\u0435\u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u043c\u0438. <\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/dce\/775\/787\/dce775787d6c04aac8f8b66e8620235a.jpg\"\/><br \/>  <a name=\"habracut\"><\/a><\/p>\n<p>  \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044e, \u0447\u0442\u043e \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u0443\u0436\u0435 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u043b\u0435\u043d \u0441 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u043e\u043c Python, \u0438\u043c\u0435\u0435\u0442 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e Django (\u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0435\u043f\u043b\u043e\u0445\u043e \u043f\u0440\u043e\u0439\u0442\u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 <a href=\"http:\/\/codeacademy.com\">http:\/\/codeacademy.com<\/a> \u043f\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0442\u0435\u043c\u0435 \u0438 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/docs.djangoproject.com\/en\/1.5\/intro\/tutorial01\/\">\u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b \u043f\u043e Django<\/a>), \u0430 \u0442\u0430\u043a\u0436\u0435 \u0432\u043b\u0430\u0434\u0435\u0435\u0442 \u043f\u0440\u0438\u0435\u043c\u0430\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435.<br \/>  \u0418\u0442\u0430\u043a, \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0441 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435. \u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442 \u043b\u044e\u0431\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0432\u044b \u0447\u0443\u0432\u0441\u0442\u0432\u0443\u0435\u0442\u0435 \u0441\u0435\u0431\u044f \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e, \u0437\u0434\u0435\u0441\u044c \u044f \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0434\u043b\u044f GNU\/Linux, \u0430 \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u0448\u0430\u0433\u0438 \u043c\u043e\u0433\u0443\u0442 \u043d\u0435\u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f. \u0412 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430 virtualenv \u2014 \u0443\u0442\u0438\u043b\u0438\u0442\u0430 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f (\u0447\u0442\u043e\u0431\u044b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043d\u0435 \u043c\u0435\u0448\u0430\u043b\u0438\u0441\u044c \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u043c \u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u043c).<\/p>\n<p>  C\u043e\u0437\u0434\u0430\u0435\u043c \u0438 \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u043c \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435:  <\/p>\n<pre><code class=\"bash\">mkdir ~\/projects cd ~\/projects virtualenv env source env\/bin\/activate  <\/code><\/pre>\n<p>  \u0412 \u041e\u0421 Windows \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0442\u0430\u043a\u043e\u0439:  <\/p>\n<pre><code class=\"bash\">env\/Scripts\/activate  <\/code><\/pre>\n<p>  \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c Django \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e pip \u2014 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0430 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 Python.  <\/p>\n<pre><code class=\"bash\">pip install django <\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442. \u041d\u0430\u0437\u043e\u0432\u0435\u043c \u0435\u0433\u043e \u043a\u0430\u043a-\u043d\u0438\u0431\u0443\u0434\u044c \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 mysite.  <\/p>\n<pre><code class=\"bash\">django-admin.py startproject mysite && cd mysite <\/code><\/pre>\n<p>  \u0421\u043a\u0440\u0438\u043f\u0442 \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 mysite \u0441 \u0435\u0449\u0435 \u043e\u0434\u043d\u0438\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u043c mysite \u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 *.py \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u0432\u043d\u0443\u0442\u0440\u0438. <\/p>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442 manage.py \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f django \u0441 \u0438\u043c\u0435\u043d\u0435\u043c blog.  <\/p>\n<pre><code class=\"bash\">python manage.py startapp blog <\/code><\/pre>\n<p>  \u041e\u0442\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0432 \u0444\u0430\u0439\u043b\u0435 mysite\/settings.py (\u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435: \u044f \u0438\u043c\u0435\u044e \u0432\u0432\u0438\u0434\u0443 ~\/projects\/mysite\/mysite\/settings.py) \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0442\u0443\u0434\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"python\"># coding: utf-8 import os  BASE_DIR = os.path.dirname(os.path.dirname(__file__)) <\/code><\/pre>\n<p>  \u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0443\u043a\u0430\u0436\u0435\u043c \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0443 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c, \u0432\u043e \u0438\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u0435 \u043f\u0443\u0442\u0430\u043d\u0438\u0446\u044b \u0438 \u0433\u043b\u044e\u043a\u043e\u0432 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0435\u0435 \u0432\u043e \u0432\u0441\u0435\u0445 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0445 \u0444\u0430\u0439\u043b\u0430\u0445 *.py, \u043f\u0435\u0440\u0435\u043a\u043e\u0434\u0438\u0440\u0443\u044f \u0438\u0445 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432 UTF-8.<br \/>  \u0412 BASE_DIR \u0431\u0443\u0434\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u043f\u043e\u043b\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0443, \u0447\u0442\u043e \u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0443\u0442\u0438 \u043f\u0440\u0438 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438<\/p>\n<p>  \u041d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0432\u043f\u043e\u043b\u043d\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c SQLite <\/p>\n<pre><code class=\"python\">DATABASES = { 'default':     {         'ENGINE': 'django.db.backends.sqlite3',         'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),     } } <\/code><\/pre>\n<p>  \u041d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0447\u0430\u0441\u043e\u0432\u043e\u0439 \u043f\u043e\u044f\u0441 \u0438 \u044f\u0437\u044b\u043a:  <\/p>\n<pre><code class=\"python\">TIME_ZONE = 'Europe\/Moscow' LANGUAGE_CODE = 'ru-ru' <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e \u0431\u044b Django \u0443\u0437\u043d\u0430\u043b\u043e \u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438, \u0434\u043e\u0431\u0430\u0432\u0438\u043c &#8216;blog&#8217; \u0432 \u043a\u043e\u0440\u0442\u0435\u0436 INSTALLED_APPS, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0441\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 &#8216;django.contrib.admin&#8217; \u0434\u043b\u044f \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u0430\u0434\u043c\u0438\u043d\u043a\u0438:<\/p>\n<pre><code class=\"python\">INSTALLED_APPS = (     'django.contrib.auth',     'django.contrib.contenttypes',     'django.contrib.sessions',     'django.contrib.sites',     'django.contrib.messages',     'django.contrib.staticfiles',     'django.contrib.admin',     'blog', ) <\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0430\u0434\u043c\u0438\u043d\u043a\u0430 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0430, \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c mysite\/urls.py<\/p>\n<pre><code class=\"bash\">from django.conf.urls import patterns, include, url  from django.contrib import admin admin.autodiscover()  #\u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 admin.py \u0432 \u043d\u0430\u0448\u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445  urlpatterns = patterns('',     url(r'^admin\/', include(admin.site.urls)), #URL \u0430\u0434\u043c\u0438\u043d\u043a\u0438 http:\/\/\u0438\u043c\u044f_\u0441\u0430\u0439\u0442\u0430\/admin\/ ) <\/code><\/pre>\n<p>  C\u043e\u0437\u0434\u0430\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u044c \u0432 blog\/models.py<\/p>\n<pre><code class=\"bash\">from django.db import models  class Post(models.Model):     title = models.CharField(max_length=255) # \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u043f\u043e\u0441\u0442\u0430     datetime = models.DateTimeField(u'\u0414\u0430\u0442\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438') # \u0434\u0430\u0442\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438     content = models.TextField(max_length=10000) # \u0442\u0435\u043a\u0441\u0442 \u043f\u043e\u0441\u0442\u0430      def __unicode__(self):         return self.title      def get_absolute_url(self):         return &quot;\/blog\/%i\/&quot; % self.id <\/code><\/pre>\n<p>  \u041d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u044d\u0442\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 Django \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. <\/p>\n<p>  \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u0435\u0435 \u0432 \u0430\u0434\u043c\u0438\u043d\u043a\u0435 blog\\admin.py<\/p>\n<pre><code class=\"python\">from django.contrib import admin from blog.models import Post # \u043d\u0430\u0448\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u0438\u0437 blog\/models.py  admin.site.register(Post) <\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre><code class=\"bash\">python manage.py syncdb <\/code><\/pre>\n<p>  \u041f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435 \u044d\u0442\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b Django \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0443\u043f\u0435\u0440\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u043c \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c.<\/p>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 Django:<\/p>\n<pre><code class=\"bash\">python manage.py runserver <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0432\u043e\u0434\u0438\u043c url \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435<\/p>\n<p>  <a href=\"http:\/\/localhost:8000\/admin\/\">http:\/\/localhost:8000\/admin\/<\/a><\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u0441\u0435 \u043f\u0440\u043e\u0448\u043b\u043e \u0445\u043e\u0440\u043e\u0448\u043e, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u0438\u0434\u0435\u0442\u044c \u044d\u0442\u043e:<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/996\/d5f\/156\/996d5f156f5d1efd6cde95cb1fdec8e5.png\"\/><\/p>\n<p>  \u0417\u0430\u0445\u043e\u0434\u0438\u043c \u0441 \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u043c \u043b\u043e\u0433\u0438\u043d\u043e\u043c\\\u043f\u0430\u0440\u043e\u043b\u0435\u043c \u0432 \u0430\u0434\u043c\u0438\u043d\u043a\u0443 \u2014 \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0438 \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u043f\u043e\u0441\u0442\u044b (\u043a\u043d\u043e\u043f\u043a\u0438 \u0441\u043f\u0440\u0430\u0432\u0430 \u043e\u0442 Posts)<\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u0442\u043e\u0432 \u0434\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u0439\u043c\u0435\u043c\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u043c \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0430, \u043d\u0430\u043c \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0432\u0441\u0435\u0433\u043e \u0434\u0432\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u0445 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u2014 \u043e\u0434\u043d\u0430 \u0441 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435\u043c \u0432\u0441\u0435\u0445 \u043f\u043e\u0441\u0442\u043e\u0432, \u0432\u0442\u043e\u0440\u0430\u044f \u2014 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 \u043f\u043e\u0441\u0442\u0430.<\/p>\n<p>  \u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c blog\/views.py<\/p>\n<pre><code class=\"python\">from blog.models import Post  from django.views.generic import ListView, DetailView  class PostsListView(ListView): # \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432 \u0432\u0438\u0434\u0435 \u0441\u043f\u0438\u0441\u043a\u0430     model = Post                   # \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f   class PostDetailView(DetailView): # \u0434\u0435\u0442\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438     model = Post <\/code><\/pre>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 urlpatterns mysite\\urls.py \u0441\u0442\u0440\u043e\u043a\u0443 <\/p>\n<pre><code class=\"python\">url(r'^blog\/', include('blog.urls')), <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e \u0431\u044b \u0432\u0441\u0435 URL-\u044b \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0435\u0441\u044f \u0441 \/blog\/ \u0431\u0443\u0434\u0443\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e urls.py \u0438\u0437 \u043c\u043e\u0434\u0443\u043b\u044f blog, \u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0430\u043c \u0444\u0430\u0439\u043b urls.py \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 blog \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435\u043c:<\/p>\n<pre><code class=\"python\">#coding: utf-8 from django.conf.urls import patterns, url  from blog.views import PostsListView, PostDetailView   urlpatterns = patterns('', url(r'^$', PostsListView.as_view(), name='list'), # \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u043e URL http:\/\/\u0438\u043c\u044f_\u0441\u0430\u0439\u0442\u0430\/blog\/                                                                                      # \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u0441\u0442\u043e\u0432 url(r'^(?P&lt;pk&gt;\\d+)\/$', PostDetailView.as_view()), # \u0430 \u043f\u043e URL http:\/\/\u0438\u043c\u044f_\u0441\u0430\u0439\u0442\u0430\/blog\/\u0447\u0438\u0441\u043b\u043e\/                                                                                         # \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043f\u043e\u0441\u0442 \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u043d\u043e\u043c\u0435\u0440\u043e\u043c  ) <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0441\u0442\u0440\u0430\u043d\u0438\u0446. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0430 PostListView Django \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043a\u0430\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d \u0432 blog\/templates\/blog\/post_list.html (\u0442\u0430\u043a\u043e\u0439 \u0434\u043b\u0438\u043d\u043d\u044b\u0439 \u0438 \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u0441\u0432\u044f\u0437\u0430\u043d \u0441 \u043b\u043e\u0433\u0438\u043a\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430, \u0432 \u0441\u0438\u043b\u0430\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u044d\u0442\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435, \u043d\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u043a\u0430\u0441\u0430\u044e\u0441\u044c)<\/p>\n<p>  \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b:<\/p>\n<pre><code class=\"django\">{% block content %}     {% for post in object_list %}         &lt;p&gt;{{ post.datetime }}&lt;\/p&gt;         &lt;h2&gt;&lt;a href=&quot;{{ post.get_absolute_url }}&quot;&gt;{{ post.title }}&lt;\/a&gt;&lt;\/h2&gt;         &lt;p&gt;{{ post.content }}&lt;\/p&gt;     {% empty %}     &lt;p&gt;\u041d\u0435\u0442 \u043f\u043e\u0441\u0442\u043e\u0432&lt;\/p&gt;     {% endfor %}  {% endblock %} <\/code><\/pre>\n<p>  \u0427\u0442\u043e \u0436\u0435, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043a\u0430\u043a \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u0437\u0430\u0439\u0434\u044f \u043f\u043e URL \u043d\u0430 <a href=\"http:\/\/localhost:8000\/blog\/\">http:\/\/localhost:8000\/blog\/<\/a>. \u0415\u0441\u043b\u0438 \u043e\u0448\u0438\u0431\u043e\u043a \u043d\u0435\u0442, \u0442\u043e \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u0441\u0442\u043e\u0432, \u0433\u0434\u0435 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u043e\u0441\u0442\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0441\u044b\u043b\u043a\u043e\u0439.<br \/>  \u041f\u043e\u043a\u0430 \u044d\u0442\u0438 \u0441\u0441\u044b\u043b\u043a\u0438 \u0432\u0435\u0434\u0443\u0442 \u0432 \u043d\u0438\u043a\u0443\u0434\u0430, \u043d\u0430\u0434\u043e \u044d\u0442\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0430 PostDetailView \u0448\u0430\u0431\u043b\u043e\u043d \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 blog\\templates\\blog\\post_detail.html.<\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0435\u0433\u043e:<\/p>\n<pre><code class=\"django\">{% block content %}     &lt;p&gt;{{ post.datetime }}&lt;\/p&gt;     &lt;h2&gt;{{ post.title }}&lt;\/h2&gt;     &lt;p&gt;{{ post.content }}&lt;\/p&gt; {% endblock %} <\/code><\/pre>\n<p>  \u0418 \u0441\u043d\u043e\u0432\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c: <a href=\"http:\/\/localhost:8000\/blog\/1\/\">http:\/\/localhost:8000\/blog\/1\/<\/a><\/p>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430\u0448\u0438\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0432 \u044d\u0442\u0438\u0445 \u0446\u0435\u043b\u044f\u0445 \u043c\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043cc\u044f \u0443\u0441\u043b\u0443\u0433\u0430\u043c\u0438 <a href=\"http:\/\/disqus.com\">DISQUS<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e pip<\/p>\n<pre><code class=\"bash\">pip install django-disqus  <\/code><\/pre>\n<p>  \u042d\u0442\u043e\u0442 \u043c\u043e\u0434\u0443\u043b\u044c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432, \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 \u0441\u043f\u0430\u043c\u0430, \u0430\u0432\u0430\u0442\u0430\u0440\u043a\u0430\u043c\u0438 \u0438 \u043f\u0440\u043e\u0447\u0438\u043c, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0431\u0435\u0440\u0435\u0442 \u043d\u0430 \u0441\u0435\u0431\u044f \u0437\u0430\u0431\u043e\u0442\u0443 \u043f\u043e \u0438\u0445 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e:<\/p>\n<p>  \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 post_detail.html \u043f\u0435\u0440\u0435\u0434 {% endblock %}<\/p>\n<pre><code class=\"django\">&lt;p&gt;     {% load disqus_tags %}     {% disqus_dev %}     {% disqus_show_comments %} &lt;\/p&gt; <\/code><\/pre>\n<p>  \u0412 INSTALLED_APPS \u0444\u0430\u0439\u043b\u0430 settings.py \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c &#8216;disqus&#8217;<\/p>\n<pre><code class=\"python\">INSTALLED_APPS = (     'django.contrib.auth',     'django.contrib.contenttypes',     'django.contrib.sessions',     'django.contrib.sites',     'django.contrib.messages',     'django.contrib.staticfiles',     'django.contrib.admin',     'blog',     'disqus', ) <\/code><\/pre>\n<p>  \u0410 \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 settings.py<\/p>\n<pre><code class=\"python\">DISQUS_API_KEY = '***' DISQUS_WEBSITE_SHORTNAME = '***' <\/code><\/pre>\n<p>  \u0414\u0432\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c, \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0432\u0448\u0438\u0441\u044c \u043d\u0430 <a href=\"http:\/\/disqus.com\">http:\/\/disqus.com<\/a>.<\/p>\n<p>  \u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435. \u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432\u043d\u0443\u0448\u0430\u0435\u0442, \u043d\u043e \u043d\u0430\u0434\u043e \u0447\u0442\u043e-\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u0435\u043c. \u0421\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439, \u0438 \u0432 \u0442\u043e\u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Twitter Bootstrap.<\/p>\n<p>  \u041a\u0430\u0447\u0430\u0435\u043c \u0430\u0440\u0445\u0438\u0432 <a href=\"http:\/\/twitter.github.io\/bootstrap\/assets\/bootstrap.zip\">http:\/\/twitter.github.io\/bootstrap\/assets\/bootstrap.zip<\/a> \u0438 \u0440\u0430\u0437\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u0443\u0435\u043c \u0435\u0433\u043e \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 static \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 (\u044f \u0438\u043c\u0435\u044e \u0432 \u0432\u0438\u0434\u0443 ~\/projects\/mysite\/static \u2014 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0435\u0433\u043e) <\/p>\n<p>  \u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c settings.py, \u0447\u0442\u043e \u0431\u044b Django \u0437\u043d\u0430\u043b\u043e \u0433\u0434\u0435 \u0438\u0441\u043a\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b.<\/p>\n<pre><code class=\"python\">STATICFILES_DIRS = (     os.path.join(BASE_DIR, 'static'), ) <\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b blog\/templates\/blog\/base.html \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f<\/p>\n<pre><code class=\"django\">&lt;!DOCTYPE html&gt; &lt;html lang=&quot;ru&quot;&gt;     &lt;head&gt;         &lt;meta charset=&quot;utf-8&quot; \/&gt;         &lt;title&gt;MyBlog&lt;\/title&gt;         &lt;link href=&quot;{{STATIC_URL}}bootstrap\/css\/bootstrap.css&quot; rel=&quot;stylesheet&quot;&gt;         &lt;style&gt;             body {                 padding-top: 60px; \/* 60px to make the container go all the way to the bottom of the topbar *\/             }         &lt;\/style&gt;         &lt;link href=&quot;{{STATIC_URL}}bootstrap\/css\/bootstrap-responsive.css&quot; rel=&quot;stylesheet&quot;&gt;         &lt;!--[if lt IE 9]&gt;         &lt;script src=&quot;http:\/\/html5shim.googlecode.com\/svn\/trunk\/html5.js&quot;&gt;&lt;\/script&gt;         &lt;![endif]--&gt;         &lt;script src=&quot;{{STATIC_URL}}bootstrap\/js\/bootstrap.js&quot; type=&quot;text\/javascript&quot;&gt;&lt;\/script&gt;         {% block extrahead %}         {% endblock %}         &lt;script type=&quot;text\/javascript&quot;&gt;         $(function(){         {% block jquery %}         {% endblock %}         });         &lt;\/script&gt;     &lt;\/head&gt; &lt;body&gt;  &lt;div class=&quot;navbar navbar-inverse navbar-fixed-top&quot;&gt;     &lt;div class=&quot;navbar-inner&quot;&gt;         &lt;div class=&quot;container&quot;&gt;             &lt;div class=&quot;brand&quot;&gt;My Blog&lt;\/div&gt;             &lt;ul class=&quot;nav&quot;&gt;                 &lt;li&gt;&lt;a href=&quot;{% url 'list' %}&quot; class=&quot;&quot;&gt;\u0421\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u0441\u0442\u043e\u0432&lt;\/a&gt;&lt;\/li&gt;             &lt;\/ul&gt;         &lt;\/div&gt;     &lt;\/div&gt;  &lt;\/div&gt;  &lt;div class=&quot;container&quot;&gt;      {% block content %}Empty page{% endblock %} &lt;\/div&gt; &lt;!-- container --&gt;  &lt;\/body&gt; &lt;\/html&gt; <\/code><\/pre>\n<p>  \u042d\u0442\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0448\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u0441\u0442\u0440\u0430\u043d\u0438\u0446, \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0435\u0433\u043e \u0432 post_list.html \u0438 post_detail.html \u0434\u043e\u043f\u0438\u0441\u0430\u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0439 \u0432 \u043d\u0438\u0445 <\/p>\n<pre><code class=\"django\">{% extends 'blog\/base.html' %} <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c. \u0412\u043e\u0442 \u0442\u0435\u043f\u0435\u0440\u044c \u043a\u0440\u0430\u0441\u043e\u0442\u0430 \u043d\u0430\u0432\u0435\u0434\u0435\u043d\u0430, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e\u043c \u043e\u0431\u043b\u0430\u0447\u043d\u043e\u043c \u0445\u043e\u0441\u0442\u0438\u043d\u0433\u0435.<\/p>\n<p>  \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439 N00b \u0430\u043a\u043a\u0430\u0443\u043d\u0442 \u043d\u0430 <a href=\"http:\/\/pythonanywere.com\">PythonAnywhere<\/a>. \u041c\u043d\u0435 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0441\u044f \u044d\u0442\u043e\u0442 \u0441\u0435\u0440\u0432\u0438\u0441 \u043b\u0435\u0433\u043a\u043e\u0441\u0442\u044c\u044e \u0432 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 Django, \u0432\u0441\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0442\u0430\u043a \u0436\u0435 \u043a\u0430\u043a \u0438 \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435. <\/p>\n<p>  \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043d\u0430 PythonAnywhere \u0441 \u0438\u043c\u0435\u043d\u0435\u043c djangotest, \u0442\u043e\u0433\u0434\u0430 \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <a href=\"http:\/\/djangotest.pythonanywhere.com\">djangotest.pythonanywhere.com<\/a>. \u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435: \u0437\u0430\u043c\u0435\u043d\u044f\u0439\u0442\u0435 \u0434\u0430\u043b\u0435\u0435 \u043f\u043e \u0442\u0435\u043a\u0441\u0442\u043a &#8216;djangotest&#8217; \u043d\u0430 \u0441\u0432\u043e\u0439 \u043b\u043e\u0433\u0438\u043d \u0432 PythonAnywhere.<\/p>\n<p>  \u041c\u0435\u043d\u044f\u0435\u043c \u0432 settings.py<\/p>\n<pre><code class=\"python\">DEBUG = False <\/code><\/pre>\n<p>  \u0438 \u0434\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c <\/p>\n<pre><code class=\"python\">ALLOWED_HOSTS = ['djangotest.pythonanywhere.com'] <\/code><\/pre>\n<p>  \u0417\u0430\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b\u044b \u043d\u0430 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u043b\u044e\u0431\u044b\u043c \u0438\u0437 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432.<\/p>\n<p>  \u041d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u0434\u043b\u044f \u043d\u0435\u0438\u0441\u043a\u0443\u0448\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043f\u0440\u043e\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u043f\u043a\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0437\u0430\u043b\u0438\u0442\u044c \u0430\u0440\u0445\u0438\u0432 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 (\u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 Files-&gt;Upload a file) \u0438 \u0440\u0430\u0437\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u0432 bash \u2014 \u0448\u0435\u043b\u043b\u0435 (\u0420\u0430\u0437\u0434\u0435\u043b Consoles -&gt; bash):<\/p>\n<p>  \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0435\u0441\u043b\u0438 \u043c\u044b \u0437\u0430\u043b\u0438\u043b\u0438 \u0444\u0430\u0439\u043b mysite.tar.gz \u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 PythonAnywhere  <\/p>\n<pre><code class=\"bash\"> tar -zxvf mysite.tar.gz  <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u0440\u0430\u0431\u043e\u0447\u0435\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435, \u0432\u0432\u043e\u0434\u0438\u043c \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 PythonAnywhere:<\/p>\n<pre><code class=\"bash\">virtualenv env  source env\/bin\/activate  pip remove django pip install django django-disqus <\/code><\/pre>\n<p>  \u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 Web -&gt; Static files:<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/36f\/21d\/c38\/36f21dc3890d207dc7b32bf2f5ad61ac.png\"\/><br \/>  \u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u2014 \u043c\u0435\u0441\u0442\u043e \u0433\u0434\u0435 \u043b\u0435\u0436\u0438\u0442 bootstrap, \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0444\u0430\u0439\u043b\u044b \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u0430\u0434\u043c\u0438\u043d\u043a\u0438 Django.<\/p>\n<p>  \u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c WSGI (Web -&gt; It is configured via a WSGI file stored at: &#8230;):<\/p>\n<pre><code class=\"python\">activate_this = '\/home\/djangotest\/env\/bin\/activate_this.py' execfile(activate_this, dict(__file__=activate_this))  import os import sys  path = '\/home\/djangotest\/mysite' if path not in sys.path:     sys.path.append(path) os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'  import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler() <\/code><\/pre>\n<p>  \u041d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0443 Web -&gt; Reload djangotest.pythonanywhere.com<\/p>\n<p>  \u0417\u0430\u0445\u043e\u0434\u0438\u043c \u043d\u0430 djangotest.pythonanywere.com\/blog\/ \u2014 \u043f\u043e\u0437\u0434\u0440\u0430\u0432\u043b\u044f\u044e, \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u043d\u0435\u043b\u0435\u0433\u043a\u043e, \u043d\u043e \u0412\u044b \u0441\u043f\u0440\u0430\u0432\u0438\u043b\u0438\u0441\u044c. \u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u0412\u0430\u0441 \u0435\u0441\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0443\u044e\u0442\u043d\u0435\u043d\u044c\u043a\u0438\u0439 \u0431\u043b\u043e\u0433, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0439 \u0441\u0432\u043e\u0438\u043c\u0438 \u0440\u0443\u043a\u0430\u043c\u0438 \u043d\u0430 \u0441\u0430\u043c\u044b\u0445 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0432\u0435\u0431-\u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f\u0445!    \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/181556\/\"> http:\/\/habrahabr.ru\/post\/181556\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0430 \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432 \u0432 web-\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0438 \u043e\u0441\u0432\u0435\u0449\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0431\u043b\u043e\u0433\u0430 \u043d\u0430 <a href=\"http:\/\/ru.wikipedia.org\/wiki\/Django\">Django<\/a> \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c <a href=\"http:\/\/ru.wikipedia.org\/wiki\/Twitter_bootstrap\">Twitter Bootstrap<\/a> \u0438 \u0435\u0433\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u043d\u0430 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e\u043c \u0445\u043e\u0441\u0442\u0438\u043d\u0433\u0435 <a href=\"http:\/\/www.pythonanywhere.com\">PythonAnywhere<\/a>. \u042f \u0441\u0442\u0430\u0440\u0430\u043b\u0441\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0449\u0435 \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u0435\u0435. \u0411\u043e\u043b\u0435\u0435 \u043e\u043f\u044b\u0442\u043d\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u0434\u0430\u043d\u043d\u043e\u0435 \u0447\u0442\u0438\u0432\u043e \u043d\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u043e\u0432\u043e\u0433\u043e, \u0434\u0430 \u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u0435\u043c\u044b \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043a\u0430\u0436\u0443\u0442\u0441\u044f \u043d\u0435\u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u043c\u0438. <\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/dce\/775\/787\/dce775787d6c04aac8f8b66e8620235a.jpg\"\/>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-181556","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/181556","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=181556"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/181556\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=181556"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=181556"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=181556"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}