Welcome back, everyone, to this lecture on installing and setting up our coding environment.
Now I want to make clear a little bit of vocabulary as there is some confusion when you go to the Microsoft
Visual Studio site on the difference between an I.D. and an editor in it is an integrated development
environment and typically it's a larger piece of software where you can code.
But it also has many integrations and you can think of those specific examples, like having source
control actually integrated into developer environments or like dot net apps are included in Visual
Studio instead of just Visual Studio code, and an editor itself just allows you to open and edit files.
And there are typically lighter weight programs that open and support editing of files.
They can also actually have many, many different useful features, and often an editor is also just
called an I.D. if it includes enough features.
So keep in mind, these aren't very strict definitions, but I just want to actually tell you the difference
right now, because later on, we'll see that there is a difference between Microsoft Visual Studio
and Visual Studio code.
One is technically an idea and another is an editor.
But let's go into a little more detail about choosing an editor or an I.D..
Keep in mind, choosing a specific coding environment is highly personal, and there are many, many
different options available, and you should feel free to use any development environment or coding
ED that you prefer and feel comfortable with, and that second part is key that you feel comfortable
with.
Don't just go to some editor like Petare if you've never used it before, because we're not going to
use that in this course, we're going to be using Microsoft Visual Studio Code.
So if you've never used any editor, we would suggest that you use Visual Studio Code that we can follow
along exactly with us.
But if you're already inexperienced developer and have your own preferences for a coding environment,
please feel free to go ahead and follow along in that coding editor.
Now, as I mentioned, there's many different types of options.
Some of them that are very popular are petroleum, the atom tax ed, the supply and tax ED and then
Microsoft Visual Studio.
And there's technically two different types of that Microsoft Visual Studio and Visual Studio code.
We'll get into that in just a little bit.
And in a very important note specific to Django is that notebook based editors like the Jupyter Notebook
or sometimes the Spider editor.
They won't really work well for Django because we need to support more than just Python code.
We need to be able to connect that to the template code like HTML or CSS or JavaScript.
So we have to be able to open many different types of files, not just Python specific notebook files.
Now, the other features you should be looking for for Django is that it should have syntax highlighting
support for multiple languages not just Python, but also HTML and CSS.
Since we're going to be working with many different file types and it should also ideally have a command
line interface in order to run the actual Django specific commands that create projects and applications,
those actually need to be run at the command line.
So some other nice to have are customizable styling and themes.
And then what's also nice but not necessary is be able to have a web browser inside the editor.
We ourselves will actually use that sort of feature.
I'm just gonna be dragging over the actual Chrome browser when we actually run our web applications.
OK.
So for this specific course, we decided to use the free version of Microsoft Visual Studio Code.
As I noted, this is technically different than Microsoft Visual Studio.
So if you just Google search Microsoft Visual Studio, you'll actually go to a website that has two
different download options.
Visual Studio Code The Microsoft Visual Studio Just to clarify things, we're using Visual Studio code.
So look for that code as that last part.
So what's nice about Microsoft Visual Studio Code one it's free to even though it's from Microsoft.
It's actually cross-platform compatible, so work on Windows, macOS, Linux, it's actually highly
customizable, has many built in features enough that maybe some people would call it an I.D., and
it also supports multiple file types.
So we're going to do now is download it at code that Visual Studio dot com or it can just Google search
Visual Studio code.
Again, this is different than just Visual Studio.
So let me show this link and see how we can download this and set it up.
OK, here I am at Code Visual Studio dot com.
If you go to this website, it should have the actual download available for you, either at the top
or on the front of the page, and it should automatically detect your operating system.
So here I already have download for windows, but you could also click other platforms and I'll just
give you a list of all downloads, either for Windows, Linux or Mac OS.
Something to keep in mind if you just Google search Microsoft Visual Studio, it may take you to Visual
Studio that Microsoft.com.
And here it's actually introducing it to the Visual Studio family, where it's going to have a couple
of options Visual Studio, Visual Studio for Mac and then Visual Studio Code.
Well, we're actually looking for is Visual Studio Code, which comes for Windows, Mac and then Linux
as well.
So this is separate from Visual Studio, which is kind of a heavier weight I.D. And it's kind of made
more for dot net developers than it is for just people programming in any language like Python or Django,
et cetera.
So for example, if we weren't sure which tool is best for us, we could say, OK, I'm going to Windows
Computer and maybe I want to work with Python.
And then it would suggest just Visual Studio code.
OK.
So again, we're dealing with Visual Studio code, not just Visual Studio.
Go ahead and download this and then begin to run the installer.
OK.
So once you start running the installer, you can check out the license agreements, go ahead and accept
the agreement.
I'll hit next.
If you want to have this installed in a different destination that is not the default, you can go ahead
and move it.
Just remember, you need a certain amount of space, typically around 300 megabytes, depending what
version you download.
And then you should also remember where you're actually saving this, too.
I'm just going to choose the default location, and that's OK with me.
I'll click next.
I'll go ahead and select the Start menu folder as Visual Studio.
Click Next.
And then here's kind of the two most important parts.
One is whether or not you want to add this to path.
I would suggest that you do add this to path.
That way, we can easily call this from our command prompt.
The other thing I would suggest you to do is to register the code as an editor for supported file types.
Now, if you're an experienced programmer and you already have your favorite editor and maybe you just
want to explore Visual Studio, you may or may want to uncheck this box because it's going to happen.
If you have some sort of Python script, file somewhere on your computer and you just want to edit it
or double click to open it, then what's going to happen is Microsoft Visual Studio is going to be the
default opening software for that file.
You may or may not want that.
So just keep that in mind.
And then these are the ones kind of up to you, whether you want to create a desktop icon.
I'll go ahead and create one.
And that's it.
So next, say everything's OK with you, and let's go ahead and install this to fast forward until this
is done installing.
All right, this is done installing.
I'm going to launch Visual Studio code now.
Click Finish and just check that Visual Studio launch button.
OK, so this is what Visual Studio looks like once it's launched and actually has a step by step process
of things you may want to do, typical to a new set up of your environment part, the first one is choosing
a color theme.
You can go light, dark or high contrast, or if you want, you can go ahead and download a theme from
the internet.
You can actually click here, browse color themes, and there's actually a bunch already installed for
you.
So if you want, you can explore those, for example, a red color theme.
It's probably not going to default here, but what we're going to do is we're just going to use the
high contrast dark one that should be pretty readable.
And if you want, you can also do things like sync from other devices, add a shortcut, etc. But eventually,
what?
You're going to ideas.
Open up your code.
So what I was just doing is creating an empty folder somewhere that's accessible on your computer,
like desktop documents or downloads.
And then what you can do is start actually coding out in that folder.
Or if you want, you can download the zip file of all the code that's included for this course and just
connect to that.
So typically, what's going to do is say, click here, pick a folder and then we'll go.
Here is just go to my desktop and maybe I'll make a new folder here.
So I'm going to call this new folder, and let's call this Django lectures.
And so as I'm quoting along with you, I'll just go ahead and put everything in here, so I'll select
that folder.
There we go.
And then do I trust the authors of this file?
Yes, it's me.
So I just trust everybody.
So yes, I trust the authors.
You may want to change this if you're on a work computer.
And then we can do here is just start making files and folders.
So you can see here there's a little new file button as well as a new folder button.
We'll be exploring this later on with Django.
It actually has a lot of features for us to automatically create directory structures.
But the other thing we should keep in mind is that there's also a terminal capability so we can click
new terminal.
And I'll open a terminal down here at the bottom.
You'll notice by default that uses PowerShell.
Depending on how you've installed Python, sometimes PowerShell has issues with that.
So if you want, you can always change where this is actually coming from and you can connect it to
the command prompt.
And you do that by clicking on the little dropdown arrow and you can hear command prompt, you may also
see other options depending on what you're running the command prompt there.
And just to make sure everything's working from your original installation of Python, you should be
able to type Python here, enter and see that Python is running and then hit something like one plus
one and get an output.
And then if you want to quit Python, say, quit there.
And if you're a windows, you want to clear this screen.
It's seals.
If you are on Mac OS or Linux, it's just the keyword clear.
And then what you can do is as you install more libraries, you can set up a virtual environment or
you can just say something like PIP, Install, Django, Hit, Enter, and then that's going to set
up everything for installing.
And it looks like it's actually running for me right now.
But you get the idea it's up to you, whether you want to set up a virtual environment, we'll talk
about that more later on.
The main thing here that I want you to be feeling comfortable with is the fact that you can easily call
a terminal at the bottom of this coding ED.
And then when you want to run a file, you can just create a new file here.
So I can say something like create a new file and then call this my file that I enter and you can see
I'm starting to code inside my file that pie and you'll notice as you start creating this python, file
the editor smart enough to detect, Hey, this is Python.
Maybe you want some recommendation like IntelliSense debugging, lynching and more.
You should see that at the bottom unless you already have this installed.
And I would actually recommend you install this.
Essentially, this is just intelligent.
Sensing is going to say, Hey, let me help autocomplete this function name or stuff like that.
So I'll go ahead and install this.
I'll click on install.
This is the default Python extension for Visual Studio code actually comes from Microsoft.
And by the time you click on that, it should already be installing.
So I would recommend you install this.
It makes working with Python a lot easier.
But let's go ahead and make sure that everything is working.
You can see here it's going to ask you about selecting your Python interpreter.
We'll explore that later, and then you can also configure the debugger, tons of features, tests,
et cetera.
And if you don't have Python install already, there's actually steps here to install Python.
So in case you have an installed python, go ahead and click here to install Python, and it should
set everything up for you.
And there's step by step instructions right here.
You can also then select a Python interpreter running Debug Your Python file, et cetera, on my computer.
I already have all this set up, so I don't need to go through the Python installation.
If you're totally new to Python, if for some reason you don't have it on this computer, it's actually
pretty nice to install it all from Visual Studio code.
Just the easiest way to do it.
But let's make sure everything's working going to come to you, my file, and I'm going to zoom in just
a little bit here so you can see things.
And then I'm going to I'm actually going to clear my terminal source type cluster on my terminal.
Analysts have this, say Prince.
Working, make sure you save this, so you have this little dot here telling you if it's say they're
unsafe.
Probably one of my most personal common mistakes is I just forget to save my changes and I'm scratching
my head thinking, What's not working?
So just do a control s or command.
That's the save that and you'll notice we're actually in the same location Django lectures as this files
in so I can come here and simply say Python.
My file that pie enter.
It's working, so we're good to go.
OK, so we've installed the actual Visual Studio Code Editor will be using for the course.
We've set up a folder that we can play around with, create directories, files and more.
We understood that we have the ability to run a terminal in the actual coding environment.
And then we also check to make sure Python is working within the coding environment.
And you can install it if you don't have it yet.
So that's pretty much it for this lecture.
Again, if you want to change things like colors and themes, you can always explore those further along.
But right now, we'll just keep everything as it is.
OK.
Thanks.
I'll see you at the next lecture.