7

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?

Architectural Examples

I'm talking about the flow, not the language.

Typical .NET Route

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
);

Typical .NET controller

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);
    }
    // ...
}

Typical ~/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>
}
3
  • why not ruby? most people, like rob conery, etc moved from asp.net to ruby on rails Commented Feb 12, 2012 at 22:14
  • @ShawnMclean, what kind of questions are those? Why not ruby (coz Rob Conery does it)? Why not PHP (coz Facebook does it)? Why not Java (coz google does it)? Why not XXX (where you could put anything you like in the place of XXX, coz YYY does it)? I mean Stack Overflow is not some discussion board. It's a programming related Q & A site where people should be asking specific questions. Commented Feb 12, 2012 at 22:57
  • 1
    @DarinDimitrov its a suggestive question. Now calm down, not because the guy is trying to find something outside of windows you have to flip out like that. :( Commented Feb 13, 2012 at 4:32

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

4 Comments

Django is the gorilla in the room. I do like the strong-typing aspect of .NET, but let's look past that. Are there any other frameworks to consider?
Actually Python is strongly typed
.. though typically what us strong-type lovers are looking for is static typing. That is, the ability to know at compile-time (and in a good IDE, as we type the code) whether we are making a bonehead mistake in what we attempt to pass as a parameter. Good News: Python 3 function annotations can be used by an IDE (e.g. PyCharm), to declare types. python.org/dev/peps/pep-3107 Finally, the best of both worlds! (Or so I hear .. working in an environment that hasn't yet switched from 2.7)
stackoverflow.com/questions/6318814/… talks about PyCharm and declaring types. It turns out that for Python 2, PyCharm can extract type info from traditional (""") python doc comments.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.