As much as I enjoy building on ASP.NET MVC, it's time to move off Windows.
I'd like to switch to something Python-based with the least amount of pain.
Without discussing the merits of or reasons for switching, which Python web framework is most similar to ASP.NET MVC 3 in terms of architecture?
I'm talking about the flow, not the language.
routes.MapRoute( // maps requests at /Product/ to ProductController
"Products", // Route name
"Product/{action}/{id}", // URL with parameters
new { controller = "Product", action = "Index", id = UrlParameter.Optional }
// Parameter defaults
);
public class ProductController
{
public ActionResult Index(IndexInputModel inputModel)
{
// do something with inputModel ...
var viewModel = new ProductIndexViewModel()
{
Products = productList;
}
return View("~/Views/Product/Index.cshtml", viewModel);
}
// ...
}
~/Views/Product/Index.cshtml
.NET Razor View@model ProductIndexViewModel
<h2>Products</h2>
@foreach (var product in Model.Products)
{
<h3>@product.Title</h3>
<p>@product.Description</p>
<span class="price">@product.Price</span>
}
As you already know, Django is a Python web framework. And like most modern framework, Django supports the MVC pattern. First let's see what is the Model-View-Controller (MVC) pattern, and then we will look at Django's specificity for the Model-View-Template (MVT) pattern.
If you are an expert at ASP.NET MVC, you need not to spend time on some other complex frameworks but ASP.NET WEBAPI is the best one for you. It works on the same lines as MVC – though it doesn't have System. Web dependency.
MVC provides better support to TDD (Test driven development). TDD is related to the test first programming concepts of extreme programming. It helps us to reduced time in reworks and helps create loosely coupled code. MVC enforces separation that reduces complexity of project structure.
Django has some similarities. But python is not strongly typed as .Net, so I think you are going to see quite a bit of differences, no matter which framework you end up with.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With