Django Interview Questions (Junior Developer)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey what's going on everybody so in this video we're going to talk about the interview process for django developers and questions that you might expect and we'll go over some answers and why they're being asked here so the list of questions that i have here is actually a compiled list of real interview questions from when i was applying so there was a period in time when i was applying for django positions so these are questions that were asked of me and also questions that i used to ask candidates when i was doing the hiring so about three years ago i was in charge of hiring developers at my company so i had to put together this list and i put it together very strategically to understand a candidate and try to evaluate them so it helped me learn a lot about a candidate so i want to give you the perspective of what i'm thinking here why i'm asking them and then by knowing why i'm asking them and what i want to see maybe it can help you or it should help you in your process and maybe give better answers here so the thing about these interviews is uh not every interview is going to be the same that's going to completely change on the person interviewing you the job the position the company so i'm going to try to cover as much as possible here but do understand that you might have an interview that's way simpler than this and a lot of them probably will be simpler as far as the questions and some may be harder depending on the position so i just want to try to cover as much as possible in the the fake position that we're creating here so the imaginary position is for a junior level django developer so the expectation here is that somebody that takes this interview is going to be able to understand django we want somebody that knows django that can study the company or get familiar with the company system and then somebody that can be effective pretty early on so the expectation here is that you know django but you're going to be in a junior position you're not going to be some kind of lead here we just want to plug you in so that's what i'm looking for and with that being said let's start with the process of the assessment test and the portfolio or the resume here so there are companies that do assessment tests i've never done this and this is before that interview process and this is where companies filter out candidates before they bring you into this interview process so just to get that interview obviously the assessment test if you're doing that you want to know a lot of the answers here but i used to do just a portfolio and the resume so once i filtered out let's say out of 200 candidates i would bring in 40 maybe 30 for an interview then that interview process started so the first thing i would say about the interview process is i would advise you to try to control the interview in a good way and if i brought you in it means that something about your resume stood out something about your portfolio so try to focus on that because my first step here is not to have a q a session i want to build rapport i want to build a relationship and try to understand the person that i'm interviewing so if i'm asking you about a project and that's usually what they'll ask you about former projects uh what are you currently working on your past jobs try to give more answers than just yes or no questions or these one-liners try to expand upon it and try to go into detail because if you go into detail you can tell me a lot about what you know just from that process i can start to understand and in this case instead of going through my list of 50 questions i'm able to know that okay if you've built this these many projects and clearly you understand based off of what you built how to set up a django project i don't need to ask you that question so you're eliminating questions by giving good answers just on that on those portfolio projects and so on so what i'm doing here is i'm judging you based on the portfolio projects and or your resume and a combined result of all your answers to the questions so i'm not trying to i'm not trying to stumble you i'm not trying to trick you most interviewers will not try to do this they just want to make an overall assessment so don't worry so much about getting a question wrong if you're answering it and you don't know it you can even say if you've done it a bunch of times say wow i've done this a bunch of times i'm just blanking out i don't remember what the exact command was but i think it's something like this try to elaborate on those questions that's going to help me understand that hey you just didn't remember the exact code and that's okay that's understandable so that's just some pretext to that and the portfolio and how you're responding that's the first uh the first questions here so let's go ahead and uh start with the actual questions here so the first thing i'm gonna do in this process is i'm not gonna go straight for django i'm usually going to go for the prerequisites so right away i'm probably going to start with python so i want to know your python skills usually i'll just ask you how familiar are you with it what have you done with python maybe some basic questions but i would probably ask you what courses have you taken what books where did you learn it just to try to gauge that i don't want to spend too much time on that but obviously if you're a django developer you'll need to know that so after that i'll probably go into html and css so this is going to be the second question what's your knowledge of this at this point i just want to know that you have a basic understanding unless the position requires you to build out and design templates i'm usually just making sure that you have that part covered you can work with html and css preferably some front-end frameworks or some css frameworks like bootstrap and so on so i just want to get you familiar there check that off the list and javascript now if you didn't know javascript for this position i guess this imaginary position i wouldn't dock you for it but it would be a nice plus so as a web developer there's a good chance you're probably going to need to know javascript at some point so if you know it great if you don't it's not going to necessarily hurt you but if there's a candidate that knows that and is maybe more advanced then i would probably prefer that candidate based on other measures so javascript html css and in python here so remember javascript is not something i'm going to judge you hard on is just going to be something that i want to know if you understand it because that's a nice plus so as far as django the first questions here let's go ahead and go into that typically i'll go ahead and ask you what is django so depending on how that portfolio interview process went uh if i didn't fully understand that you know it very well i would ask you what is django and i'd like to see a typical response here and a good response would just let me know that django is a back end python based web framework um if you can compare it to if you can maybe reference a flask framework or mention uh frameworks from other libraries say it's kind of like express and node.js or php in larval i like this because i'm understanding that you know what frameworks are if you mentioned a couple of front-end frameworks it's not a must to mention those but it's going to help me understand okay he knows what frameworks are or he or she knows what frameworks are and we don't have to go too far there so another question i typically like to ask what is or which is a what what can you build in django so i want to know that you understand what django is used for uh and the response that i would usually go for is typically people say something like a social network an e-commerce platform but a good response that would help me understand is if you reference companies that used it so it helps to know this so in this case if you mentioned um really its capabilities are anything but companies like udemy use it pinterest instagram dropbox uses it i believe youtube uses it then i'm understanding okay you know django and you understand that it's capable of a lot you're you're understanding what it's done or what it can do and if you mention maybe apis that it's good for building out apis that's a good response i would really like to hear that so i'll definitely uh yeah i would understand that you know what django is if you didn't know what you can build with it or what django was or front or back-end frameworks are i would be a little bit concerned there so i want to make sure you understand that so then i go into a section of basic concepts and commands so this is where i'm just like rapid fire just trying to make sure that you you've worked with it before that you didn't just hear about it uh usually i'm judging pretty lightly here because if you don't remember exact code that's gonna be fine um i understand that you can just google things up but as long as you know most of them and uh you're able to to give me yeah just to try to give me explain what's going on here i would i would uh i'd be pretty forgiving here so the first thing i'll probably ask is what's the difference between a project and an app here so a good answer is the project is like an overall environment it's your basic website in a sense and an app is like a component of that website an app is really where you hold the project logic and the project itself can be composed of many apps here so really the project is the configuration and apps are components of that website and if you gave me an example uh one example i like to use is facebook.com so that's like your project and different apps would be like the news feed maybe groups so different components of it if you can structure that out for me try to give me some analogies here i would understand that you know the difference between projects and apps now if you don't i wouldn't judge you too hard there because the the actual answer might be difficult to explain but as long as i can see that you can see that there's a difference and maybe what it's used for i wouldn't i would be able to accept that answer here so uh commands here so the next one so after what's the difference between a project and app would probably go into basic commands like how do you start a project the answer would just be to use django dash admin start project and then the project name how do you start an app that would be another one that's python manage manage.py star app so the start app command there and then the app name how do you run a development server so i'm just going through the basics here and the answer to that one would be python manage.py run server so you're starting your development server from your project directory here so another question here is going to be give me your best explanation so i always like to have this question on there give me your best explanation of the settings.py file so even if i understood that you knew it i'd like to hear what your thoughts are on it and at this point i'm just judging your maybe technical understanding of django and an answer that would be acceptable would probably be something like settings.py is your project configuration and i would ask you what you use it for the answer for that would be like your database connections uh configuring your apps and the overall command center to the project so if i can get an answer like that that's acceptable here so after that i'll probably go into the the mvt structure so there's the mvc mvt structure now i don't like to just ask what is the mvt and explain that to me because that gets into the part where you're just asking very technical jargon and i remember in my first two years i wouldn't be able to give you a good explanation of it even though i understood what it was so the way i asked it was what are models what are views and what are templates and how do they function now an acceptable answer for this would be something like if it's models i would say models are a class-based representation of database tables so they represent our database structures and the view is basically the business logic and what returns back what gets triggered and returns back templates responses and so on so i can accept that i can see your understanding what a view is there now the template layer this is just returning html templates so i can take that answer i would a response i guess would be something like this is where we store templates and views are typically returned using or views typically return templates so something like that i'm not looking for anything too technical i can see that so that's just the mvt structure so then i would ask you what are url patterns so i just want to know that you understand how to configure urls here pretty basic level stuff so if you just let me know these are url paths to configure maybe the website's routing so per url what's being triggered it's kind of like your freeway of or your exits and so on on a freeway so it's like connecting urls to views and it's a navigation to the website so something like that if you can give me a generic response there as long as i can see that i would accept that and i also want to know about the django admin panel so what is it um a response if you just let me know that this is something like a quick setup that django provides kind of like a graphical user interface to see your data to connect with it it comes built in with django i can accept that i just want to know that you understand what that is because it is a key feature even though i personally don't use it too much it is a key feature of django and something that any beginner should know so make migrations and the migrate command so i always ask this i would just say tell me what make migrations and my gray is and i'm not looking for the details of each one but if i'm asking you what make migrations is a response like this configures and basically creates the basic migrations and preps your database for changes um even though that's not the official technical response i could see that you get what's happening here and then migrate i would just say let me know that this is what actually enforces those changes and it applies changes to our database so i can take that that response there too so the next question is do you have a preference when it comes to class-based views or function based views why or why not so the reason why i'm asking this is because there's some misunderstandings here there's people that think class-based views need to be used some people think they don't need to be used at all and i just want to know that you know what class-based fees are that's really what i care about i would like you to understand how to work with them but i really don't care what your preference is i'm just trying to pull information out of what you think uh what you think about them and and if you know what class-based views are i guess that's probably the best way to sum it up i'm trying to get an understanding of what you know i really don't care what you use unless our company uses a certain structure but if you know what they are we can teach you that that's not an issue so i wouldn't put too much weight there so what database systems do you prefer to use with django so all i want to hear is something like postgres mysql oracle heck if you want to use mongodb i don't care my my biggest thing is that you know that there are these database systems and you're not just using the default sql so or the sqlite database so i just want to know that you know something beyond that because we're not going to use sqlite in real websites here at any company so i just want to know that you understand how to work with that and the follow-up question to that is typically how do we set up a database connection so the answer to this and what i'm looking for is that you understand how you can actually connect a database and the answer to this would be something like in settings.py there's a database variable it's actually a dictionary and this is where we can update modify our database connections like if we're connecting to postgres just let me know where it's at and all understand that you at least understand the process and that you know how to go through that so that's kind of like the the basic commands and uh or the basic concepts and commands so this is where i'm just rapid fire making sure you know the basics here and the next part is i want to go into urls here so this one is pretty sure this section what i usually do is i just ask you what dan what are the dynamic ways we can access urls here so and why do we name urls so the formal question is why do we name urls and what are dynamic ways of accessing them in our views and our templates so i just want to make sure that you're not hard coding urls and that we're using that name value if it's there we might as well use it you don't necessarily have to use it in projects but i want to make sure that you understand it because it is a valuable part of django so if you don't understand what that is i'll make sure to put up a screenshot here and then circle that part there so after that i would want to make sure you know how to use it so i'll ask you to give me an example so the answer here would be to where if you're adding in a link in a template you're not just using the href tag you're not just adding in forward slash and then like login we're adding in the curly braces i believe those are just code blocks or tags i forgot what they're called myself and you're just adding in the url name the reason why we want to do that if you can give me a good example to why we're using that that is a big plus and the reason why we use the url name is because it makes it more dynamic this way we're not having to hard code the path and it's really good for if we happen to change the url path so if we change something up but the name stays the same then that dynamic value changes and it keeps our code clean from having to go through and update everything so after urls i typically like to go to templates here so we'll go here and at this point i want to know what you know about template tags if you understand template inheriting including and the first question in this section is usually where do you store your templates so the two answers i could accept here is there's different ways to to store templates but i would say either in the default app structure so django apps typically tell you to store in a folder called templates in a subfolder called whatever your app name is and then you can put all the templates there or if we want to completely manually assign this value we can go into settings.py and there is a templates variable so in there there's a variable and then there's a list called directories all you have to do is let your project know where the templates are and then in theory you can store them you can store them anywhere you just have to set the file path to that folder and let django know where to find them so next i want to go into template tags and understanding the templating language here so if you mentioned jinja to me right away i'm going to understand that you probably have a good understanding of what what this is if you know jinja you probably understand the structure here so um i would ask you what do the double curly braces mean and i would show you probably an example of that so in interview questions i would just say that and explain it and an answer would be something like this is just a placeholder for variables this is how we can output dynamic data i can take that so now i know you know how to pass in data and then set variables in the template and then i'll also ask you what do the curly braces mean with the percent signs so those tags that we see those a good response would be that those are just code blocks this is where we can write pythonic like logic in our templates and i'll probably ask you to give me some examples how would you write a for loop an if statement in any kind of conditions in our templates if you understand that i get that you know how to work with the templating so after that i'll probably ask you how to include and inherit so a good answer for including a section of another html template would just be to use the include tag so i'll take that as an answer and how do we inherit and extend a template so i'll typically want an explanation here the further you can go into that the better i want to hear something like uh we add in a blog tag into our blog yeah block tag into the parent template so let's say we have a template called main.html and then we can just use the includes tag or extends tag in the template where we want to extend it and then add in block tags and that would just extend the template so maybe we can elaborate there but an answer like that helps me understand that you know it and that's it for the templating section so after that and you can see i'm going through like the basics of django here so we started at the basics we went to urls templates and then the next section is static files here so what are static files and how do they typically get included or what what is in uh what are what's in static files typically so an answer would just be just let me know that this is where we store files like html files css files javascript files not html files but css javascript images any kind of just static files i guess and we typically store them in their own folder a response like that i would accept there so how do we configure our static files in development so at this point you know what static files are how you configure them this is more of a technical one i'm not going to dock you too much for maybe missing the variable name but i would like to know that it's in settings.py so the answer is that you would go into settings.ui and you would set the static files directories variable and then that's just going to be a list pointing to wherever we want to include our static file so it's kind of like the templates where we're letting django know where we're storing them now i would like to ask what media root is so this is something that i ask a lot and a good answer here just let me know that that is where we upload user-generated content and we'll go into collect static so at this point if you stumble here a little bit as a beginner i'm gonna be more forgiving but i would like to know that you can pick up on this quick but i would say what is collect static and the answer is this takes all of our static files from what we set in static root in a sense it bundles them duplicates them and it preps our files for production and how we deliver them but it in a sense controls how we how we output our files and where we place them see i'm actually stumbling in this question and this is where when i'm interviewing somebody i understand that they may not have the best answer on spot we're not we're not dictionaries here so that's actually a good example there so collect static files yeah that's pretty much yeah i think that was the only question that i had for that so static files are not meant to be django doesn't serve static files in production it's typically not designed for that so i would ask you how do we serve static files in production and there's a a whole list of questions and all i want or a whole list of answers that you can give here all i'm looking here or all i'm looking for here is that you understand at least a few of those options and you understand that there is differences between storing static files locally or in in our testing environment or when we're going to production so if you tell me something like one option is aws s3 another one is to use third-party packages like django white noise if you mentioned a few others that would be good enough for me i'm not looking for anything too advanced here just to know that you know the difference and then maybe a few of those options anything else we can teach you at the company what our methods are of doing that so after that we'll go into the models file so i want to make sure you know about this and i don't want to ask you every question about models but what i would do is i would just set you up with some basic questions and just see what you can answer here so typically what i like to do is just ask people what is foreign key so this is the model attributes here so let me know what that is the answer for that would be this just sets a one-to-many relationship between one model and another i'll go into a one-to-one field that should be easy for any beginner it's kind of self-explanatory but that just sets a one-to-one relationship if you don't know what relationships are that's something that i would definitely expect you to already know now there's the many-to-many field so the the answer to that would just be that there this sets a mini to many relationship i might ask you what are many too many relationships try to go into that and then just kind of the one that i would throw in there randomly would be what is the character field attribute so that's an easy one if you let me know that's just a string value maybe an alternative is a text field uh i i'll pretty much leave you alone for the models it seems like if you answer those you understand what's going on here so after models i would move on to database queries here so at this point i just want to know that you can make basic queries to the database you can get multiple items get a single item and filter them so questions would be like how would you query all the items in a database table the answer would just be model name dot objects dot all how do we how do we query one item from a database table the answer to that would be model name.objects.get and then query it by an attribute how do we filter items how do we filter multiple items or how do we filter items by multiple attributes so let's say you're trying to filter a user by first name and last name so i would like to throw that in there see if you understand that and one that beginners get confused on here is what does model dot model model name underscore i'm actually having a hard time worrying this but basically when you see underscore set and then all or dot filter i'm trying to figure out if you know how to query child model objects here so i will throw that in and i would like to see if you know how to do that and also if you know how to query upwards so can you give me let's say if we have an article and a user how would you get a user out of an article model so in this case something like uh go to go ahead and get that article and just do article.user so can you query backwards can you go up that chain and get parent elements so basic queries to the database understanding how to work with that get elements uh that would be enough for me for a beginner level position so at the end of it i usually close it with some more generic questions this is kind of like that opening where i'm just rapid fire asking questions not so structured for a certain category usually i'll just go through here and i'll ask what are csrf tokens any answer like this helps against cross-site 4g forgery attacks and maybe when to use them like on post put request delete request here and that we typically send these with our form so we're just protecting our data here and any explanation like that and just how to use them would be enough for me i like to use model forms so i always want to make sure that even if you're not using them you understand what model forms are the answer to that would just be that this is a class-based representation so it's like a form that makes a it's basically a form that gets generated based off of a model so let's say if we have a customer model we create a class inheriting from forms from the form object i believe that's how to say it and what happens is when we use that form it just auto-generates the fields all the fields or the specified fields so if you let me know that i see that you know what's going on here and we'll just go over that one pretty quick so what is a django rest framework and why do we need it so most projects are going to require you to go beyond just understanding the basics of django but also understand drf because a lot of applications either use front-end frameworks or need some kind of api so this isn't going to be something that i'm going to hold against you but i would like you to know it it wouldn't be good not to know at least what it is but the answers would be answers i would take because this is what we used to build out apis here and maybe mentioning some kind of like process in a front-end framework like this can be used or this is typically used because we might want to use react view angular for a front-end framework or just more javascript and it helps to build out that api so that kind of answer i would accept now i do like to know that you know about signals that's also a good one so i'd like to get an example of that i'll answer for you right now so signals are a way of knowing what's going it's a way of letting us know of what's going on in a different part of our application so an example i would like to see from you is let me know that it's something like um if a user model is saved basically we send out a signal sends out it sends it to our receiver and it lets us know that the user model was saved and now we can perform another action so something along those lines i would go back and forth and discuss this with you ask for some more examples but that's a that's a good answer there i would accept that so the question the last question here is this is the last one actually no it's not the last one on my list so we have another one here and this is how do we get an unauthenticated user from viewing certain pages so how do we set some user restrictions so there's a few options here for the answer a few out except because this is done in many different ways you can use middleware for this we can use decorators we can custom build our own decorators if we're using class-based views we can use mix-ins for this and we're not mix-ins but we can just set the permissions classes if you give me something like that maybe setting it by user roles or user attributes that would be good enough for me i just want to know that you understand that process and the last question that i formally have here on this list is what are serializers and model serializers so the answer i would take here is that serializers are basically or serializing data is a way of taking our python data and turning it into something like json data xml there's different formats here so a model serializer is something that we can use kind of like a model form where we create a class based on around based around a model and then the data in that model gets turned into json format so that's it for my formal questions um i typically like to go into more of an open discussion i would have my list of questions that i'll go out and use here these are questions that i got a lot usually i was asked to do more let's say just project-based stuff so in my in my case i was asked a lot of these questions and i was asked questions about things like authentication uh maybe logging users in just talking about how demo applications are built so this is what my experience has been but what i noticed is like i mentioned earlier when i give a good answer to my projects and i can build good rapport with whoever's interviewing me the conversation completely shifted because if somebody knows the application that i built out for example in my case i built out real applica a real application for for uh for a laboratory built out a pretty big system using react and django on the back end react on the front end there was no need for them to ask me a lot of these questions you don't want to ask me about static files if you see that i've clearly built out big applications it's obvious that i know it and that's what i mean by uh having a good conversation there and having good projects now if you don't have them it helps to to understand this stuff so i hope that gives you some form of idea i try to do this a little bit more informally i know that maybe my answers weren't the best here and how i'm explaining things but i want to give you an idea of what to expect and what i want to see out of the answers as far as yeah what to expect in response here and what i'm looking for so i'm trying to gauge a basic understanding if you know how to do this i can add you to our team most likely and have you you know build out components of our site or work on smaller features but as long as you understand the core functionality so that's it for this video i hope to hopefully or i hope it was helpful hope you guys enjoyed it take care
Info
Channel: Dennis Ivy
Views: 119,842
Rating: undefined out of 5
Keywords: Programming, Software Developer, Dennis Ivy, Dennis Ivanov
Id: 9ai0b1LRMQM
Channel Id: undefined
Length: 30min 26sec (1826 seconds)
Published: Wed Feb 17 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.