<?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: kubona Martin Yafesi</title>
    <description>The latest articles on DEV Community by kubona Martin Yafesi (@kubona_my).</description>
    <link>https://dev.to/kubona_my</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%2F672012%2Fe4597f1e-d17a-4110-95d6-8b3c4c27a5a0.png</url>
      <title>DEV Community: kubona Martin Yafesi</title>
      <link>https://dev.to/kubona_my</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kubona_my"/>
    <language>en</language>
    <item>
      <title>The Complete Guide to Setting Up Postgresql on Windows 11 and WSL2</title>
      <dc:creator>kubona Martin Yafesi</dc:creator>
      <pubDate>Sat, 26 Apr 2025 17:01:42 +0000</pubDate>
      <link>https://dev.to/kubona_my/the-complete-guide-to-setting-up-postgresql-on-windows-11-and-wsl2-4fam</link>
      <guid>https://dev.to/kubona_my/the-complete-guide-to-setting-up-postgresql-on-windows-11-and-wsl2-4fam</guid>
      <description>&lt;p&gt;TL;DR&lt;br&gt;
Start on your data engineering journey by installing WSL2 with Ubuntu on Windows 11 and setting up Postgresql in the Linux environment. The Postgresql set-up will accept both internal and external connections. Just this setup is enough to get started with data engineering&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Modern data engineering stacks use PostgreSQL as the standard for relational databases. PostgreSQL offers direct installation on Windows, Linux, MacOS, BSD, and Solaris Operating systems. However most professional data engineers often prefer running it in Linux for better performance, and similarity with production environments, and less compatibility issues.&lt;/p&gt;

&lt;p&gt;70% of computer users around the world are using the Windows Operating system. While this is the case, 80% of production servers (Computers that power the apps and websites you use every day) are running on Linux. Naturally as humans love visually appealing systems which is why our number one choice for Operating system will be windows. Linux on the other end is mostly used through the Command Line Interface (CLI) which might not be visually appealing. With the CLI, you run a series of commands to get stuff done on your computer. However recent developments in the Linux Operating System have seen the introduction of the Graphical User Interface (GUI) to enable users not bother with the command line and instead adopt the approach to tap and click icons just like in Windows. But since 80% of the production servers is powered by Linux, and without GUIs, we are somehow left with no choice but to figure out a way of learning commands behind the GUIs. The challenge presents itself to developers, data engineers, analysts as to whether they need to get another computer that can run separately with Linux. Or even consider Dual Booting (While computer boots, you chose the OS you want to use ). The quick win without breaking the bank is using the Windows Subsystem for Linux (WSL2).&lt;/p&gt;

&lt;p&gt;WLS2 gives us the best of both worlds: Windows' user-friendly interface with Linux's robust developer environment. By the end of this guide, you'll have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  A fully functional PostgreSQL server running in WSL2&lt;/li&gt;
&lt;li&gt;  External connectivity configured for Windows tools&lt;/li&gt;
&lt;li&gt;  A production-like environment for local development and testing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's turn your Windows 11 machine into a professional-grade PostgreSQL development environment!&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites ( What we actually Need to get up and running )
&lt;/h2&gt;

&lt;p&gt;Before starting, ensure you have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Windows 11&lt;/strong&gt; Home or Pro edition (Home is sufficient)&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Virtualization enabled&lt;/strong&gt; in your BIOS/UEFI settings&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Administrative access&lt;/strong&gt; to your Windows machine&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Internet connection&lt;/strong&gt; for downloading packages&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;15-20 minutes&lt;/strong&gt; of your time&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Definite Step by Step Guide
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1: Enable WSL2 &amp;amp; Install Ubuntu-22.04
&lt;/h3&gt;

&lt;p&gt;To install WSL2, simply open Powershell on your Windows 11 device as Administrator and run the following command to install a specific Linux distribution like Ubuntu-22.04&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;wsl --install -d Ubuntu-22.04
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;If you want to install any other Linux distributions available in WSL2, you can consider checking them out by running this command in Powershell&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;wsl --list --online
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;or &lt;code&gt;wsl -l -o&lt;/code&gt;  &lt;/p&gt;

&lt;p&gt;A full detailed guide on setting up WSL2 and Ubuntu-22.04 is available at &lt;a href="https://learn.microsoft.com/en-us/windows/wsl/install" rel="noopener noreferrer"&gt;Install WSL | Microsoft Learn&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqn4ehgmlkr8nb1waqvct.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqn4ehgmlkr8nb1waqvct.png" alt="Ubuntu running successfully in WSL2" width="800" height="597"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Download PostgreSQL Installer for Windows
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Download website
&lt;/h4&gt;

&lt;p&gt;Navigate to &lt;a href="https://www.postgresql.org/download/windows/" rel="noopener noreferrer"&gt;https://www.postgresql.org/download/windows/&lt;/a&gt; and install Postgresql for windows&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click on &lt;strong&gt;"Download the installer"&lt;/strong&gt; (it redirects to EnterpriseDB).&lt;/li&gt;
&lt;li&gt;Choose the latest stable version (e.g., PostgreSQL 16 or 15) for your Windows.&lt;/li&gt;
&lt;li&gt;Download the installer .exe file.
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn5ufln17vk38mm6c0ei2.png" alt="The PostgreSQL installer after download" width="800" height="287"&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Install PostgreSQL on Windows&lt;/strong&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Run the installer:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft92kf00yg9tso9lfzzk8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft92kf00yg9tso9lfzzk8.png" alt="Running the windows installer for postgresql" width="800" height="627"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Click Next&lt;/strong&gt; → Choose an installation directory (default is OK).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjrgrnujrm2ij6c7v458o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjrgrnujrm2ij6c7v458o.png" alt="Choosing the installation directory for postgresql" width="800" height="614"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Select Components&lt;/strong&gt; (keep defaults: PostgreSQL Server, pgAdmin, StackBuilder, Command Line Tools).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F17cvq2b0lghuev1wbq5d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F17cvq2b0lghuev1wbq5d.png" alt="Selecting the components to install for postgresql" width="800" height="621"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Set a Password&lt;/strong&gt; for the PostgreSQL &lt;strong&gt;superuser&lt;/strong&gt; (postgres). (Important! Remember this password.)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fksniifjk778k6pgm7eqy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fksniifjk778k6pgm7eqy.png" alt="setting the password for PostgreSQL installation" width="800" height="625"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Set Port Number&lt;/strong&gt;: default is 5432.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff7vy8rojyxbv2ewhn871.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff7vy8rojyxbv2ewhn871.png" alt="setting the port number for PostgreSQL installation" width="800" height="626"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Set Locale&lt;/strong&gt;: default is OK.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxjmwpbmbop64n9fko685.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxjmwpbmbop64n9fko685.png" alt="Setting the locale for PostgreSQL installation" width="800" height="613"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Install&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;✅ After installation, it starts Postgresql as a &lt;strong&gt;Windows service&lt;/strong&gt; automatically.&lt;/p&gt;

&lt;p&gt;You can ignore the StackBuilder Wizard&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc9p06slzh2r9dx921643.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc9p06slzh2r9dx921643.png" alt="Ignoring the StackBuilder wizard for Postgresql installation" width="800" height="537"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  pgAdmin Setup
&lt;/h4&gt;

&lt;p&gt;After installation, you also get &lt;strong&gt;pgAdmin&lt;/strong&gt; installed.&lt;/p&gt;

&lt;p&gt;Open &lt;strong&gt;pgAdmin&lt;/strong&gt; → set a Master Password → login to your server using:&lt;/p&gt;

&lt;p&gt;Username: postgres&lt;/p&gt;

&lt;p&gt;Password: (the one you set during install)&lt;/p&gt;

&lt;p&gt;Well done, you have successfully installed Postgresql on your Windows 11 Computer&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqc348kpx5twvw9q3itse.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqc348kpx5twvw9q3itse.png" alt="PgAdmin lauches after PostgreSQL installation" width="800" height="343"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Install PostgreSQL on WSL Ubuntu
&lt;/h3&gt;

&lt;p&gt;Now that Postgress is installed and running on Windows we can also set it up for our wsl environment. This assumes that you have completed step number 1: Enabling WSL2 and installation of Ubuntu-22.04,&lt;/p&gt;

&lt;p&gt;Now let's install PostgreSQL:&lt;/p&gt;

&lt;h4&gt;
  
  
  Update your package lists:
&lt;/h4&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt update &amp;amp;&amp;amp; sudo apt upgrade -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h4&gt;
  
  
  Install PostgreSQL and its extensions:
&lt;/h4&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt install postgresql postgresql-contrib -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h4&gt;
  
  
  Verify installation:
&lt;/h4&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;psql --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;You should see output like psql (PostgreSQL) 16.8 (version may vary).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fczocd5g3uznlwtjhbgtm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fczocd5g3uznlwtjhbgtm.png" alt="Postgresql successfully installed on Ubuntu wsl2" width="800" height="237"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Start PostgreSQL service:
&lt;/h4&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo service postgresql start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h4&gt;
  
  
  Check status:
&lt;/h4&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo service postgresql status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyx32ul9si13m5jwxxi3q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyx32ul9si13m5jwxxi3q.png" alt="Postgresql active and running on ubuntu wsl2" width="800" height="216"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Create a PostgreSQL User Matching Your WSL Username
&lt;/h4&gt;

&lt;p&gt;Get your WSL username:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Whoami

sudo -u postgres createuser --interactive

# Enter username: kubona

# Shall the new role be a superuser? (y/n): y

Set a password (optional):
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h4&gt;
  
  
  Setup .bashrc to Default to postgres DB with Your User
&lt;/h4&gt;

&lt;p&gt;Open up the .bashrc using the nano editor&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nano ~/.bashrc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Add the following at the bottom:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export PGUSER=kubona

export PGDATABASE=postgres
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Apply changes by exiting the nano editor( Ctrl +X , Y, Enter ) then run&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;source ~/.bashrc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now you can run the psql command on the terminal to access the postgres CLI interface&lt;/p&gt;

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

&lt;/div&gt;
&lt;h4&gt;
  
  
  Edit postgresql.conf to Allow External Connections (for pgAdmin)
&lt;/h4&gt;

&lt;p&gt;Edit the config file:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo nano /etc/postgresql/16/main/postgresql.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Find and set the line starting with # listen_addresses = ‘localhost’ and then change it to ( Remove the # at the beginning;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;listen_addresses = '*'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;




&lt;h4&gt;
  
  
  Update pg_hba.conf to Allow External Authentication
&lt;/h4&gt;

&lt;p&gt;Edit pg_hba.conf:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo nano /etc/postgresql/16/main/pg_hba.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Add this line at the bottom:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;host  all  all  0.0.0.0/0  md5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h4&gt;
  
  
  Restart PostgreSQL to Apply Changes
&lt;/h4&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo service postgresql restart
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h4&gt;
  
  
  Find WSL IP Address to Use in pgAdmin
&lt;/h4&gt;

&lt;p&gt;Get WSL's IP address (from Windows PowerShell or CMD):&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;wsl hostname -I
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;This might return something like 172.27.94.100. Use this as the &lt;strong&gt;host&lt;/strong&gt; in pgAdmin.&lt;/p&gt;




&lt;h3&gt;
  
  
  Step 4: Add Connection in pgAdmin on Windows
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Open pgAdmin
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt; Go to &lt;strong&gt;Add New Server&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt; In the &lt;strong&gt;General&lt;/strong&gt; tab:&lt;/li&gt;
&lt;li&gt;  Name: WSL PostgreSQL&lt;/li&gt;
&lt;li&gt; In the &lt;strong&gt;Connection&lt;/strong&gt; tab:&lt;/li&gt;
&lt;li&gt;  Host:  (e.g., 172.27.94.100)&lt;/li&gt;
&lt;li&gt;  Port: 5432&lt;/li&gt;
&lt;li&gt;  Maintenance DB: postgres&lt;/li&gt;
&lt;li&gt;  Username: kubona&lt;/li&gt;
&lt;li&gt;  Password: yourpassword&lt;/li&gt;
&lt;li&gt;  ✅ Save Password&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Click &lt;strong&gt;Save&lt;/strong&gt; — it should connect&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 5: Connect from WSL and Prepare for Windows Tools
&lt;/h3&gt;

&lt;p&gt;Let's verify everything works within WSL first:&lt;/p&gt;

&lt;h4&gt;
  
  
  Connect to PostgreSQL as the postgres user:
&lt;/h4&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo -u postgres psql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h4&gt;
  
  
  Create a test database:
&lt;/h4&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sql

CREATE DATABASE testdb;

\c testdb

CREATE TABLE test (id serial PRIMARY KEY, name varchar(50));

INSERT INTO test (name) VALUES ('Test connection successful!');

SELECT * FROM test;

\q
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;You should see your test data displayed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;A pat on the back for making it till this far, Kudos!!&lt;/p&gt;

&lt;p&gt;You've successfully set up a professional PostgreSQL environment on Windows 11 using WSL2. This hybrid approach gives you the development environment used by data engineers while keeping the Windows features you enjoy.&lt;/p&gt;

&lt;h3&gt;
  
  
  Next in Our Data Engineering Foundations Series
&lt;/h3&gt;

&lt;p&gt;Now that you have PostgreSQL running on WSL2, our next article will show you how to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Configure DBeaver as your PostgreSQL GUI client&lt;/li&gt;
&lt;li&gt;  Set up database users and permissions&lt;/li&gt;
&lt;li&gt;  Create your first data engineering project schema&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Timing will never be perfect for you to start, today is here just get started!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Do you have any questions, challenges or recommendations, feel free to engage in the comments section below.&lt;/p&gt;

</description>
      <category>dataengineering</category>
      <category>beginners</category>
      <category>opensource</category>
      <category>learning</category>
    </item>
    <item>
      <title>Docker 101!</title>
      <dc:creator>kubona Martin Yafesi</dc:creator>
      <pubDate>Tue, 17 Aug 2021 13:17:44 +0000</pubDate>
      <link>https://dev.to/kubona_my/docker-101-124e</link>
      <guid>https://dev.to/kubona_my/docker-101-124e</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqd8q1br8y9e1doo0a497.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqd8q1br8y9e1doo0a497.jpg" alt="docker-image" width="474" height="266"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Welcome dear reader to yet another learning opportunity. I applaud you for the commitment devoted to become a better version of yourself. Always here to remind you,&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Every master was once a beginner&lt;br&gt;
Whatever tech stack you choose to follow, do not underestimate the small beginnings! &lt;code&gt;Stick to it!&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Since we started this learning journey together, we have looked at a few principles and mastered some techniques, absolutely beginner level. Some of these have been;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://dev.tolink%20here"&gt;Python Basics, Pythons 101!&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://dev.tolink%20here"&gt;Introduction to Python Functions&lt;/a&gt;&lt;br&gt;
Feel free to check them out. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F39tg85klaorj3ynnxip2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F39tg85klaorj3ynnxip2.png" alt="Getting-started-docker" width="800" height="333"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Diving right in …
&lt;/h2&gt;

&lt;p&gt;We are getting started with our topic for the day. Hope you are refreshed and have a clear mind. This article assumes no prior experience with Docker or any of the terms used, sit back, read along and enjoy. &lt;/p&gt;

&lt;p&gt;To explain what Docker is, we will first dig a few decades back before the docker world. Problem scenarios will be used to understand how docker came about, why it is important in your software development work flow, and basic usage examples.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problems before docker.
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Scenario 1
&lt;/h3&gt;

&lt;p&gt;You have just landed your first tech developer job, before anytime elapses, your very first assignment rolls in from the Chief Technical Officer. &lt;/p&gt;

&lt;h4&gt;
  
  
  The assignment...
&lt;/h4&gt;

&lt;blockquote&gt;
&lt;p&gt;You are required to develop an application for a very needy segment of the population, the blind!!.  &lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  How you start, lets see!!
&lt;/h4&gt;

&lt;p&gt;From your expertise, basing on the app requirements, you decide on a set of tools that will enable you complete the task before hand.&lt;br&gt;
Your application say will require these dependencies to run;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An operating system&lt;/li&gt;
&lt;li&gt;Python&lt;/li&gt;
&lt;li&gt;A database like Postgres&lt;/li&gt;
&lt;li&gt;Flask&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Installing app dependencies manually&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Task before hand is installing all these tools to your local system. Phew!!! That looks tiresome already. Remember while installing them manually, you are only getting versions specific to your machine/laptop. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Coding, collaborations, testing&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So until now, you are very comfortable coding the real-world application that solves a pressing need in your community. &lt;br&gt;
Your boss has given you a deadline to complete the first module of the application. Yikes!!! Deadline day is here and the module is complete. You send the code over to the operations team, to test the application. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;A few days later ...&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Operations Team manager&lt;/code&gt;: &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Hey, The code you sent me cannot run on my system, no app!!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;A big problem arises&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Can you see it?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Why did that happen? Well simply put, you used dependencies specific to your personal system, not universal. Another developer to test out your application will also need to manually install these dependencies on his personal system, and the chain continues that way. Along the way, there are more chances of your app breaking,....Oh no!!!&lt;/p&gt;

&lt;h3&gt;
  
  
  Scenario 2
&lt;/h3&gt;

&lt;p&gt;You have built out your first application, but would like to test it out using a different operating system. How do you go about that? &lt;br&gt;
After making some consultations from your workmates, news has it that its very possible through &lt;code&gt;Virtual Machines&lt;/code&gt;.&lt;br&gt;
Hurray, you feel great utilizing the concept of &lt;em&gt;Virtualization&lt;/em&gt;!!&lt;br&gt;
Virtualization has greatly aided developers in their ability to construct and produce from their computers as if they were separate platforms. They can use virtual computers to construct completely virtual operating systems in which to operate and build.&lt;/p&gt;

&lt;p&gt;A developer can run a virtual Windows computer on their Macbook to evaluate the operation of a Windows-constructed application. Running a virtual machine is more cheaper and easier than buying a brand new one. I guess it's a really great option saving you a couple of thousand dollars.&lt;/p&gt;

&lt;p&gt;Look at the difference between Docker and Virtual Machines from the illustration below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgwm6yfigwrz8p80a95gp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgwm6yfigwrz8p80a95gp.png" alt="virual-machines-or-docker" width="800" height="364"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Problems arising ...&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As you enjoy trying out different virtual machines on your local device, you start noticing a few hiccups arising. These could be and not limited to;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Exhaustion of computing resources like ram, storage&lt;/li&gt;
&lt;li&gt;Network congestion&lt;/li&gt;
&lt;li&gt;Marginal app performance inside the Virtual machine&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With the virtual machines installed, they share the same hardware resources with your normal operating system. So the issue of scalability arises since your virtual machine keeps expanding but not your hardware performance. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Do you notice that problem now?&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Leaving problems alone...
&lt;/h3&gt;

&lt;p&gt;There are quite a number of scenarios to list out in regards to traditional Software development practices. But I just highlighted on a few to whet our appetite and understand how &lt;code&gt;Docker&lt;/code&gt; comes in the picture. Having understood those challenges, am sure your mind is sparked to solution mode already. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Let us refocus&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjq9ythpb5vo694dzrpds.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjq9ythpb5vo694dzrpds.png" alt="REFOCUS-docker" width="800" height="333"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Who comes to our rescue? Docker !!!&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Docker?
&lt;/h2&gt;

&lt;p&gt;Docker is a computer program that accelerates the way you build, share and run modern applications. Essentially it solves all the problem scenarios we have discussed above.&lt;br&gt;
Docker takes away tedious, monotonous configuration procedures and is utilized across the development lifecycle for quick, simple and portable application development both on desktop and cloud.&lt;br&gt;
In other words, while you use docker development becomes more efficient and predictable. &lt;/p&gt;

&lt;p&gt;Docker is a tool for building, running, and deploying containerized applications. An application's code, libraries, tools, dependencies, and other files are all contained in a Docker image. When a user executes an image, it might turn into one or more containers.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Specifically?
&lt;/h2&gt;

&lt;p&gt;Okay to answer this question, I will split the concept into 3 ways;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Build&lt;/li&gt;
&lt;li&gt;Share&lt;/li&gt;
&lt;li&gt;Run&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb2pvxhyamhlw6xjrd9z9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb2pvxhyamhlw6xjrd9z9.png" alt="Build-ship-run" width="700" height="345"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Build
&lt;/h3&gt;

&lt;p&gt;Everything in Docker is based on images and containers. &lt;br&gt;
A Docker image is a file that a Docker container uses to run programs. Docker images, like a template, serve as a collection of instructions for constructing a Docker container. When utilizing Docker, Docker images also serve as a starting point. In virtual machine (VM) settings, an image is similar to a snapshot.&lt;/p&gt;

&lt;p&gt;Docker images include several layers, each of which is derived from the one before it but differs from it. The layers reduce disk use while boosting reusability and speeding up Docker builds. Image layers are read-only files as well. A written layer is put on top of the unchangeable images once a container is formed, enabling a user to make modifications.&lt;/p&gt;

&lt;p&gt;Official images are those created by Docker, and community images are those created by Docker users. Docker applications are monitored by the &lt;em&gt;CoScale&lt;/em&gt; agent, which is an official Docker image.&lt;br&gt;
With confidence, leverage Images from the Docker Hub image repository that are Docker verified and official. As a basis for your application development, use these reliable and secure images.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4t1kksqui8x4s31wyhtq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4t1kksqui8x4s31wyhtq.png" alt="docker-official-images" width="800" height="422"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Code, config files, environment variables, libraries, and runtimes are all included in a Docker image for running a containerized application. The image may be run as a Docker container once it has been deployed to a Docker environment. Docker run builds a container based on a specified image.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft6miwbgf8t74vqmdbpre.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft6miwbgf8t74vqmdbpre.jpg" alt="docker-build" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In simple terms, you build your image that contains all the libraries, and dependencies for your app and upon running that image you generate a container which is an instance of your application. You can make multiple versions of your application.&lt;/p&gt;

&lt;p&gt;For example;&lt;br&gt;
You can build an image for your flask project based on ;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Python &lt;/li&gt;
&lt;li&gt;Flask &lt;/li&gt;
&lt;li&gt;MySQL&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When you run that image you create an instance of your application which you can share to anyone and will run without any issues.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Do you see how much Docker saves you!!&lt;/em&gt; &lt;/p&gt;

&lt;h3&gt;
  
  
  Share
&lt;/h3&gt;

&lt;p&gt;Once you have built your image you are able to share it to the world and anyone can use it (&lt;em&gt;if you choose to&lt;/em&gt;). &lt;br&gt;
You may deploy containers and test and share images from private or public repositories, such as those in the Docker Hub cloud registry service. Image management and access control are also available through Docker Hub's Docker Trusted Registry.&lt;/p&gt;

&lt;p&gt;Users may use the docker push command to publish custom images to the Docker Hub and generate new images from existing ones. Docker offers comments to authors prior to publication to ensure the quality of community images. The author is responsible for updating the image once it has been published.&lt;/p&gt;

&lt;p&gt;With Docker it is easy to collaborate with team members and other developers to come up with new ideas, and simply upload images to Docker Hub. It is even possible to have roles-based access control and Docker Hub Audit Logs. That makes it easier customize developer access to images and gain insight into activity history.&lt;/p&gt;

&lt;h3&gt;
  
  
  Run
&lt;/h3&gt;

&lt;p&gt;Remember we said that when you run the &lt;code&gt;docker run&lt;/code&gt; command, you are making an instance of your application. You can make as many instances as you like, for example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Instance for development&lt;/li&gt;
&lt;li&gt;Instance for testing&lt;/li&gt;
&lt;li&gt;Instance for staging&lt;/li&gt;
&lt;li&gt;Instance for production (&lt;em&gt;One being used by application users&lt;/em&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3riupfo9kigmmg1fsr9h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3riupfo9kigmmg1fsr9h.png" alt="docker-containers" width="800" height="639"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So the concept is to deliver numerous apps with ease, and have them operate the same way in all of your settings - desktop or cloud-native - including design, testing, staging, and production.&lt;/p&gt;

&lt;h4&gt;
  
  
  How do we do that?
&lt;/h4&gt;

&lt;p&gt;It is really simple, Deploy your applications in separate containers independently and in different languages. Reduce the risk of conflict between languages, libraries or frameworks. &lt;/p&gt;

&lt;p&gt;Using the ease of Docker Compose CLI, you can deploy your apps locally and in the cloud with AWS ECS, Azure ACI, and Google GKS with just one command.&lt;/p&gt;

&lt;p&gt;Yes!!! That is it about Docker. Hope you have learnt some concepts about what Docker is?&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started Guide.
&lt;/h2&gt;

&lt;p&gt;Docker is a really great tool to include in your software development workflow. &lt;/p&gt;

&lt;p&gt;To have a more whetting experience about docker, please refer to the guide.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.docker.com/get-started" rel="noopener noreferrer"&gt;Getting-Started-With-Docker&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Without installing Docker on your system, you can leverage the online play ground and practice how to use Docker Images and containers. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.docker.com/play-with-docker" rel="noopener noreferrer"&gt;Play-with-Docker&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Congratulations upon finishing the article. I trust that you have learnt something. &lt;/p&gt;

&lt;h2&gt;
  
  
  How was the article?
&lt;/h2&gt;

&lt;p&gt;I love learning with the friends I share content with. Are there any insights you have about the article? Any additional features/concepts that would have been of real value to the article? Whatever it is, please share in the discussion section.&lt;/p&gt;

&lt;p&gt;For now... I tap out. Enjoy yourself and see you next time.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/PAflk22toszMlnzEdN/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/PAflk22toszMlnzEdN/giphy.gif" width="270" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>beginners</category>
      <category>docker</category>
    </item>
    <item>
      <title>Dealing with Environment Variables in Flask</title>
      <dc:creator>kubona Martin Yafesi</dc:creator>
      <pubDate>Tue, 10 Aug 2021 16:00:05 +0000</pubDate>
      <link>https://dev.to/kubona_my/dealing-with-environment-variables-in-flask-o1</link>
      <guid>https://dev.to/kubona_my/dealing-with-environment-variables-in-flask-o1</guid>
      <description>&lt;p&gt;Welcome to yet another article. Thanks for being a dedicated reader. More knowledge unto you, more skills learnt, and a better you. Before we begin on today's article, we will just have a brief recap of what we have learned over the course of time together.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3fe3c7avfr87u9k26n8a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3fe3c7avfr87u9k26n8a.png" alt="recap-image" width="800" height="333"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Python?
&lt;/h2&gt;

&lt;p&gt;Python is a widely-used, interpreted, object-oriented, and high-level programming language with dynamic semantics, used for general-purpose programming.&lt;br&gt;
It was created by Guido van Rossum as a 'hobby' programming project. &lt;/p&gt;
&lt;h2&gt;
  
  
  Why do we love Python?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Because it is an easy and intuitive language;&lt;/li&gt;
&lt;li&gt;Open source programming language. As a result, everyone may contribute to its growth;&lt;/li&gt;
&lt;li&gt;Code that is as simple to comprehend as plain English;&lt;/li&gt;
&lt;li&gt;Appropriate for day-to-day work, with quick development times&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  What is Python used for?
&lt;/h2&gt;

&lt;p&gt;Python has its application domains in many areas and these are but not limited to;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Web Applications&lt;/li&gt;
&lt;li&gt;Data Science&lt;/li&gt;
&lt;li&gt;Mobile Applications&lt;/li&gt;
&lt;li&gt;Big Data&lt;/li&gt;
&lt;li&gt;Artificial Intelligence&lt;/li&gt;
&lt;li&gt;Automation &lt;/li&gt;
&lt;li&gt;Testing&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To have a more detailed Introduction to Python, please feel free to check out this resource. &lt;a href="https://dev.to/kubona_my/python-basics-pythons-101-dj2"&gt;Python Basics, Pythons 101!&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once that article has been read, we have a look at some concepts in Python worth remembering. These may not be explained exhaustively for beginners but gives a refresher to intermediate and expert python programmers. Even beginners can relate, good news!!&lt;/p&gt;
&lt;h3&gt;
  
  
  Data Types
&lt;/h3&gt;

&lt;p&gt;Literals are data whose values are decided by the literal itself, which Python provides out of the box. &lt;/p&gt;

&lt;p&gt;Common literals in Python include;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Numeric literals&lt;/li&gt;
&lt;li&gt;Strings literals&lt;/li&gt;
&lt;li&gt;Special literal None&lt;/li&gt;
&lt;li&gt;Boolean literals&lt;/li&gt;
&lt;li&gt;Collection literals&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In simple terms, literals are the raw data that are assigned to variables or constants while programming.&lt;/p&gt;
&lt;h3&gt;
  
  
  Arithmetic operations in Python
&lt;/h3&gt;

&lt;p&gt;Python supports out of the box support for arithmetic operations. With it you can perform these operations using expressions and operators. &lt;/p&gt;
&lt;h3&gt;
  
  
  Variables
&lt;/h3&gt;

&lt;p&gt;A variable is a named location reserved to store values in the memory.&lt;/p&gt;

&lt;p&gt;Whenever you want to store results from operations, use a container called a &lt;em&gt;variable&lt;/em&gt; to store them.  When naming variables, make sure you follow the &lt;strong&gt;PEP Standards&lt;/strong&gt; defined here, &lt;a href="https://www.python.org/dev/peps/pep-0008/" rel="noopener noreferrer"&gt;PEP 8 --Style Guide for Python Code&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Comments
&lt;/h3&gt;

&lt;p&gt;Comments can be used to add more information to your code. At runtime, they are removed. Human readers are addressed by the information left in source code. A comment in Python is a line of text that starts with &lt;code&gt;#&lt;/code&gt; for single line and &lt;code&gt;"""&lt;/code&gt; for multi-line comments&lt;/p&gt;
&lt;h3&gt;
  
  
  Functions
&lt;/h3&gt;

&lt;p&gt;A function is a group of related statements that perform a given task. So whenever you call a function, those statements will perform that task, however many times you call the function.&lt;/p&gt;

&lt;p&gt;Functions help us as programmers to;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Avoid code repetitions&lt;/li&gt;
&lt;li&gt;Have cleaner and readable code&lt;/li&gt;
&lt;li&gt;Decompose large problems into small chunks. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are 3 major types of functions these are;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In-built functions&lt;/li&gt;
&lt;li&gt;User defined functions&lt;/li&gt;
&lt;li&gt;Pre-Installed module functions&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For a more detailed guide on functions, please check out this resource. &lt;a href="https://dev.to/kubona_my/introduction-to-python-functions-ije"&gt;Introduction to Python Functions&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fms0xa64zooklrcvzywes.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fms0xa64zooklrcvzywes.png" alt="Recap-done-image" width="800" height="333"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Great, welcome back from that recap about Python. Remember, the more you familiarize yourself with what Python is and how you use it, the better programmer you become at Python. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Every expert was once a beginner.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;
  
  
  Web development In Python
&lt;/h2&gt;

&lt;p&gt;So one of the application domains of Python is &lt;strong&gt;Web development&lt;/strong&gt;. You can use it to make powerful and fast web applications. In so making, a number of tools and frameworks have been developed to aid web development in Python. &lt;/p&gt;

&lt;p&gt;Some of these are but not limited to;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Django&lt;/li&gt;
&lt;li&gt;Flask&lt;/li&gt;
&lt;li&gt;Pyramid&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(&lt;em&gt;The picture below shows a list of web frameworks using Python&lt;/em&gt;) &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn4zmujxd51z3ne0de1e8.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn4zmujxd51z3ne0de1e8.jpg" alt="web-frameworks-python" width="800" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Our focus will be on the Flask framework. For an Introduction to FLASK, please checkout their official documentation.&lt;br&gt;
 &lt;a href="https://flask.palletsprojects.com/en/2.0.x/" rel="noopener noreferrer"&gt;Official Flask Documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And for a quick overview on how to get started with Python Web development, consider looking into, &lt;a href="https://dev.to/grayhat/getting-started-with-python-web-development-1jl9"&gt;Getting Started with Python Web Development using FLASK&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you have mastered the basic overview of flask, we will dive into the topic of the day. Phew!!! What an introduction !!! Hope you are enjoying the article. Let us refocus now. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqvuk6gt4q5y404rw6lfs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqvuk6gt4q5y404rw6lfs.png" alt="refocus-image" width="800" height="333"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Given a minimal Flask application, such as;&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="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;flask&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Flask&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Flask&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;__name__&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nd"&gt;@app.route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;/&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;hello_world&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Hello World, dear Friend!&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;


&lt;span class="nd"&gt;@app.route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;/page/&amp;lt;int:page_num&amp;gt;&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;content&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;page_num&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;&amp;lt;h1&amp;gt;Yoo.. It is your page &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;page_num&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;__main__&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;host&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;''&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;port&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;''&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;debug&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;The minimal application can be run following the steps below, &lt;em&gt;(as you might be familiar)&lt;/em&gt;, &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;On Bash&lt;/strong&gt;&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;export &lt;/span&gt;&lt;span class="nv"&gt;FLASK_APP&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;app.py
flask run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Other scenarios you might want to specify the host and port number, environment, debug mode etc.  for which you want your flask application to run, you would have to include all that into the &lt;code&gt;export command&lt;/code&gt; above. &lt;br&gt;
That can become tedious over time as you develop your cool project, pressing up arrow key many times to retrace the export command (&lt;em&gt;bash users, you know what I mean&lt;/em&gt;). &lt;/p&gt;

&lt;p&gt;Our goal is to save some time and when running our flask application, we simply do; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;On Bash&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;flask run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The variables that we add to the &lt;code&gt;export command&lt;/code&gt; are known as &lt;strong&gt;environment variables&lt;/strong&gt;. These variables are used by your flask application to serve your project. &lt;/p&gt;

&lt;h3&gt;
  
  
  Examples of environment variables include;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;FLASK_ENV&lt;/li&gt;
&lt;li&gt;FLASK_DEBUG.&lt;/li&gt;
&lt;li&gt;FLASK_RUN_EXTRA_FILES &lt;/li&gt;
&lt;li&gt;FLASK_RUN_HOST&lt;/li&gt;
&lt;li&gt;FLASK_RUN_PORT &lt;/li&gt;
&lt;li&gt;FLASK_RUN_CERT&lt;/li&gt;
&lt;li&gt;FLASK_RUN_KEY &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Those are default flask environment variables defined by the framework. If not specified, they use their default values.&lt;/p&gt;

&lt;h3&gt;
  
  
  User defined variables
&lt;/h3&gt;

&lt;p&gt;Also, if you wanted to connect your application to a database, you would have to hard code your credentials into your python code, &lt;strong&gt;which is not recommended&lt;/strong&gt;. &lt;br&gt;
A simple example would be;&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="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;flask&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Flask&lt;/span&gt;
&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Flask&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;__name__&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;MYSQL_USER&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;your_username&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;MYSQL_HOST&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;localhost&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;MYSQL_DB&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;my_appdb&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;MYSQL_PASSWORD&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;your_password&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="nd"&gt;@app.route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;/&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;index&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Message&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;Hello World&lt;/span&gt;&lt;span class="sh"&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;That kind of hard coding credentials is not ideal if you are working on a large project with other people&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Incase you do not follow &lt;em&gt;Strict password policies&lt;/em&gt; and use one password everywhere....&lt;strong&gt;You are hacked!!!&lt;/strong&gt;. You just shared your password with the world.&lt;/p&gt;

&lt;h2&gt;
  
  
  So how do we deal with the &lt;strong&gt;flask environment variables&lt;/strong&gt;?
&lt;/h2&gt;

&lt;p&gt;We are going to see how to load flask environment variables automatically. You are here because you're tired of setting environment variables every time you are running your flask app? Variables like FLASK_APP or FLASK_ENV using &lt;code&gt;export command&lt;/code&gt;. Am going to help you do just that.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Install python-dotenv
&lt;/h3&gt;

&lt;p&gt;In your virtual environment, run;&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;I emphasize, always use virtual environments on your system to prevent corrupting your main Python installation. In case you want a recap on how to create virtual environments, refer to this guide. &lt;a href="https://docs.python.org/3/library/venv.html" rel="noopener noreferrer"&gt;Creation of Virtual Environments&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Create &lt;code&gt;.env&lt;/code&gt; and &lt;code&gt;.flaskenv&lt;/code&gt; files in your project root folder
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;On Bash&lt;/strong&gt;&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;touch&lt;/span&gt; .env
&lt;span class="nb"&gt;touch&lt;/span&gt; .flaskenv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 3: Place your flask environment variables in .flaskenv
&lt;/h3&gt;

&lt;p&gt;Depending on your use case, this will guide you on what to include.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;In .flaskenv&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;//this is the .flaskenv file
FLASK_ENV - Controls the environment.
FLASK_DEBUG - Enables debug mode.
FLASK_RUN_EXTRA_FILES - A list of files that will be watched by the re-loader &lt;span class="k"&gt;in &lt;/span&gt;addition to the Python modules.
FLASK_RUN_HOST - The host you want to &lt;span class="nb"&gt;bind &lt;/span&gt;your app to.
FLASK_RUN_PORT - The port you want to use.
FLASK_RUN_CERT - A certificate file &lt;span class="k"&gt;for &lt;/span&gt;so your app can be run with HTTPS.
FLASK_RUN_KEY - The key file &lt;span class="k"&gt;for &lt;/span&gt;your cert.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;for example; &lt;code&gt;FLASK_APP=app.py&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Boom, great work done. To run your app now, Simply do run;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp5nayohyahnarf80y82f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp5nayohyahnarf80y82f.png" alt="flask-run" width="800" height="85"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That was fast,.... right?? Yes so you can now focus on programming instead of looking for which flask environment variable is missing.&lt;/p&gt;

&lt;h2&gt;
  
  
  So how about &lt;strong&gt;my-secretly-defined environment variables&lt;/strong&gt;?
&lt;/h2&gt;

&lt;p&gt;Yes getting to that now. Follow this guide.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1. Place &lt;code&gt;your-secretly-defined environment variables&lt;/code&gt; in &lt;code&gt;.env&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;These can include;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Login credentials to the database&lt;/li&gt;
&lt;li&gt;API keys&lt;/li&gt;
&lt;li&gt;SECRET_KEY
&lt;em&gt;(among others)&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;In .env&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;//This is the .env file
&lt;span class="nv"&gt;MYSQL_USER&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;root
&lt;span class="nv"&gt;MYSQL_PASSWORD&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;my_mysql_password
&lt;span class="nv"&gt;MYSQL_DB&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;userdb
&lt;span class="nv"&gt;MYSQL_HOST&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;localhost
&lt;span class="nv"&gt;SECRET_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;topsecretkey
&lt;span class="nv"&gt;API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;donotsharethisapikeywithanyone

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2: Create a settings.py file
&lt;/h3&gt;

&lt;p&gt;(&lt;em&gt;Since these variables are not served automatically, we have to load them through this &lt;code&gt;settings.py&lt;/code&gt; file&lt;/em&gt;)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;In settings.py&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;//This is the settings.py file

from os import environ
&lt;span class="nv"&gt;SECRET_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;environ.get&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'SECRET_KEY)
API_KEY=environ.get('&lt;/span&gt;API_KEY&lt;span class="s1"&gt;')
MYSQL_USER=environ.get('&lt;/span&gt;MYSQL_USER&lt;span class="s1"&gt;')
//add any more variables you have

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: For consistency, it is good to keep the same variable name as the environment variable.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Add the configurations to our app
&lt;/h3&gt;

&lt;p&gt;In your &lt;code&gt;app.py&lt;/code&gt; , the file that has your flask object.&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;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;from_pyfile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;settings.py&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# loading all environment variables from settings.py
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So what happens is that the settings.py will read the values you placed in your .env file and store them in variables as you defined them in settings.py.&lt;/p&gt;

&lt;p&gt;When you use the flask object's config method, together with the &lt;code&gt;from_pyfile&lt;/code&gt; sub-method, the app will have access to the secretly defined variables in a secure way.&lt;/p&gt;

&lt;p&gt;Run your app as before, and boom you can now serve the world with your cool project&lt;/p&gt;

&lt;h3&gt;
  
  
  Bonus Tip:
&lt;/h3&gt;

&lt;p&gt;To avoid surbotaging your efforts to secure your credentials, when using a version control system such as &lt;strong&gt;git&lt;/strong&gt; , do not push the &lt;em&gt;.flaskenv&lt;/em&gt; and &lt;em&gt;.env&lt;/em&gt; files. You can use &lt;em&gt;.gitignore&lt;/em&gt; file to ignore them in your project directory. They remain on your local system.&lt;/p&gt;

&lt;h2&gt;
  
  
  How was the article?
&lt;/h2&gt;

&lt;p&gt;I love to learn with you dear reader. Share your feedback with me in the discussion section below. Are there better ways to do this?&lt;br&gt;
A great friend improves another, feel free to share &lt;br&gt;
I appreciate all the feedback in advance.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/u3axz3PUbjJpQeysaP/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/u3axz3PUbjJpQeysaP/giphy.gif" width="480" height="200"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>flask</category>
      <category>security</category>
      <category>environment</category>
    </item>
    <item>
      <title>Introduction to Python Functions</title>
      <dc:creator>kubona Martin Yafesi</dc:creator>
      <pubDate>Thu, 05 Aug 2021 19:58:35 +0000</pubDate>
      <link>https://dev.to/kubona_my/introduction-to-python-functions-ije</link>
      <guid>https://dev.to/kubona_my/introduction-to-python-functions-ije</guid>
      <description>&lt;p&gt;Welcome dear friend to yet another exciting talk about &lt;code&gt;Python&lt;/code&gt;. &lt;br&gt;
Last time we were here, we discussed about what Python is, what it is used for and also looked at its application domains. I hope you enjoyed that!! If you are new here, please check it out &lt;a href="https://dev.to/kubona_my/python-basics-pythons-101-dj2"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;em&gt;What is the agenda for today?&lt;/em&gt;
&lt;/h3&gt;

&lt;p&gt;Well today is going to be another fun ride. We will talk about functions. Topics of discussion will be:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What functions are?&lt;/li&gt;
&lt;li&gt;How to define them.&lt;/li&gt;
&lt;li&gt;When and how to use them.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;We will have some examples for illustration purposes&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;em&gt;Great!! I cannot already wait to jump right in...&lt;/em&gt;
&lt;/h3&gt;

&lt;p&gt;Ohh I see, let us head to the fun part without wasting much time.&lt;/p&gt;
&lt;h2&gt;
  
  
  Functions:
&lt;/h2&gt;

&lt;p&gt;A function is a group of related statements that perform a given task. So whenever you call a function, those statements will perform that task, however many times you call the function.&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;em&gt;You said related statements! What do you mean by that?&lt;/em&gt;
&lt;/h3&gt;

&lt;p&gt;Great question. Yes, now suppose you want your code to print your name and calculate your age very many times. So traditionally you would write your code like this and repeat it many times. Have a look:&lt;/p&gt;
&lt;h4&gt;
  
  
  Code Example 1
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;
&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Cool Python Guy&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;year_of_birth&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;What is your year of birth&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2021&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;year_of_birth&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;My name is &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; and I am &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; years old&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;To avoid repeating yourself to just print your name and age. You would create  a function with your code. So whenever you want your name and age printed, guess what.... call the function!!! &lt;br&gt;
Is that not cool?&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;em&gt;Yeah that is really cool stuff!!! Please tell me more, I love doing cool things&lt;/em&gt;
&lt;/h3&gt;

&lt;p&gt;So coming to the actual cool stuff, lets rewrite our code in a function. Are you ready? See this:&lt;/p&gt;
&lt;h4&gt;
  
  
  Code Example 2
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;name_age&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
   &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Cool Python Guy&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
   &lt;span class="n"&gt;year_of_birth&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;What is your year of birth&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
   &lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2021&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;year_of_birth&lt;/span&gt;
   &lt;span class="c1"&gt;# Printing the name and age
&lt;/span&gt;   &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;My name is &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; and I am &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; years old&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;So if you wanted to print your name and age many times, simply call your function like;&lt;/p&gt;
&lt;h4&gt;
  
  
  Code Example 3
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nf"&gt;name_age&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="nf"&gt;name_age&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="nf"&gt;name_age&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt; 
You can call it any number of times you like
Your name and age will be printed those many times

&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  &lt;em&gt;I see how that can save my a lot of time...&lt;/em&gt;
&lt;/h3&gt;

&lt;p&gt;Yeah you can save plenty of time, and boost your productivity. Also you have the advantage of not repeating yourself. You will soon notice that using functions makes your code readable by say your fellow programmer or Chief Technical Officer (CTO). &lt;em&gt;(You most likely will work with other people on a project)&lt;/em&gt;. A big problem can be divided into smaller chunks of functions each doing a separate task. &lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;em&gt;Functions are really powerful creatures. So i noticed the way you called the &lt;code&gt;name_age&lt;/code&gt; function was similar to how we &lt;code&gt;print&lt;/code&gt;. Is print also a function?&lt;/em&gt;
&lt;/h3&gt;

&lt;p&gt;Very nice question friend! You are picking up really fast. We might land on Mars soon enough. Until now I have showed you what we call &lt;code&gt;User-Defined functions&lt;/code&gt;.&lt;br&gt;
There is another type called &lt;code&gt;Built-in functions&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;In this article, we look at:&lt;br&gt;
-User-Defined functions &lt;br&gt;
-Built-in functions&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Another type &lt;code&gt;found in modules&lt;/code&gt; will be covered later in another piece&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  1. User-Defined Functions
&lt;/h2&gt;

&lt;p&gt;The Code Example 2 shown above is an example of a user defined function. &lt;br&gt;
These are functions that exist within our code and are defined by the programmer. In actual sense, we can call them custom made functions. &lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;em&gt;Uhmm, I see we made that &lt;code&gt;name_age&lt;/code&gt; function by ourselves. Tell me about the other type...was it built-in?&lt;/em&gt;
&lt;/h3&gt;
&lt;h2&gt;
  
  
  2. Built-In Functions
&lt;/h2&gt;

&lt;p&gt;Having learnt about user-defined functions, Its time we also get ourselves accustomed to built-in functions. &lt;br&gt;
So these functions, are an integral part of the python programming language. They exist within python itself and are always available to use by any python programmer like you.&lt;br&gt;
Actually you do not require any effort to use them, just call them... see here:&lt;/p&gt;
&lt;h3&gt;
  
  
  Code Example 4
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# the print function is a built-in function
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Hello Friend&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Hope you are enjoying python&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Please stick around till the end&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;*Feel free to check out other types of built-in Python functions &lt;a href="https://docs.python.org/3/library/functions.html" rel="noopener noreferrer"&gt;Built-in Python Functions&lt;/a&gt;&lt;br&gt;
*&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;em&gt;Thanks a ton!! I will check them out after here.&lt;/em&gt;
&lt;/h3&gt;

&lt;p&gt;That would really be great. So until now we have discussed about what functions are and their different types, But you might ask...&lt;br&gt;
&lt;strong&gt;How do we define functions?&lt;/strong&gt; Is it obvious? Let me not take chances here, &lt;em&gt;remember, we are soon reaching mars ...&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Defining Functions
&lt;/h2&gt;

&lt;p&gt;The syntax for defining a function is as:&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;def&lt;/span&gt; &lt;span class="nf"&gt;function_name&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;parameters&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt; A doc string defining the purpose 
        of the function
    &lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="sb"&gt;`statements`&lt;/span&gt; 
    &lt;span class="c1"&gt;# Comments describing what certain code is meant to achieve
&lt;/span&gt;    &lt;span class="sb"&gt;`statements`&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sb"&gt;`some value`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Key takeaways
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;def&lt;/code&gt; - This keyword indicates the start of a function definition&lt;br&gt;
&lt;code&gt;function_name&lt;/code&gt; - This is the name of the function&lt;br&gt;
&lt;code&gt;parameters&lt;/code&gt; - These are optional, but are used if you want the function to use certain data to carry out a given task&lt;br&gt;
&lt;code&gt;doc string&lt;/code&gt; - Optional, but used to describe purpose of function.&lt;br&gt;
&lt;code&gt;comments&lt;/code&gt; - Simple statements to illustrate purpose of certain lines of code.&lt;br&gt;
&lt;code&gt;statements&lt;/code&gt; - Remember from our definition of functions&lt;br&gt;
&lt;code&gt;return&lt;/code&gt; - Optional, but used if you want to output a value.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;em&gt;This has been a smooth journey to Mars. A recap of what I learned is:&lt;/em&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;I now know what a function is.&lt;/li&gt;
&lt;li&gt;I know the different types of functions.&lt;/li&gt;
&lt;li&gt;I know how to call and use the different types of functions.&lt;/li&gt;
&lt;li&gt;I know how to create my own functions.&lt;/li&gt;
&lt;li&gt;I have access to other types of built-in functions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Wow!! Such powerful knowledge you have attained today. Indeed you can now help Elon Musk write some functions for his rockets like turbo_charge(). &lt;/p&gt;

&lt;p&gt;It is a pleasure spending time with you. And I look forward to your company. Feel free to continue the discussion in the section below. I love learning new stuff and would be my pleasure to hear from you.&lt;/p&gt;

&lt;p&gt;How was the article? Did you learn something or your mind sparked at something. Please share! Until then, I say goodbye for now.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;           See you Again, Pythonista !!!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffmfqmtogtuqvo6jccepa.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffmfqmtogtuqvo6jccepa.jpg" alt="Business_Card_Kubona" width="800" height="470"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>programming</category>
      <category>functions</category>
    </item>
    <item>
      <title>Python Basics, Pythons 101!</title>
      <dc:creator>kubona Martin Yafesi</dc:creator>
      <pubDate>Thu, 22 Jul 2021 13:31:25 +0000</pubDate>
      <link>https://dev.to/kubona_my/python-basics-pythons-101-dj2</link>
      <guid>https://dev.to/kubona_my/python-basics-pythons-101-dj2</guid>
      <description>&lt;h2&gt;
  
  
  What is Python?
&lt;/h2&gt;

&lt;p&gt;Python is a programming language. In specific, it is a high level language, general purpose and interpreted. &lt;/p&gt;

&lt;h2&gt;
  
  
  So, tell me!! What is python used for?
&lt;/h2&gt;

&lt;p&gt;Well simply put, Python is used in a wide variety of fields in the computing world.&lt;br&gt;
These sectors of application are but not even limited to:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. Web Applications
2. Data Science
3. Mobile Applications
4. Big Data
5. Artificial Intelligence
6. Automation 
7. Testing
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Ohhh!!! I see that is a wide variety of fields. Quite intersting, huh? Now i know where my area of focus could be. You also said something about interpreted ... or what???
&lt;/h2&gt;

&lt;p&gt;Yes friend,&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Python is a high level interpreted language &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Other languages like &lt;code&gt;java&lt;/code&gt; have to wait for the compiler to compile the whole file of your code before it can execute. &lt;/p&gt;

&lt;p&gt;Python is behaves differently. After writing your source code in a file, Python will use an &lt;code&gt;interpreter&lt;/code&gt; to compile the source code &lt;code&gt;line by line&lt;/code&gt; into &lt;code&gt;machine code&lt;/code&gt; . Machine code is the language the computer understands.&lt;/p&gt;
&lt;h2&gt;
  
  
  Now I understand! So is it because of those features that one uses Python over other languages?
&lt;/h2&gt;

&lt;p&gt;Great Question! I personally love python because it is very easy to learn. Compared to other languages i have tried out, like &lt;code&gt;java&lt;/code&gt; , Nah! Python is way cooler with even nice syntax.&lt;/p&gt;

&lt;p&gt;Secondly, I love the fact that its able to cut across many different domains. Imagine you mastered Python!!!, You can work on websites, make some cool intructions for a robot, analyse your companies data, make an app, automate your computer...see list is endless. That is real.&lt;/p&gt;

&lt;p&gt;Third with Python you can be rest assured that problems are going to be solved in the shortest period of time. &lt;/p&gt;
&lt;h3&gt;
  
  
  What???
&lt;/h3&gt;

&lt;p&gt;Yes, with Python hard to imagine complex problems can be solved with fewer lines of code. That can boost your prodcutivity as a programmer, you worry less. &lt;/p&gt;
&lt;h4&gt;
  
  
  For example
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;java

public static void main(String[] args){
  System.out.println("Hello Friend")
  /**Am sorry i do not know your name */
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;See all that complexity there!!! , Now see the magic with &lt;code&gt;Python&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python

print("Hello Friend")

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Oh wow!!! Thats cool stuff. Anything more about Python? I am enjoying this already....am waiting!!
&lt;/h3&gt;

&lt;p&gt;Nice to know that you are loving Python already. And yeah there is a big community of Python developers all around the world to support you at every stage of your journey. Right from tonight, &lt;em&gt;assuming you start coding today, haha&lt;/em&gt; If you get stuck, they will always help you. Is that not great?&lt;/p&gt;

&lt;p&gt;Summing up, be rest assured that the programs you write in Python will run on all operating systems..name it. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Windows, Linux or even MacOS&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  Should the world know that you can program in Python?
&lt;/h4&gt;

&lt;p&gt;Yes, there is high demand for Python developers. You will be spoilt for choice because you are needed urgently. &lt;/p&gt;

&lt;h3&gt;
  
  
  So what now?
&lt;/h3&gt;

&lt;p&gt;Glad you have a prospect to learn Python. Over the next few days, stay tuned on my blog, follow me so that you do not miss any step towards becoming a great python developer.&lt;/p&gt;

&lt;p&gt;I will guide you through the whole process, right from installation , set up , and writing your first program in Python. We will even make real life projects. &lt;/p&gt;

&lt;h4&gt;
  
  
  What did you learn from the post today?
&lt;/h4&gt;

&lt;p&gt;Feel free to share with me your thoughts and any questions, I'd be glad to answer them all. Plus also, I never stop learning, so am open to new ideas from you, we grow together. Hurray!!!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;See you next time, Bye Friend!!!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0joqp0442eyoz4310thu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0joqp0442eyoz4310thu.png" alt="Kubona's E-Business Card" width="800" height="470"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>luxacademy</category>
      <category>python</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
