Как бы мне ни нравилось строить на ASP.NET MVC, пора отказаться от Windows.
Я хотел бы переключиться на что-нибудь, основанное на Python, с наименьшими трудностями.
Не обсуждая достоинства или причины перехода, какой веб-фреймворк Python больше всего похож на ASP.NET MVC 3 с точки зрения архитектуры?
Я говорю о потоке, а не о языке .
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>
}