The 4 best ways to deploy a Django application

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video I'm going to explain the different options you have for deploying a django application to production now this isn't going to be a hands-on video I'm just going to explain to you the different options that you have at a high level so then you can look into each one in more detail and you can choose the one that is right for your particular project the first option we're going to cover is installing directly on a server so this works by creating a virtual server typically a Linux server and then installing all the dependencies that you need for your general application so this could include things like nginx or Apache web server Python the correct version of Python that you need and then a Python virtual environment and then you just install your project on our server and you run it this way is kind of an old-school method that I haven't seen used so much in recent times because when you do this you set up your server with a lot of custom configuration and a lot of different moving parts that are quite difficult to replicate this means that it could be kind of tedious to set up your application to begin with and then if your if your server ever fails or you need to create a new server it's a bit tedious or complex to recreate that same configuration on another server because you would have to make sure you have all of your different configuration files and all the commands you ran on that server back time so it's not really a recommended approach in 2020 and what recommended approach would be to use something like docker to containerize your application this leads us onto deployment option number two which is to use docker compose to run your application directly on a linux server the way this works is you would set up a linux server just like you would do for option one except this time instead of actually manually configuring all of the different applications and installing them directly on the server you would run your service using docker compose so you create your application and you set it up to have all of the dependencies installed in docker and then you simply run the docker compose file on the server now it's not the best approach however it is a good approach if you're just looking to get a Minimum Viable Product up and running so if you just have a product that you want to get out there and you want to make it accessible and you want to launch it without having to put much time and effort into the deployment then this could be a fairly simple approach for you because all you need to do is create the server copy the files the project files to the server and then run the doc compost file now of course if you do this then your application is going to be running on a single server which is never a good idea if you have an application that you want to be online for a long time or you want to handle lots and lots of users because it's a single point of failure and it's also very difficult to scale your application because you can't easily create more servers as your user base grows so this can pose some issues down the line if you're looking for a long-term solution for hosting so this leads us to option 3 which is to create deployment using a managed docker orchestration service and this could include something like AWS ECS which is elastic container service or qu Benes which runs on all different cloud platforms such as Google cloud AWS as your and a number of others so the benefit of this is allows you to run your containers in a service that orchestrates deploy those containers to different servers so you could set up multiple different servers and you can use this tool to spin up and create more tasks of your service and spread them across multiple different servers so that makes it a bit easier to manage your application and also allows you to easily handle scaling up your applications so if your user base grows you would simply just create more tasks in your managed service such as kubernetes Ortiz yes you would just create more tasks to handle the load and then it will spread them out and once the servers that you have available and something like AWS ECS also has a service option called fog a which is also very handy because it means you don't have to manage any of the underlying servers that are actually running applications these are all managed by AWS themselves so the drawback of this is it might be a bit more expensive because you need multiple servers in order to just run a basic single task in most cases no but in a lot of cases you need to have at least a management server and then a server to actually run the docker containers and there's also sometimes a charge for the actual service itself so if you're using NCS for gate or if you're using Google clouds kubernetes on Google cloud then you may be charged just for the management service that manages the tasks that are running and it's quite complex to set up so it's not the most straightforward method of deploying your application but it does allow you to create a more scalable long term solution that leads us to the fourth option which is to use a server list technology so a good example of this would be something like Google App Engine so this allows you to run a totally service application in the cloud now the benefit of this is that you don't need to manage any infrastructure at all so as the name suggests it's serverless so there's no servers for you to manage or maintain this removes a lot of overhead for managing your application because if you're using something like Google cloud then Google will manage all of those servers for you you know that you have a very scalable and secure architecture that is running on and you don't need to put any time or effort into managing the servers the downside of this is that you're tied in with the vendor so Google Cloud or Google App Engine on Google cloud is quite cheap and it's quite an affordable way of deploying it if you have a small app with not many users so in a lot of cases it's totally free unless you have a large number of users however if they decided to increase this in the future and make it more expensive it would be quite challenging to move away from them because you need to build your application specifically to run on the server platform and this may be a trade-off that you're willing to take however if you're not willing to take that then option 3 is probably better because it gives you more flexibility you can create your application using docker and then you can use many different vendors to deploy your docker containers so there are the four main ways that you can deploy an application I hope you found this video useful if you did then please give it a thumbs up and if you're interested to learn more about deploying to a docker orchestration service like ECS that we have a course specifically teaching how to deploy a django application to Amazon ECS and in that course where you use docker AWS and terraform and we create an automated deployment to automate deploying our server from gitlab okay so I hope you find this video useful thanks for watching
Info
Channel: London App Developer
Views: 108,302
Rating: undefined out of 5
Keywords: ECS, AWS, Docker, Serverless, Fargate, Deployment, Automation, Server, DevOps, Terraform, AWS Fargate, Best way to deploy django app, best way to deploy django application
Id: IoxHUrbiqUo
Channel Id: undefined
Length: 7min 0sec (420 seconds)
Published: Sun May 24 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.