What is a nice lightweight MVC Python framework?

I know there are a ton of Python frameworks. Can you guys point me in the right direction? My main concern is simplicity, I do not need many extraneous functions. Here are a few other things I want (or don't want):

  • doesn't care about ORM, just want it to work with MySQL
  • has custom routes
  • supports layouts
+66
python frameworks model-view-controller
Sep 16 '08 at 2:44
source share
19 answers

web2py is 265 KB of source code and 1.2 MB is all included (compare with 4.6 MB of Django). Nevertheless, web2py will do everything you need (manage the session, cookies, request, response, cache, internationalization, errors / tickets, database abstraction for GAE, SQLite, MSSQL, MySQL, Postgres, Oracle, FireBird, etc. ) - just unzip and click on it - and you can do the development in your browser.

Web2py has both routes and return routes.

Web2py has a hierarchical template system, which means that a view can expand a layout, which can expand another layout, etc. Views may also include other views.

+43
Oct. 13 '08 at 5:45
source share

Since you obviously don't want ORM, I would stay away from the "full stack" frame if I were you. The Python WSGI standard gives you a ton of easy-to-use options that will give you only the features you need, and even let you choose your work style.

Here's an example: to send URLs, you can use Routes , in which ports exceed the style of sending Rails URLs. Or you can combine Selector with WebOb if this style suits you best.

For layouts, you can use the powerful Jinja2 if you need templates that cannot run code. Or Mako , if you prefer to mix small code with your templates. You can use Deliverance to control the layout of pages consisting of several applications and even several languages!

A full-stack web framework is good in that it offers you many options, allowing you to pay attention only to the application of your building. But the choice I listed above is a good collection so you can build your own. If you go down this path, it will be easy for you to enable Beaker for caching and sessions if you need them, or WebError to help you debug.

I personally am a big fan of ORM (especially SQLAlchemy ), but if you want to go ORM for free and in general you cannot combine the excellent WSGI components available in Python.

+32
Sep 17 '08 at 13:35
source share

Give web.py a try. It is very simple and can provide the minimalism you are looking for.

+11
Sep 16 '08 at 5:45
source share

Pylons.

This is much better than django, and does not come with a crappy ORM.

+9
Sep 16 '08 at 3:51
source share

People have already given a lot of answers regarding web applications, but MVC (or any other paradigm) is not only connected to the network. This is just for clarity.

If you're talking about simple MVC, Pylons more closely matches the paradigm. Django interprets MVC, and they call it model-template-view, but the idea of ​​separation of roles is the same. The actual choice is a matter of personal taste, although I do not consider lightweigth to be either of these (Pylons may seem lighter, but in fact it is not, and recently Django has gathered extra weight - most likely you won’t even go to a small application, for example, to personal blogs at 20 MB).

Of course, nothing will stop you from writing your own structure, for example. with WebOb . You can make it as easy as you want (and learn many things).

+8
Sep 17 '08 at 8:39
source share

If you need something simple, without the need to create your own framework , but still not all included (django), you might want to try CherryPy . It can be used by almost any dispatcher (page / URL routing system). You will also need to choose your own template engine, Genshi is my favorite.

+6
Sep 16 '08 at 15:37
source share

When it comes to Dabo desktop applications, this is a good choice. It is a cross-platform platform on top of wxPython that supports MySql, Postgresql, Firebird and Sqlite.

+6
Feb 14 '09 at 9:48
source share

Do you want web2py. Check this:

  • doesn't care about ORM, just want it to work with MySQL

Web2py does not have ORM, but it does have a syntax wrapper over SQL, which simplifies SQL execution.

  • has custom routes
  • supports layouts

... web2py has both of these options.

And web2py is lighter than django / rails / all that really matters. VERY easy to learn. The most difficult things to learn about MVC are scripts, ORM, and (with django) the template language. But web2py got rid of scripts, simplified ORM, and the template language was just python in the oral way.

+5
Aug 09 '09 at 8:19
source share

checkout https://github.com/salimane/bottle-mvc or https://github.com/salimane/flask-mvc . They are templates that can help you get started with controllers, models in separate folders. They are based on micro archives with bottles and jars, without useless functions, they give you the flexibility to plug-in any modules you want.

+5
Nov 25 '11 at 7:29
source share

Django!

Google App Engine uses it.

I also use it for my own pet projects.

+4
Sep 16 '08 at 2:46
source share

Yes, I would say that Django is definitely the way to go. Its modular design ensures that you can mix and match components (ORM, templating engine, sending URLs, ...) Instead of getting stuck with the component that the infrastructure provides, you can replace it with any third-party equivalent.

+4
Sep 16 '08 at 2:55
source share

web2py! django calls the dispatching view, said the nuf.

+3
04 Oct '08 at 4:35
source share

If you want simplicity, use web2py or pylons. Django is good ... but the learning curve is steep

+3
Jul 23 '09 at 6:25
source share

Django You do not need to use additional features, and it is well designed so that you can mix third-party n-match libraries as needed.

+2
Sep 16 '08 at 2:52
source share

I'm really new to Python, but I tried a bit, especially Django and web2py. I liked the simplicity of web2py, after a few days I was able to create a site of medium complexity. It has irrefutable sets of DAL functions, code generation, HTML hlpers, and for me the most important feature was the full documentation on the site.

+2
Sep 16 '08 at 2:58
source share

I would look at the Pylons ; It is light and fast.

+2
Sep 16 '08 at 20:55
source share

I am also on a Django boat. Here are a few reasons:

+2
Sep 17 '08 at 4:37
source share

Django is my recommendation.

You can find an introduction to it here (Google Tech Talk by Jacob Kaplan-Moss):

And you can also take a look at the Adrian Holovati Story given in Snakes and Rubies , DePaul University:

-one
Sep 16 '08 at 3:05
source share

Although not all Python frameworks explicitly support MVC, it is often trivial to create a website that uses the MVC template, separating the data logic (model) from the interaction logic between the user (controller) and templates (view).

http://docs.python.org/howto/webservers.html#model-view-controller

-3
Jun 09 '11 at 15:55
source share



All Articles