<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Aniket Tiwari</title>
    <description>The latest articles on DEV Community by Aniket Tiwari (@anikettiwarime).</description>
    <link>https://dev.to/anikettiwarime</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1196705%2F31a48530-45d3-4b11-96b3-b02b3340d6ee.png</url>
      <title>DEV Community: Aniket Tiwari</title>
      <link>https://dev.to/anikettiwarime</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anikettiwarime"/>
    <language>en</language>
    <item>
      <title>🚀 Day 4: Mastering SQL 🚀</title>
      <dc:creator>Aniket Tiwari</dc:creator>
      <pubDate>Sun, 07 Jul 2024 13:59:24 +0000</pubDate>
      <link>https://dev.to/anikettiwarime/day-4-mastering-sql-38lf</link>
      <guid>https://dev.to/anikettiwarime/day-4-mastering-sql-38lf</guid>
      <description>&lt;p&gt;Today’s focus was on mastering the fundamentals of table creation and description in MySQL. Understanding these basics is crucial for efficiently managing and organizing data. Here’s a quick rundown:&lt;/p&gt;

&lt;h3&gt;
  
  
  📌 &lt;strong&gt;Creating Tables in MySQL&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;CREATE TABLE&lt;/code&gt; statement is used to create a new table in the database.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Syntax:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="k"&gt;table_name&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;column1&lt;/span&gt; &lt;span class="n"&gt;datatype&lt;/span&gt; &lt;span class="k"&gt;constraints&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;column2&lt;/span&gt; &lt;span class="n"&gt;datatype&lt;/span&gt; &lt;span class="k"&gt;constraints&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;...&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;Employees&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;EmployeeID&lt;/span&gt; &lt;span class="nb"&gt;INT&lt;/span&gt; &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;FirstName&lt;/span&gt; &lt;span class="nb"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="n"&gt;LastName&lt;/span&gt; &lt;span class="nb"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="n"&gt;BirthDate&lt;/span&gt; &lt;span class="nb"&gt;DATE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;HireDate&lt;/span&gt; &lt;span class="nb"&gt;DATE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;Salary&lt;/span&gt; &lt;span class="nb"&gt;DECIMAL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  📌 &lt;strong&gt;Describing Tables in MySQL&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;DESCRIBE&lt;/code&gt; statement provides a detailed structure of the table, including column names, data types, and constraints.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Syntax:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;DESCRIBE&lt;/span&gt; &lt;span class="k"&gt;table_name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;DESCRIBE&lt;/span&gt; &lt;span class="n"&gt;Employees&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  📌 &lt;strong&gt;Common Data Types in MySQL&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;INT&lt;/code&gt;: Integer values.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;VARCHAR(size)&lt;/code&gt;: Variable-length string with a maximum length of &lt;code&gt;size&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;DATE&lt;/code&gt;: Date values in &lt;code&gt;YYYY-MM-DD&lt;/code&gt; format.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;DECIMAL(p, s)&lt;/code&gt;: Fixed-point numbers where &lt;code&gt;p&lt;/code&gt; is the precision (total number of digits) and &lt;code&gt;s&lt;/code&gt; is the scale (number of digits after the decimal point).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🌟 &lt;strong&gt;Key Takeaways:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;CREATE TABLE&lt;/strong&gt; is foundational for database structure.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DESCRIBE&lt;/strong&gt; helps understand the schema and verify table structures.&lt;/li&gt;
&lt;li&gt;Knowing data types ensures the right kind of data storage and efficient querying.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Excited to dive deeper into SQL and explore more advanced concepts in the coming days! Stay tuned for more updates. 🚀&lt;/p&gt;

</description>
    </item>
    <item>
      <title>🚀 Exciting News for Django Developers: Upgrade from Version 4 to 5! 🚀</title>
      <dc:creator>Aniket Tiwari</dc:creator>
      <pubDate>Sat, 23 Dec 2023 19:32:59 +0000</pubDate>
      <link>https://dev.to/anikettiwarime/exciting-news-for-django-developers-upgrade-from-version-4-to-5-42j6</link>
      <guid>https://dev.to/anikettiwarime/exciting-news-for-django-developers-upgrade-from-version-4-to-5-42j6</guid>
      <description>&lt;p&gt;&lt;strong&gt;Django 5 Unveiled: Streamlining Your Development Journey&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Django, the popular Python web framework, has recently released its much-awaited version 5.0, bringing a host of exciting features and improvements to enhance developer productivity and code maintainability. Let's dive into some of the key highlights:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Simplified Form Field Rendering:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Rendering form fields in templates often involves repetitive code, making it tedious and prone to errors. Django 5 introduces field groups and field group templates, simplifying the process by encapsulating related elements like labels, widgets, help text, and errors within reusable templates.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Example:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Old way:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jinja"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;label&lt;/span&gt; &lt;span class="na"&gt;for=&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="cp"&gt;{{&lt;/span&gt; &lt;span class="nv"&gt;field.id_for_label&lt;/span&gt; &lt;span class="cp"&gt;}}&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;{{&lt;/span&gt; &lt;span class="nv"&gt;field.label&lt;/span&gt; &lt;span class="cp"&gt;}}&lt;/span&gt;&lt;span class="nt"&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
&lt;span class="cp"&gt;{{&lt;/span&gt; &lt;span class="nv"&gt;field&lt;/span&gt; &lt;span class="cp"&gt;}}&lt;/span&gt;
&lt;span class="cp"&gt;{%&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nv"&gt;field.help_text&lt;/span&gt; &lt;span class="cp"&gt;%}&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;small&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"form-text text-muted"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;{{&lt;/span&gt; &lt;span class="nv"&gt;field.help_text&lt;/span&gt; &lt;span class="cp"&gt;}}&lt;/span&gt;&lt;span class="nt"&gt;&amp;lt;/small&amp;gt;&lt;/span&gt;
&lt;span class="cp"&gt;{%&lt;/span&gt; &lt;span class="k"&gt;endif&lt;/span&gt; &lt;span class="cp"&gt;%}&lt;/span&gt;
&lt;span class="cp"&gt;{%&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="nv"&gt;error&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nv"&gt;field.errors&lt;/span&gt; &lt;span class="cp"&gt;%}&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;p&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"text-danger"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;{{&lt;/span&gt; &lt;span class="nv"&gt;error&lt;/span&gt; &lt;span class="cp"&gt;}}&lt;/span&gt;&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;span class="cp"&gt;{%&lt;/span&gt; &lt;span class="k"&gt;endfor&lt;/span&gt; &lt;span class="cp"&gt;%}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;New way (using field groups):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jinja"&gt;&lt;code&gt;&lt;span class="cp"&gt;{{&lt;/span&gt; &lt;span class="nv"&gt;field.as_field_group&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="cp"&gt;}}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Enhanced Field Choices:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Defining choices for model and form fields was limited to iterables (like lists or tuples). Django 5 expands flexibility by allowing mappings (dictionaries) or callables (functions) for defining choices, enabling dynamic generation of choices based on external data or logic.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Example:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Old way:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;SPORT_CHOICES&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;judo&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Judo&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;karate&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Karate&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="c1"&gt;# ...
&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;New way:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;SPORT_CHOICES&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Martial Arts&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;judo&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Judo&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;karate&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Karate&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Racket&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;badminton&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Badminton&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;tennis&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Tennis&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;unknown&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Unknown&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Model Fields for Computations and Generated Columns:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Developers often create custom logic for computed fields or rely on database-level features for generated columns. Django 5 introduces two new field types:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;db_default&lt;/code&gt; allows setting database-computed default values for fields.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;GeneratedField&lt;/code&gt; creates fields whose values are calculated from other fields, either stored in the database or computed on-the-fly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Example:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Old way (using database-level default):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Order&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Model&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;created_at&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DateTimeField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;auto_now_add&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;New way:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Order&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Model&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;created_at&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DateTimeField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;db_default&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;django&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;functions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Now&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
    &lt;span class="n"&gt;total_price&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DecimalField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max_digits&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;decimal_places&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;tax_amount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DecimalField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max_digits&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;decimal_places&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;generated&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;DecimalField&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Expression&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;total_price * 0.07&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;  &lt;span class="c1"&gt;# Generated field
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;4. Async View Decorators and Exception Handling:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Handling asynchronous views and potential disconnections required manual management. Django 5 expands its asynchronous support with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Additional asynchronous view decorators (&lt;code&gt;@sync_to_async&lt;/code&gt; and &lt;code&gt;@async_to_sync&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;AsyncClient&lt;/code&gt; improvements for asynchronous testing.&lt;/li&gt;
&lt;li&gt;Exception handling for asynchronous disconnections.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;5. Other Notable Improvements:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Streamlined choices for TextChoices and IntegerChoices.&lt;/li&gt;
&lt;li&gt;More intuitive handling of choices in model forms.&lt;/li&gt;
&lt;li&gt;Enhanced admin site with autocomplete for foreign keys.&lt;/li&gt;
&lt;li&gt;Extended support for geospatial operations.&lt;/li&gt;
&lt;li&gt;Improvements in messages handling.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Django 5 continues the framework's tradition of innovation and developer-centric design. These features promise to streamline development workflows, improve code readability, and embrace modern asynchronous patterns. Upgrade your projects to Django 5 and experience the benefits firsthand!&lt;/p&gt;

</description>
      <category>django</category>
      <category>django5</category>
      <category>webdev</category>
      <category>fullstack</category>
    </item>
    <item>
      <title>Building a Production-Ready Backend: Node.js, Express, and MongoDB Atlas Setup Guide (2023) - Part 1</title>
      <dc:creator>Aniket Tiwari</dc:creator>
      <pubDate>Tue, 14 Nov 2023 21:55:57 +0000</pubDate>
      <link>https://dev.to/anikettiwarime/building-a-production-ready-backend-nodejs-express-and-mongodb-atlas-setup-guide-2023-part-1-4nah</link>
      <guid>https://dev.to/anikettiwarime/building-a-production-ready-backend-nodejs-express-and-mongodb-atlas-setup-guide-2023-part-1-4nah</guid>
      <description>&lt;h2&gt;
  
  
  Initializing a Project with Folder Structure and .env Configuration
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;p&gt;Before proceeding with the backend setup, ensure that you have Node.js and npm installed on your machine.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Initialize the Project
&lt;/h3&gt;

&lt;p&gt;Start by creating a new directory for your project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;your-backend-app-name
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Navigate to the project directory in your terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;your-backend-app-name
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next generate npm project using following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm init 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or to generate an empty npm project without going through an interactive process use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm init -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To make the project compatible with ES6 import statements, add "type": "module" to your &lt;code&gt;package.json&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;This sets up a new Node.js project with default settings.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Folder Structure
&lt;/h3&gt;

&lt;p&gt;Here is the recommended folder structure for your backend application:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--c8QZrENv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o91mjlekh8b7wio4u963.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--c8QZrENv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o91mjlekh8b7wio4u963.png" alt="Folder Structure" width="755" height="516"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's break down the folder structure:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;public&lt;/strong&gt;: This folder is typically used for static assets that your server will serve, such as images, stylesheets, or client-side JavaScript files.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;src&lt;/strong&gt;: The main source code folder for your application.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;controllers&lt;/strong&gt;: Modules responsible for handling the logic of your application. Each route may have its own controller.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;db&lt;/strong&gt;: Database-related files, such as database connection setup.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;middlewares&lt;/strong&gt;: Middleware functions that can be used in your routes. Middleware functions have access to the request and response objects and can perform actions before the main handler is called.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;models&lt;/strong&gt;: Used for defining the structure of your data, such as database models or other data-related structures.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;routes&lt;/strong&gt;: Define the routes of your application. Each route typically has its own file or module within this folder, handling incoming requests, using controllers to process them, and sending responses.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;utils&lt;/strong&gt;: Utility functions or modules that can be used across different parts of your application.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;app.js&lt;/strong&gt;: The main application file where you set up your Express application, define middleware, and connect routes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;constants.js&lt;/strong&gt;: A file to store constants used throughout your application.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;index.js&lt;/strong&gt;: The entry point of your application, typically responsible for starting your server.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;.env&lt;/strong&gt;: A configuration file for storing environment variables, which can include sensitive information or configuration settings for your application.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;.env.sample&lt;/strong&gt;: A template for the &lt;code&gt;.env&lt;/code&gt; file, providing guidance on what variables need to be set and their expected values. This file can be committed to version control to assist other developers in setting up their environments.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;.gitignore&lt;/strong&gt;: Specifies files and folders that should be ignored by version control, commonly including &lt;code&gt;node_modules&lt;/code&gt; (where Node.js packages are installed) and &lt;code&gt;.env&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;.prettierignore&lt;/strong&gt;: Specifies files and folders that should be ignored by the Prettier code formatter.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;.prettierrc&lt;/strong&gt;: Configuration file for Prettier, defining code formatting rules.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;package.json&lt;/strong&gt;: Contains metadata about your project and the dependencies it uses, including scripts for common tasks such as starting the server or running tests.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 3: .env Configuration
&lt;/h3&gt;

&lt;p&gt;Install the &lt;code&gt;dotenv&lt;/code&gt; package to load environment variables from the &lt;code&gt;.env&lt;/code&gt; file. Additionally, set up npm scripts for starting the server in both production and development environments.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Install the &lt;code&gt;dotenv&lt;/code&gt; package and include it as a dependency:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   npm &lt;span class="nb"&gt;install &lt;/span&gt;dotenv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install the &lt;code&gt;nodemon&lt;/code&gt; package and include it as a devDependency:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-D&lt;/span&gt; nodemon
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Update your &lt;code&gt;package.json&lt;/code&gt; file with the following scripts:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"start"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"node src/index.js"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"dev"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"nodemon -r dotenv/config --experimental-json-modules src/index.js"&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The "dev" script uses &lt;code&gt;nodemon&lt;/code&gt; with the &lt;code&gt;dotenv&lt;/code&gt; configuration to enable automatic reloading during development.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a &lt;code&gt;.env&lt;/code&gt; file in your project root and add your configuration variables:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   # .env

   KEY=VALUE
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace &lt;code&gt;KEY&lt;/code&gt; and &lt;code&gt;VALUE&lt;/code&gt; with your actual environment variables and their values.&lt;/p&gt;

&lt;p&gt;In conclusion, this structure provides a modular and organized foundation for building a Node.js backend application.&lt;/p&gt;

&lt;h4&gt;
  
  
  In next steps we are going to configure MongoDB Atlas and additional steps depending on your project requirements.
&lt;/h4&gt;

</description>
      <category>backenddevelopment</category>
      <category>node</category>
      <category>productionready</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
