Placeholder Image

Subtitles section Play video

  • Hey, and welcome to the tri Django Siri's.

  • My goal for this one is to help you learn and Master Django like I want you to go as far as you possibly want to go.

  • And understanding the jangle Web framework you see in the way we're gonna do this in this one is really Start from the beginning, we're gonna start with absolute basics and then we're gonna work our way up introducing new concepts along the way.

  • And I'm actually not gonna be building a full project.

  • So instead, what I'm gonna do is just jump into individual concepts, put them into a practical use case in a sort of project, and then eventually you'll have a very good understanding of how to build riel Web applications using Django.

  • And of course, I do recommend that you learn from entire projects and I have a bunch of them both right here on YouTube, on joints.

  • If he dot com slash YouTube as well as on our website joints heavy dot com, we have a tonic stuff there from building riel things with Django.

  • But this series is all about getting the absolute basics to even advanced level things bit by bit.

  • If you're learning Django for the first time, it's an incredibly exciting experience.

  • At least it was for me because once I was able to actually build a Web application with a database attached to it, it was like, Oh, this is so cool.

  • Now I think that you might be just as excited.

  • And perhaps you've already done that with other Web applications.

  • Or perhaps this is the first time your programming.

  • Either way, the most frustrating part is at the beginning, not so much because of the programming language, but often because of how to actually set up your system.

  • And since it's so frustrating over years, we were find the way to set up your system, depending on what you're on.

  • And that's part of the frustration is like you're gonna see me working a lot in a Mac so Mac OS environment, and if you're on Windows, you're like, Hey, why isn't it the same?

  • I mean, actually, using python and actually using Django is the same on both systems.

  • Because Python is python and Django is jangle.

  • The commands to get there might differ slightly, but realistically it's the same over years we've refined the installation process, and all of that could be found on joint safety dot com slash from zero.

  • So if you just do that step one that set up process, you'll be ready for the rest of the Siri's.

  • You don't have to go on to any other step other than setting up your system before you jump there.

  • I did want to mention one other thing, and that is the code.

  • So we have all of our code on get hub or joints.

  • If he dot com slash get hub to shortcut it, you're gonna look for the tri Django depository.

  • So So join TV Dotcom Such get help will take you here.

  • And then if you go into repositories, you'll see all kinds of them.

  • And in fact, if you type out, try Django.

  • You'll see multiple there as well.

  • I want you to ignore all of the ones that have numbers in them and just go to the one try Django, right?

  • So there's a link right here if you want to go directly there, but this code will 100% help you because when you hit roadblocks, which gonna want to do is take the code that you've been writing and take a look at Get Hub and make sure that what you've been writing is the same as what we've been doing in the videos.

  • That part is critical.

  • And then the last thing is, when in doubt, consult the documentation.

  • Jangles documentation is very well written, and there's just so much there that you can learn that we won't necessarily cover because they give additional context.

  • Or they give specifics to whatever use case you have for the technology.

  • And then the last thing is, Google is your friend.

  • You know you can use Google to do a search for something that you're not familiar with, and oftentimes that will bring up stack overflow dot com.

  • Stack Overflow has all of these questions from people for all sorts of programming languages, including python, including Django, including JavaScript, all sorts of things in there, and you just do a quick search.

  • You can search for just jango, and you can learn a lot just from that just from going toe like votes.

  • I mean, does Django scale?

  • That's an interesting question to take a look at, and then what is know what is blank.

  • I mean, this right here is a great learning resource as well.

  • So what I'm gonna assume for the next video and all the other future videos is that you have your system set up and ready to work with Django and Python.

  • The versions that we're gonna be using will be discussed in the next one because they will change over time.

  • At the end of the day, I really want you to stick with whatever version is in the video, because as a beginner, that is critical.

  • All right.

  • So in this one, we're gonna be creating a brand new virtual environment and install Django.

  • If you haven't done these things before, regardless of the version, definitely stop now and make sure you go back and do the setup process.

  • No, I absolutely want you to have a fresh virtual environment and a fresh Django install, not on Lee, just to get the practice of it, but also to make sure that we're all starting from the exact same spot.

  • So if you open up your terminal window or if you're on windows, your power shell or command prompt.

  • But hopefully you're using power shelf on Windows limits and Mac users.

  • Justa terminal is fine, So if we type out Python V and Python three Dash V, this is what I get now.

  • You might already have Python three in there.

  • So if you see Python 3.6 point five or 3.6 point six right here, you're in good shape.

  • If you see this, then you're gonna have to do an extra step, okay?

  • Just keep that in mind.

  • I believe that open.

  • And I'm just gonna put it over to the side a little bit and break it down so we can just keep that in mind while we're doing this.

  • Okay, so I've got another terminal window open now.

  • You absolutely don't have to do this, but I'm gonna leave it there just in case.

  • So there's a few different ways on how we can create a virtual environment and installed Django.

  • I'm gonna show you the way that I'm going to do it so initially, gonna serve you the final way.

  • And if that part works for you, great.

  • You can go to the next portion which would be installing Django, which maybe we should just do all of that and at first, so I'm gonna show you exactly how I'm gonna do it.

  • Now, I first of all, want to keep this virtual environment in one development area.

  • So for me, when I open it up and a list everything out, this is what I see.

  • Yours might be a little different.

  • Years might be the same.

  • You might see this dead folder if you don't see it just to make their dev right.

  • So, in my case, already have it there.

  • So I get this error.

  • I'm gonna just CD into my dad folder.

  • Right.

  • This is where I keep all of my development projects.

  • So in here, I'm gonna go ahead and make a directory called Trying Django.

  • We're a CD into that directory, and then we're gonna create are virtually envy.

  • Now, before it created, I'm just gonna hit virtually envy and make sure I don't see any errors.

  • I see that there's all sorts of options I could do if I type out ABC, there is an air.

  • So if you see an error, that means you need to install your virtual environment all over again.

  • Okay, so I cleared everything out.

  • But if I do pwd?

  • I see exactly where I am.

  • I'm inside of that folder.

  • If I list everything out, there's nothing in there.

  • Now all I'm gonna do is virtually envy.

  • Dash P.

  • Python three Enter again.

  • Remember how I said if you had Python Dash V and Python three was here, you could just omit this portion right here.

  • Right?

  • So if you see Python 3.6 right there, you can admit that portion and just leave it as virtually envy period we had enter.

  • That creates a virtual environment inside of this directory so I can activate it with source been slashed, activate and then install Django.

  • So Pip installed Jango and my version of Django is going to be 2.0 point seven.

  • So Django equals equals 2.0 point seven.

  • That should also be your version of jingle.

  • If you're sticking with me on this, use that version of jingle.

  • I honestly don't care if 2.8 was 2.0 point eight is out used to 0.0 point seven.

  • We'll upgrade things later.

  • And if you stick with me on this, you will absolutely upgrade with us.

  • I promise.

  • Absolutely Promise Okay, so you hit.

  • Enter, and I'm gonna let that run.

  • Now.

  • For those of you on windows, you're activate.

  • You might remember, is different.

  • It's just slightly different.

  • Well, that installs.

  • I'm gonna just go ahead and break it down a little bit.

  • I'm gonna open up another terminal window and simulate reactivating this virtual environment.

  • So list everything out my CD into death, and then I see the into try Django.

  • I'm back into that virtual environment so I could do source.

  • Baines slash Activate in a mac environment, the window's environment, of course, it's scripts us activate.

  • And then you can also run.

  • Deactivate.

  • Okay, so deactivate just ends the virtual environment.

  • Cool.

  • So what is the purpose of having a virtual environment if you don't already know?

  • It is a simple is doing.

  • Pip.

  • Freeze.

  • You see all this stuff?

  • I see.

  • Django 1.10 point four.

  • If I activate it, sore spending, activate and dupe it.

  • Freeze.

  • All I see is Django 2.0 point seven and P Y T c.

  • That's it.

  • So it keeps these requirements separate.

  • And when it comes to Python and its projects like Django, you want him absolutely.

  • Make sure that that is done.

  • Okay, so we have everything installed.

  • If if this part was done, you're ready to go.

  • You could move on to the next one if you had some issues, or you want to see other ways of starting a virtual environment Stick with me.

  • So notice that obviously, we had all this stuff installed, all that's working.

  • So going forward, just just watch.

  • Just for illustration purposes.

  • You know, I'm assuming that up to this point, if you have it working, then you're done.

  • If you don't have it working, watch this next part rewind and then install the things you need to install because I'm going to go pretty fast, but still explain what's going on.

  • Okay, so I'm gonna close out all of my terminal windows and act like I'm starting from zero.

  • Okay, so I jump in to my terminal window I go into I'm gonna go ahead and make a new debt folder called Deaf to a CD into Deaf, too.

  • And list everything out.

  • Nothing's in there so much.

  • I'm gonna show you three different ways and creating a virtual environment.

  • The 1st 1 is just type out virtually envy and then the name that you want to give it so v e N v.

  • That is a way to do it now.

  • This is irregardless of the Python version.

  • It's gonna go off of whatever the system's default version is, so I typed it out.

  • In my case, it's version 2.7, but that is a way to start a virtual environment.

  • Now, if I want to start it based off of a specific version of Python, I would do virtually N v V and V Dash P python for free.

  • Also, it's called V and B to this gives me a version of python and this python three.

  • So that assumes that if I type out python three, it actually gives me a python three.

  • But if you type out Python three and that doesn't work, this won't work.

  • So what happens then?

  • Well, I can just do which python three or, in other words, find the location where Python three is installed, right?

  • So which Python three will not work if Python three doesn't work right, so every once in a while that you installed python in your system and it's just installed somewhere else and this command itself doesn't work.

  • But wherever that is actually installed on any system and you do something like this, you actually paste in the path to that and hit Enter.

  • That should actually open up Python 34 U.

  • S.

  • So then that means that the final way to actually start a virtual environment is virtually n v v E N v three p.

  • And then the path to that python three I hit enter, and then we'll actually start that virtual environment as well.

  • Now, one other thing I will mention is we can also just make the directory that we want to call it.

  • So I want to make a virtual environment and a brand new directory.

  • This is it.

  • I go ahead and enter a CD into it, and then I could do virtually envy and then period instead of the name and then whatever version of Python I may want, right?

  • So the order of these things doesn't matter that much how I'm running those commands in comparison to what I was doing before, But that's a few different ways on how you can create a virtual environment Now, In my case, I'm actually gonna go ahead and give rid of that deaf to folder.

  • I I really don't need it.

  • But it was all about illustration purposes for getting all of this stuff going.

  • Okay, so, uh, I'll see the back into my original project and just go ahead and leave it at that.

  • Now, if any of this was confusing and you're lost, rewatched the video and do this multiple times because having a basic understanding of starting a new project installing it, you're gonna probably do this fairly often.

  • If you're only here to learn some of the basics of Django and you don't plan on making very many projects with with Django, you may be won't need to do it this way.

  • Now, one more note I will say is perhaps you're like a I don't care about a virtual environment I don't care about doing.

  • All these things will do that at your own risk, right.

  • So you're gonna run into issues if you don't use a virtual environment.

  • And yes, I am not using Kanda Anacondas, a package that's Maur for, like, data science related things.

  • Jango can use a lot of those same packages in my experience.

  • Anaconda and Django don't work that well.

  • But realistically, if you're using Anaconda, you're probably already familiar with that system, and you're probably not going to use virtual environments.

  • However, I will say for this entire series, I would recommend they use a virtual environment just to get used to it, just to get used to how Web developers often use the development environment for Django.

  • Now it's time to create a Django project.

  • See, I've got my brand new clean terminal window open because I want to get in the habit of knowing how to reactivate a virtual environment.

  • So I come in here and a CD into my death folder, where I'm holding everything I see d into my try Jingle folder, where my virtual environment route is.

  • Anna Just run?

  • Well, no, I don't run that virtually envy.

  • Commanding more.

  • We go ahead and Ron Source been such activate, right?

  • So that's linens and Mac users for you.

  • Windows users.

  • It's just scripts slash activity.

  • So if you are in here, you can go ahead and do pit freeze, and you'll likely see this version of Django.

  • That's the version we're using.

  • That's the version I recommend that you use as well.

  • So I'm gonna just leave that open right over here so we can always see it, right?

  • Just a nice little reminder.

  • Hey, that's the version of Django I'm gonna be using.

  • All right, now, let's go ahead and do that all over again.

  • It's really easy, right?

  • This this Hopefully, this is really, really easy.

  • If it's not really easy, I'm going too fast.

  • Maybe you just put it on a slower speed.

  • I know I talk really fast, but I try to get it so beginners can keep up.

  • But also so advanced users like more advanced Web developers that are just learning Django.

  • So all of you can get something out of this.

  • That's really the goal.

  • It's It's a little bit ambitious to achieve, but anyways, okay, So now we're in this virtual environment, and I have this command Django dish admin.

  • So, Django Dish and men is a command that will allow us to do all sorts of things with Django.

  • But the main one is creating our jingle project.

  • So Django Dash and men creates projects and whatever our project name is going to be now, you could do this right off the bat inside of that virtual environment.

  • But what I like to do is create an S R C folder, as in the source folder off the project.

  • And then I go in there, right?

  • So if I go back into my virtual environment, I see that it We have these things in here, right?

  • So I've got the four the four things related to the virtual environment, and then I have my SRC folder.

  • So I changed into that SRC folder and just do Django Dash and Men start project and then my project name.

  • What am I gonna call it?

  • Well, to be original.

  • I'm gonna call it Try Django.

  • That's the name of my virtual environment as well.

  • I realize that.

  • But that's okay.

  • You can name your virtual environment and your jingle project the same because the virtual environment is only for your system.

  • The project yourself will be other places, right?

  • So, like, you'll be on Kid hub and there won't be anything related to our virtual environment.

  • So I'm a start this project.

  • Try Django, and I'll just put a period at the end because I am in that SRC folder I hit Enter and analyst things out.

  • I see managed a pie and my try Django configuration folder that has the name off.

  • You know, try Django because that's the name of the Django configuration.