<?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: Mohammad Moallemi</title>
    <description>The latest articles on DEV Community by Mohammad Moallemi (@mmoallemi99).</description>
    <link>https://dev.to/mmoallemi99</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%2F483903%2F22395aba-831b-4563-8c69-e71c9b8f6c7c.jpeg</url>
      <title>DEV Community: Mohammad Moallemi</title>
      <link>https://dev.to/mmoallemi99</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mmoallemi99"/>
    <language>en</language>
    <item>
      <title>How to accept command line arguments in Node.js scripts?</title>
      <dc:creator>Mohammad Moallemi</dc:creator>
      <pubDate>Sun, 02 May 2021 20:34:35 +0000</pubDate>
      <link>https://dev.to/mmoallemi99/how-to-accept-command-line-arguments-in-node-js-scripts-b6b</link>
      <guid>https://dev.to/mmoallemi99/how-to-accept-command-line-arguments-in-node-js-scripts-b6b</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F1650%2F0%2AwgRH9wqUzTTXeTJO.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F1650%2F0%2AwgRH9wqUzTTXeTJO.png" alt="How to accept command line arguments in Node.js scripts?"&gt;&lt;/a&gt;How to accept command line arguments in Node.js scripts?&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;In this short blog post, we’re going to see how we can write a Node.js script that accepts command line arguments and named arguments.&lt;/p&gt;

&lt;p&gt;As we know in any Node.js script we have an object called &lt;code&gt;process&lt;/code&gt; which contains a lot of information about the current running process from environment variables to PID and etc...&lt;/p&gt;

&lt;p&gt;One of the available keys in &lt;code&gt;process&lt;/code&gt; object is &lt;code&gt;argv&lt;/code&gt; and we can easily access it via &lt;code&gt;process.argv&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The two first items are Node.js executable path and JavaScript file path followed by provided command-line arguments unless you run it in an interactive Node.js shell.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// From script file named main.js  
console.log(process.argv)  
[ '/usr/bin/node', '/home/mmoallemi/main.js' ]  

// From interactive node  
❯ node  
Welcome to Node.js v15.14.0.  
Type ".help" for more information.  
&amp;gt; process.argv  
[ '/usr/bin/node' ]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We should use &lt;code&gt;process.argv.slice(2)&lt;/code&gt; instead:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;node main.js first second third  

~   
❯ node main.js  first second third  
[  
  'first',  
  'second',  
  'third'  
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Great! So far we have achieved to pass positional arguments to our script but if we want to use named arguments or some kind of flags?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;node main.js extract --input=test.txt --output=results.txt  
[  
  'extract',  
  '--input=test.txt',  
  '--output=results.txt'  
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We passed one positional argument and two named arguments, we can go ahead and clean the values and split them by &lt;code&gt;=&lt;/code&gt; and this kind of stuff, but let's do it right.&lt;/p&gt;

&lt;p&gt;Install &lt;code&gt;minimist&lt;/code&gt; using your favorite package manager, I use yarn:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn add minimist
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and then pass arguments to &lt;code&gt;minimist&lt;/code&gt; to parse it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// node main.js extract --input=test.txt --output=results.txt  
// main.js script  
const minimist = require('minimist')  

const args = process.argv.slice(2)  

const parsedArgs = minimist(args)  

console.log('Parsed Arguments:', parsedArgs)  

console.log('Input:', parsedArgs.input)  
console.log('Output:', parsedArgs.output)  

console.table(parsedArgs)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Enjoy the results!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Parsed Arguments: { _: [ 'extract' ], input: 'test.txt', output: 'results.txt' }  

Input: test.txt  
Output: results.txt  

┌─────────┬───────────┬───────────────┐  
│ (index) │     ۰     │    Values     │  
├─────────┼───────────┼───────────────┤  
│    _    │ 'extract' │               │  
│  input  │           │  'test.txt'   │  
│ output  │           │ 'results.txt' │  
└─────────┴───────────┴───────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Happy scripting!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published at&lt;/em&gt; &lt;a href="https://mmoallemi99.com/blog/how-to-accept-command-line-arguments-in-node-js-scripts/" rel="noopener noreferrer"&gt;&lt;em&gt;https://mmoallemi99.com&lt;/em&gt;&lt;/a&gt; &lt;em&gt;on May 2, 2021.&lt;/em&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to auto mount NVMe EBS Volumes on EC2?</title>
      <dc:creator>Mohammad Moallemi</dc:creator>
      <pubDate>Thu, 29 Apr 2021 08:38:01 +0000</pubDate>
      <link>https://dev.to/mmoallemi99/how-to-auto-mount-nvme-ebs-volumes-on-ec2-1m44</link>
      <guid>https://dev.to/mmoallemi99/how-to-auto-mount-nvme-ebs-volumes-on-ec2-1m44</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--L2KUA4HY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/2560/0%2AYHFwWta5tA66mcFD.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--L2KUA4HY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/2560/0%2AYHFwWta5tA66mcFD.png" alt="How to auto mount NVMe EBS Volumes on EC2?"&gt;&lt;/a&gt;&lt;/p&gt;
Image used from AWS youtube channel: https://www.youtube.com/watch?v=77qLAl-lRpo





&lt;p&gt;In this tutorial, we’re going to mount an NVMe EBS volume to an EC2 instance and add it to &lt;code&gt;/etc/fstab&lt;/code&gt; so it automatically mounts the volume after reboots.&lt;/p&gt;

&lt;p&gt;First list block devices using &lt;code&gt;lsblk&lt;/code&gt;:&lt;br&gt;
&lt;code&gt;sudo lsblk&lt;/code&gt;&lt;br&gt;&lt;br&gt;
You will see a result similar to this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qA9dhEp3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/2048/0%2Ak4HeCRUdyv2jUeG8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qA9dhEp3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/2048/0%2Ak4HeCRUdyv2jUeG8.png" alt="List block devices in order to see all available NVMe devices&amp;lt;br&amp;gt;
"&gt;&lt;/a&gt;&lt;/p&gt;
List block devices in order to see all available NVMe devices






&lt;p&gt;The NVMe volumes names follow the pattern below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/dev/nvme0n1
/dev/nvme1n1
/dev/nvme2n1
.
.
.
/dev/nvme\[0-26\]n1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then build a Linux file system of your choice, I picked &lt;code&gt;ext4&lt;/code&gt; here:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo mkfs -t ext4 /dev/nvme1n1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Verify the build using the file command and copy the UUID value:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo file -s /dev/nvme1n1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result is something like this:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hwWZwmJQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://mmoallemi99.com/blog/wp-content/uploads/2021/04/carbon-45-1024x402.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hwWZwmJQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://mmoallemi99.com/blog/wp-content/uploads/2021/04/carbon-45-1024x402.png" alt="/dev/nvme1n1: Linux rev 1.0 ext4 filesystem data, UUID=&amp;lt;br&amp;gt;
"&gt;&lt;/a&gt;&lt;/p&gt;
/dev/nvme1n1: Linux rev 1.0 ext4 filesystem data, UUID=






&lt;p&gt;Now edit &lt;code&gt;/etc/fstab&lt;/code&gt; with the editor of your choice (I prefer nano xD) and add the following line to it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;UUID="&amp;lt;copied-uuid-value&amp;gt;" &amp;lt;mount-directory-path&amp;gt; ext4 defaults 0 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we use the mount utility to verify and mount the volume.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo mount -a
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can checkout your mounted volumes using:&lt;/p&gt;

&lt;p&gt;The result is something like this:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xvMsZc24--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://mmoallemi99.com/blog/wp-content/uploads/2021/04/carbon-46-1024x446.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xvMsZc24--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://mmoallemi99.com/blog/wp-content/uploads/2021/04/carbon-46-1024x446.png" alt="Getting a report of mounted file systems and disk space usage&amp;lt;br&amp;gt;
"&gt;&lt;/a&gt;&lt;/p&gt;
Getting a report of mounted file systems and disk space usage






&lt;p&gt;Getting a report of mounted file systems and disk space usage&lt;/p&gt;

&lt;p&gt;I hope you enjoyed it, feel free to drop a comment if you have any questions.&lt;br&gt;&lt;br&gt;
Happy Engineering!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published at&lt;/em&gt; &lt;a href="https://mmoallemi99.com/blog/how-to-auto-mount-nvme-ebs-volumes-instance-storage-on-aws-ec2/"&gt;&lt;em&gt;https://mmoallemi99.com&lt;/em&gt;&lt;/a&gt; &lt;em&gt;on April 28, 2021.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>ec2</category>
      <category>ebs</category>
      <category>linux</category>
    </item>
    <item>
      <title>Serverless Micro Django | Lightweight, yet powerful Python utility for lambda functions</title>
      <dc:creator>Mohammad Moallemi</dc:creator>
      <pubDate>Thu, 25 Feb 2021 16:05:25 +0000</pubDate>
      <link>https://dev.to/mmoallemi99/serverless-micro-django-lightweight-yet-powerful-python-utility-for-lambda-functions-1dp5</link>
      <guid>https://dev.to/mmoallemi99/serverless-micro-django-lightweight-yet-powerful-python-utility-for-lambda-functions-1dp5</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zlsY4wwZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2076/1%2AfcXhONE-hsXCj8JS4KOlaQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zlsY4wwZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2076/1%2AfcXhONE-hsXCj8JS4KOlaQ.png"&gt;&lt;/a&gt;&lt;br&gt;&lt;a href="https://github.com/mmoallemi99/serverless-micro-django/"&gt;https://github.com/mmoallemi99/serverless-micro-django/&lt;/a&gt;
 &lt;/p&gt;

&lt;p&gt;A couple of weeks ago I had this task in &lt;a href="https://www.agileful.com/"&gt;agileful&lt;/a&gt; to refactor and improve some AWS lambda functions.&lt;/p&gt;

&lt;p&gt;There was a bunch of pure SQL queries written alongside python codes which made me think, what if we could use standalone Django ORM in our python lambda functions?&lt;/p&gt;

&lt;p&gt;So I did some digging on how we can use my beloved ORM in python scripts despite the serverless stuff, there were some vague and old answers but I managed to make something out of it.&lt;br&gt;
It’s as simple as defining a database connection settings and calling django.setup().&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Standalone Django ORM&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here is the minimal python code needed to use standalone Django ORM:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hTzPgBc7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/3400/1%2ABfD1qaquyrTzcfUJoKwbCw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hTzPgBc7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/3400/1%2ABfD1qaquyrTzcfUJoKwbCw.png"&gt;&lt;/a&gt;&lt;br&gt;handler.py
 &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ske7tiB5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2388/1%2AcmuMLBDU6-7zH8oK9XQIIQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ske7tiB5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2388/1%2AcmuMLBDU6-7zH8oK9XQIIQ.png"&gt;&lt;/a&gt;&lt;br&gt;serverless_micro_django/settings.py
 &lt;/p&gt;

&lt;p&gt;Plus these two files you need to create your desired Django app models. (e.g. videos_app/models.py)&lt;/p&gt;

&lt;p&gt;There is one downside in this way of using Django and that is the lack of manage.py!&lt;br&gt;
I haven’t got time to try adding manage.py commands so I added some helper scripts like the ones below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bTp3jSgj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/3400/1%2AUIMztYayQ8_0zYnAD79zxA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bTp3jSgj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/3400/1%2AUIMztYayQ8_0zYnAD79zxA.png"&gt;&lt;/a&gt;&lt;br&gt;makemigrations.py / migrate.py
 &lt;/p&gt;

&lt;p&gt;So even if you just need Django ORM without all the serverless and fancy stuff use the codes above and you’re good to go. Or check out the GitHub repository:&lt;br&gt;
&lt;a href="https://github.com/mmoallemi99/serverless-micro-django"&gt;https://github.com/mmoallemi99/serverless-&lt;/a&gt;&lt;a href="https://github.com/mmoallemi99/serverless-micro-django"&gt;micro&lt;/a&gt;&lt;a href="https://github.com/mmoallemi99/serverless-micro-django"&gt;-django&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Serverless Micro Django!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;So let’s make it Serverless!&lt;br&gt;
As we know lambda functions must accept two function parameters: event, context.&lt;/p&gt;

&lt;p&gt;As SMD (Serverless Micro Django) is supposed to be lightweight and micro! it doesn’t support any REST API like Django &amp;amp; Flask. Just function!&lt;/p&gt;

&lt;p&gt;Hence when you are invoking the function you must pass your desired action/event in lambda event argument:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--T9vIkNH6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2420/1%2A428dRzqs_KF3Pi88wWg1lg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--T9vIkNH6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2420/1%2A428dRzqs_KF3Pi88wWg1lg.png"&gt;&lt;/a&gt;&lt;br&gt;test_lambda.py
 &lt;/p&gt;

&lt;p&gt;And in the end, I developed a ModelController so I can execute the events. Which I’m not going to get into and talk about.&lt;/p&gt;

&lt;p&gt;I’ve also done some event input validations and modeling using &lt;a href="https://github.com/samuelcolvin/pydantic"&gt;PyDantic&lt;/a&gt; which you can find in the project’s GitHub repository.&lt;/p&gt;

&lt;p&gt;I know there is a long way for SMD to become mature and production-ready. I would gladly accept and be open to contributions and feedback. (Documenting, Development, Content Writing, etc…)&lt;/p&gt;

&lt;p&gt;GitHub Repository:&lt;br&gt;
&lt;a href="https://github.com/mmoallemi99/serverless-micro-django"&gt;https://github.com/mmoallemi99/serverless-micro-django&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://mmoallemi99.com/blog/serverless-micro-django/"&gt;https://mmoallemi99.com&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>serverless</category>
      <category>python</category>
      <category>django</category>
      <category>aws</category>
    </item>
    <item>
      <title>How to upgrade to Python 3.9.0 on Ubuntu 18.04 LTS without internal bleeding!</title>
      <dc:creator>Mohammad Moallemi</dc:creator>
      <pubDate>Thu, 25 Feb 2021 15:45:04 +0000</pubDate>
      <link>https://dev.to/mmoallemi99/how-to-upgrade-to-python-3-9-0-on-ubuntu-18-04-lts-without-internal-bleeding-5dke</link>
      <guid>https://dev.to/mmoallemi99/how-to-upgrade-to-python-3-9-0-on-ubuntu-18-04-lts-without-internal-bleeding-5dke</guid>
      <description>&lt;p&gt;SPOILER ALERT:&lt;br&gt;
Upgrading the Python version on Ubuntu breaks some packages like apt and pip in your system!&lt;br&gt;
[Bleeding SysAdmin crawling]&lt;/p&gt;

&lt;p&gt;In this article we’re going to upgrade python and fix the issues.&lt;/p&gt;

&lt;p&gt;Start reading this article and executing the instruction:&lt;br&gt;
&lt;a href="https://www.itsupportwale.com/blog/how-to-upgrade-to-python-3-9-0-on-ubuntu-18-04-lts/"&gt;How to upgrade to Python 3.9.0 on Ubuntu 18.04 LTS&lt;/a&gt;&lt;br&gt;
It will guide you through updating the repo and basic updating stuff.&lt;/p&gt;

&lt;p&gt;After that, try running sudo apt update.&lt;br&gt;
See!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YPu58wRA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2048/0%2AROMItE-03xvCr9M0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YPu58wRA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2048/0%2AROMItE-03xvCr9M0.png" alt="ModuleNotFoundError: No module named ‘apt_pkg’"&gt;&lt;/a&gt;&lt;em&gt;ModuleNotFoundError: No module named ‘apt_pkg’&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;or event a simple pip3 install virtualenv:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--55L2krq5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2048/0%2ALNQ8sgvO3VFpzr8M.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--55L2krq5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2048/0%2ALNQ8sgvO3VFpzr8M.png" alt="ImportError: cannot import name ‘sysconfig’ from ‘distutils’ (/usr/lib/python3.9/distutils/__init__.py)"&gt;&lt;/a&gt;&lt;em&gt;ImportError: cannot import name ‘sysconfig’ from ‘distutils’ (/usr/lib/python3.9/distutils/&lt;strong&gt;init&lt;/strong&gt;.py)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Well, that’s a lot of errors!&lt;br&gt;
BUT:&lt;br&gt;
This is GNU/Linux bruh! We always have solutions! [D’Oh!]&lt;/p&gt;

&lt;p&gt;At first, you need to resync old python packages to new corresponding paths, we’ll first navigate to python3 dist-packages folder and use ln command to make links.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0uxFeDG1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2048/0%2AF9tZYrdXTnSjGzDj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0uxFeDG1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2048/0%2AF9tZYrdXTnSjGzDj.png" alt="Linking old python packages to new ones"&gt;&lt;/a&gt;&lt;em&gt;Linking old python packages to new ones&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;If you consider your old python version 3.6 and the new one 3.9 the ln command would be something like above: (change 36 and 39 numbers accordingly)&lt;/p&gt;

&lt;p&gt;Then uninstall any existing python-apt packages using two apt purge commands and reinstall them just like a normal apt package&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NVrd0qhE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2048/0%2AiVshnNbMvXvKEw3F.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NVrd0qhE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2048/0%2AiVshnNbMvXvKEw3F.png" alt="Reinstalling python-apt package"&gt;&lt;/a&gt;&lt;em&gt;Reinstalling python-apt package&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;BEWARE: using apt with --reinstall flag doesn't work!&lt;br&gt;
Now run sudo apt update.&lt;/p&gt;

&lt;p&gt;YaY! It’s fixed! [Mic Drop!]&lt;/p&gt;

&lt;p&gt;But wait a second, I still can’t install pip packages!&lt;br&gt;
Just run this command and you’ll be good to go:&lt;br&gt;
sudo apt install python3.9-distutils python3.9-dev&lt;/p&gt;

&lt;p&gt;Happy SysAdminning!&lt;/p&gt;

&lt;p&gt;Thanks to the free software community for this beautiful world we’re living in!&lt;/p&gt;

&lt;p&gt;Sources:&lt;br&gt;
&lt;a href="https://www.itsupportwale.com/blog/how-to-upgrade-to-python-3-9-0-on-ubuntu-18-04-lts/"&gt;How to upgrade to Python 3.9.0 on Ubuntu 18.04 LTS&lt;br&gt;
&lt;/a&gt;StackOverFlow: &lt;a href="https://stackoverflow.com/questions/13708180/python-dev-installation-error-importerror-no-module-named-apt-pkg"&gt;python-dev installation error: ImportError: No module named apt_pkg&lt;/a&gt;&lt;br&gt;
AskUbuntu: &lt;a href="https://askubuntu.com/questions/1292972/importerror-cannot-import-name-sysconfig-from-distutils-usr-lib-python3-9"&gt;ImportError: cannot import name ‘sysconfig’ from ‘distutils’ (/usr/lib/python3.9/distutils/&lt;strong&gt;init&lt;/strong&gt;.py)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://stackoverflow.com/questions/13708180/python-dev-installation-error-importerror-no-module-named-apt-pkg"&gt;https://stackoverflow.com/questions/13708180/python-dev-installation-error-importerror-no-module-named-apt-pkg&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://mmoallemi99.com/blog/how-to-upgrade-to-python-3-9-0-on-ubuntu-18-04-lts-without-internal-bleeding/"&gt;https://mmoallemi99.com&lt;/a&gt; on February 17, 2021.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>linux</category>
      <category>python</category>
      <category>ubuntu</category>
      <category>devops</category>
    </item>
    <item>
      <title>How to get a job as a Python/Django backend developer roadmap</title>
      <dc:creator>Mohammad Moallemi</dc:creator>
      <pubDate>Tue, 06 Oct 2020 18:43:26 +0000</pubDate>
      <link>https://dev.to/mmoallemi99/how-to-get-a-job-as-a-python-django-backend-developer-roadmap-k3b</link>
      <guid>https://dev.to/mmoallemi99/how-to-get-a-job-as-a-python-django-backend-developer-roadmap-k3b</guid>
      <description>&lt;p&gt;A while ago I designed a Django Developer Career Roadmap for those who wish to start in this field and enter the software industry market.&lt;/p&gt;

&lt;p&gt;I’ve recently created a GitHub repository and updated it with some new stuff.&lt;br&gt;
Check out the repository if you wish to become a Django developer or strive to improve your existing skills!&lt;br&gt;
&lt;a href="https://github.com/mmoallemi99/developer-career-roadmap/"&gt;https://github.com/mmoallemi99/developer-career-roadmap/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;p.s. this roadmap assumes you have knowledge in python and programming fundamentals&lt;/p&gt;

&lt;p&gt;If you have any suggestion or you wish to improve the roadmap, feel free to open a pull request in GitHub!&lt;/p&gt;

&lt;p&gt;Happy coding 🙂&lt;/p&gt;

&lt;p&gt;Source:&lt;br&gt;
&lt;a href="https://mmoallemi99.com/blog/how-to-get-a-job-as-a-python-django-backend-developer-roadmap/"&gt;https://mmoallemi99.com/blog/how-to-get-a-job-as-a-python-django-backend-developer-roadmap/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>django</category>
      <category>backend</category>
      <category>roadmap</category>
    </item>
  </channel>
</rss>
