{"id":1807,"date":"2023-03-14T07:21:32","date_gmt":"2023-03-14T07:21:32","guid":{"rendered":"https:\/\/blog.amt.in\/?p=1807"},"modified":"2023-03-14T07:21:32","modified_gmt":"2023-03-14T07:21:32","slug":"insights-on-django","status":"publish","type":"post","link":"https:\/\/blog.amt.in\/index.php\/2023\/03\/14\/insights-on-django\/","title":{"rendered":"Insights on Django"},"content":{"rendered":"<p>Django\u00c2\u00a0is a\u00c2\u00a0Python-based\u00c2\u00a0free and open-source\u00c2\u00a0web framework\u00c2\u00a0that follows the\u00c2\u00a0model-template-view\u00c2\u00a0(MVC)\u00c2\u00a0architectural pattern.\u00c2\u00a0It is maintained by the\u00c2\u00a0Django Software Foundation\u00c2\u00a0(DSF), an American independent organization established as a\u00c2\u00a0501(c)(3)\u00c2\u00a0non-profit.<\/p>\n<p>Django&#8217;s primary goal is to ease the creation of complex, database-driven websites. The framework emphasizes\u00c2\u00a0reusability\u00c2\u00a0and &#8220;pluggability&#8221; of components, less code, low coupling, rapid development, and the principle of\u00c2\u00a0don&#8217;t repeat yourself.\u00c2\u00a0Python is used throughout, even for settings files and data models. Django also provides an optional administrative\u00c2\u00a0create, read, update and delete\u00c2\u00a0interface that is generated dynamically through\u00c2\u00a0introspection\u00c2\u00a0and configured via admin models.<\/p>\n<p>Some well known sites that use Django include\u00c2\u00a0PBS,\u00c2\u00a0Instagram,\u00c2\u00a0Mozilla,\u00c2\u00a0The Washington Times,\u00c2\u00a0Disqus,\u00c2\u00a0Bitbucket,\u00c2\u00a0and\u00c2\u00a0Nextdoor.<\/p>\n<p>Django was created in the fall of 2003, when the\u00c2\u00a0web programmers\u00c2\u00a0at the\u00c2\u00a0Lawrence Journal-World\u00c2\u00a0newspaper,\u00c2\u00a0Adrian Holovaty\u00c2\u00a0and\u00c2\u00a0Simon Willison, began using Python to build applications.\u00c2\u00a0Jacob Kaplan-Moss\u00c2\u00a0was hired early in Django&#8217;s development shortly before Simon Willison&#8217;s internship ended.\u00c2\u00a0It was released publicly under a\u00c2\u00a0BSD license\u00c2\u00a0in July 2005. The framework was named after guitarist\u00c2\u00a0Django Reinhardt.<\/p>\n<p>In June 2008, it was announced that a newly formed\u00c2\u00a0Django Software Foundation\u00c2\u00a0(DSF) would maintain Django in the future.<\/p>\n<h4><span id=\"Components\" class=\"mw-headline\">Components:<\/span><\/h4>\n<p>Despite having its own nomenclature, such as naming the callable objects generating the\u00c2\u00a0HTTP\u00c2\u00a0responses &#8220;views&#8221;,\u00c2\u00a0the core Django framework can be seen as an\u00c2\u00a0MVC\u00c2\u00a0architecture.\u00c2\u00a0It consists of an\u00c2\u00a0object-relational mapper\u00c2\u00a0(ORM) that mediates between\u00c2\u00a0data models\u00c2\u00a0(defined as Python classes) and a\u00c2\u00a0relational database\u00c2\u00a0(&#8220;<b>M<\/b>odel&#8221;), a system for processing HTTP requests with a\u00c2\u00a0web templating system\u00c2\u00a0(&#8220;<b>V<\/b>iew&#8221;), and a\u00c2\u00a0regular-expression-based\u00c2\u00a0URL\u00c2\u00a0dispatcher (&#8220;<b>C<\/b>ontroller&#8221;).<\/p>\n<p>Also included in the core framework are:<\/p>\n<ul>\n<li>a lightweight and standalone web server for development and testing<\/li>\n<li>a form serialization and validation system that can translate between\u00c2\u00a0HTML\u00c2\u00a0forms and values suitable for storage in the database<\/li>\n<li>a template system that utilizes the concept of\u00c2\u00a0inheritance\u00c2\u00a0borrowed from object-oriented programming<\/li>\n<li>a\u00c2\u00a0caching\u00c2\u00a0framework that can use any of several cache methods<\/li>\n<li>support for\u00c2\u00a0middleware\u00c2\u00a0classes that can intervene at various stages of request processing and carry out custom functions<\/li>\n<li>an internal dispatcher system that allows components of an application to communicate events to each other via pre-defined signals<\/li>\n<li>an\u00c2\u00a0internationalization\u00c2\u00a0system, including translations of Django&#8217;s own components into a variety of languages<\/li>\n<li>a\u00c2\u00a0serialization\u00c2\u00a0system that can produce and read\u00c2\u00a0XML\u00c2\u00a0and\/or\u00c2\u00a0JSON\u00c2\u00a0representations of Django model instances<\/li>\n<li>a system for extending the capabilities of the template engine<\/li>\n<li>an interface to Python&#8217;s built-in\u00c2\u00a0unit test\u00c2\u00a0framework<\/li>\n<li>Django REST framework is a powerful and flexible toolkit for building Web APIs.<\/li>\n<\/ul>\n<h4><span id=\"Bundled_applications\" class=\"mw-headline\">Bundled applications:<\/span><\/h4>\n<p>The main Django distribution also bundles a number of applications in its &#8220;contrib&#8221; package, including:<\/p>\n<ul>\n<li>an extensible authentication system<\/li>\n<li>the dynamic administrative interface<\/li>\n<li>tools for generating\u00c2\u00a0RSS\u00c2\u00a0and\u00c2\u00a0Atom\u00c2\u00a0syndication feeds<\/li>\n<li>a &#8220;Sites&#8221; framework that allows one Django installation to run multiple websites, each with their own content and applications<\/li>\n<li>tools for generating\u00c2\u00a0Google Sitemaps<\/li>\n<li>built-in mitigation for\u00c2\u00a0cross-site request forgery,\u00c2\u00a0cross-site scripting,\u00c2\u00a0SQL injection,\u00c2\u00a0password cracking\u00c2\u00a0and other typical web attacks, most of them turned on by default<sup id=\"cite_ref-18\" class=\"reference\">[18]<\/sup><sup id=\"cite_ref-19\" class=\"reference\">[19]<\/sup><\/li>\n<li>a framework for creating\u00c2\u00a0GIS\u00c2\u00a0applications<\/li>\n<\/ul>\n<h4>Extensibility:<\/h4>\n<p>Django&#8217;s configuration system allows third party code to be plugged into a regular project, provided that it follows the reusable app\u00c2\u00a0conventions. More than 2500 packages\u00c2\u00a0are available to extend the framework&#8217;s original behavior, providing solutions to issues the original tool didn&#8217;t tackle: registration, search,\u00c2\u00a0API\u00c2\u00a0provision and consumption,\u00c2\u00a0CMS, etc.<\/p>\n<p>This extensibility is, however, mitigated by internal components&#8217; dependencies. While the Django philosophy implies loose coupling,\u00c2\u00a0the template filters and tags assume one engine implementation, and both the auth and admin bundled applications require the use of the internal\u00c2\u00a0ORM. None of these filters or bundled apps are mandatory to run a Django project, but reusable apps tend to depend on them, encouraging developers to keep using the official stack in order to benefit fully from the apps ecosystem.<\/p>\n<h4><span id=\"Server_arrangements\" class=\"mw-headline\">Server arrangements:<\/span><\/h4>\n<p>Django can be run in conjunction with\u00c2\u00a0Apache,\u00c2\u00a0Nginx\u00c2\u00a0using\u00c2\u00a0WSGI,\u00c2\u00a0Gunicorn, or\u00c2\u00a0Cherokee\u00c2\u00a0using flup (a Python module).\u00c2\u00a0Django also includes the ability to launch a\u00c2\u00a0FastCGI\u00c2\u00a0server, enabling use behind any web server which supports FastCGI, such as\u00c2\u00a0Lighttpd\u00c2\u00a0or\u00c2\u00a0Hiawatha. It is also possible to use other\u00c2\u00a0WSGI-compliant web servers.\u00c2\u00a0Django officially supports four database backends:\u00c2\u00a0PostgreSQL,\u00c2\u00a0MySQL,\u00c2\u00a0SQLite, and\u00c2\u00a0Oracle.\u00c2\u00a0Microsoft SQL Server\u00c2\u00a0can be used with django-mssql on\u00c2\u00a0Microsoft\u00c2\u00a0operating systems,\u00c2\u00a0while similarly external backends exist for\u00c2\u00a0IBM Db2,\u00c2\u00a0SQL Anywhere\u00c2\u00a0and\u00c2\u00a0Firebird.\u00c2\u00a0There is a\u00c2\u00a0fork\u00c2\u00a0named django-nonrel, which supports\u00c2\u00a0NoSQL\u00c2\u00a0databases, such as\u00c2\u00a0MongoDB\u00c2\u00a0and\u00c2\u00a0Google App Engine&#8217;s Datastore.<\/p>\n<p>Django may also be run in conjunction with\u00c2\u00a0Jython\u00c2\u00a0on any\u00c2\u00a0Java EE\u00c2\u00a0application server such as\u00c2\u00a0GlassFish\u00c2\u00a0or\u00c2\u00a0JBoss. In this case django-jython must be installed in order to provide\u00c2\u00a0JDBC\u00c2\u00a0drivers for database connectivity, which also can provide functionality to compile Django in to a .war suitable for deployment.<\/p>\n<p>Google App Engine\u00c2\u00a0includes support for Django version 1.x.x\u00c2\u00a0as one of the bundled frameworks.<\/p>\n<p>The above is a brief about Django. Watch this space for more updates on the latest trends in Technology.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Django\u00c2\u00a0is a\u00c2\u00a0Python-based\u00c2\u00a0free and open-source\u00c2\u00a0web framework\u00c2\u00a0that<\/p>\n","protected":false},"author":1,"featured_media":1809,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[408,680,7],"tags":[409,681,18],"class_list":["post-1807","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-django","category-open-source-web-framework","category-techtrends","tag-django","tag-open-source-web-framework","tag-technology"],"_links":{"self":[{"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/posts\/1807","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/comments?post=1807"}],"version-history":[{"count":1,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/posts\/1807\/revisions"}],"predecessor-version":[{"id":1808,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/posts\/1807\/revisions\/1808"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/media\/1809"}],"wp:attachment":[{"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/media?parent=1807"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/categories?post=1807"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/tags?post=1807"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}