<?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: BlaqPrynx</title>
    <description>The latest articles on DEV Community by BlaqPrynx (@blaqprynx).</description>
    <link>https://dev.to/blaqprynx</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%2F1551213%2F98412c5d-6ffd-4cc6-88a1-da23ce784f74.png</url>
      <title>DEV Community: BlaqPrynx</title>
      <link>https://dev.to/blaqprynx</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/blaqprynx"/>
    <language>en</language>
    <item>
      <title>Setting up an integrated terminal in visual studio code to be able to use Python interpreter in a virtual environment.</title>
      <dc:creator>BlaqPrynx</dc:creator>
      <pubDate>Tue, 19 Nov 2024 16:26:49 +0000</pubDate>
      <link>https://dev.to/blaqprynx/setting-up-an-integrated-terminal-in-visual-studio-code-to-be-able-to-use-python-interpreter-in-a-1gj5</link>
      <guid>https://dev.to/blaqprynx/setting-up-an-integrated-terminal-in-visual-studio-code-to-be-able-to-use-python-interpreter-in-a-1gj5</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%2Fohfgbfz4y87ulvjmf9me.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%2Fohfgbfz4y87ulvjmf9me.PNG" alt="Image description" width="478" height="153"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Resolving this I installed Virtual Environment Wrapper which keeps all environments in one place and provides commands for creating and activating environments easily. With this , activation doesn't depend on locating the right activate script , by just using &lt;code&gt;workon command&lt;/code&gt;and the environment name in the terminal your environment is activated.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install virtualenvwrapper-win  #for Windows users
pip install virtualenvwrapper      #for Mac Os/linux Users
&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%2Fmtqtj8d9c5u50km3c8fz.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%2Fmtqtj8d9c5u50km3c8fz.PNG" alt="Image description" width="800" height="197"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After installing our Virtualenvwrapper we need to now create our virtual environment using the &lt;code&gt;mkvirtualenv command&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;mkvirtualenv dsargon
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;dsargon&lt;/strong&gt; here is the name of my virtual environment.. you can name it anyhow you want.&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%2F2mo9u7de5ygt7ryplwch.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%2F2mo9u7de5ygt7ryplwch.PNG" alt="Image description" width="800" height="121"&gt;&lt;/a&gt;&lt;br&gt;
Change Directory to your Project folder to install Django and other packages needed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd desktop \Udjango
pip install django 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To install django in your project folder.&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%2Fal50ff0ca1wq3vsc8hb4.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%2Fal50ff0ca1wq3vsc8hb4.PNG" alt="Image description" width="800" height="279"&gt;&lt;/a&gt;&lt;br&gt;
Confirm if your installed python and Django is available in your virtual environment by running the command below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python                                                                    
import django 
exit()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we can confirm python is accessible in our environment created and as well we can import Django package.&lt;br&gt;
Lets launch our visual studio code editor, change directory to our Project folder and run our project by using the &lt;code&gt;runserver command&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 manage.py runserver
&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%2F3ams0fvla8vwqbp5a21s.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%2F3ams0fvla8vwqbp5a21s.PNG" alt="Image description" width="800" height="279"&gt;&lt;/a&gt;&lt;br&gt;
After running the above command if your Django project launches successfully Hurrayyyy !!! but if not it means you are in a different environment and that Django cant launch your project as dependencies and packages in virtual environments varies per projects. To correct this he have to let Django know the specific environment we want our project to run in using the “workon Command” .Now lets Change Directory to our project folder and deactivate the running virtual environment which in this case is the “trial” and activate the dsargon virtual environment using the &lt;code&gt;workon command&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;deactivate             #deactivates Current running virtual environment
workon dsargon
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;dsargon as mentioned earlier is the name given to our virtual environment we created earlier after installing our virtualenvwrapper.&lt;br&gt;
This ensures that vscode python parser uses the right environment when checking for package dependencies in the project.&lt;br&gt;
Alternatively you can switch the virtual environment from the bottom right corner of your vs code editor in my case it’s the (“trial":venv)&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%2Fx6fl6u5jfga892fyjuuh.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%2Fx6fl6u5jfga892fyjuuh.PNG" alt="Image description" width="800" height="40"&gt;&lt;/a&gt;&lt;br&gt;
And select the right virtual environment for our project which is dsargon in this case. &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%2Fighjx0hkyoy9htfss3x5.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%2Fighjx0hkyoy9htfss3x5.PNG" alt="Image description" width="800" height="237"&gt;&lt;/a&gt;&lt;br&gt;
Now 'runserver' after selecting the right virtual environment when the Django project is launched it should be able to run successfully all things being equal.&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%2Fxtvuc7cu2fnajvf2b89s.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%2Fxtvuc7cu2fnajvf2b89s.PNG" alt="Image description" width="800" height="186"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
