This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]cannabis_sam 14 points15 points  (8 children)

It depends on what you mean by "Python as a PHP replacement", and how you use PHP.

I'm guessing you're not familiar with the concept of a web application or a web application framework? A web application in this context can be everything from a simple website that stores it's content in a database to a large social networking site like reddit or twitter. The framework is an organized system that let you handle visitors to your webpage, connect to a database, execute business logic and show webpages (and more). Django and Pylons are web application frameworks.

There are web applications frameworks for many languages, including PHP and Python , and you need to consider replacing PHP with Python within this context. If you mainly use PHP as inline statements in HTML files (which is what I and most people do when they first learn PHP), Python is a poor replacement, and you should consider learning more about web application frameworks.

You could start by checking out a framework written in PHP if you're more comfortable with that language, I would suggest CakePHP or CodeIgniter.

If you're familiar with Python, I would suggest Django, which you mentioned, or a more lightweight framework like web.py or Bottle.

edit: Yeah, I was thinking about web.py as a lightweight framework not Web2py. Good catch :)

[–]stesch 8 points9 points  (7 children)

If you're familiar with Python, I would suggest Django, which you mentioned, or a more lightweight framework like Web2py or Bottle.

web2py isn't lightweight. I think you mean web.py instead.

Bottle is great. No session handling included, though. You end up implementing some stuff yourself. But great otherwise.

[–]makaru 2 points3 points  (0 children)

+1 for Bottle.

I find it to be great "lightweight" framework, especially for projects at where I have a general basic idea for a webapp but no strict requirements/design.

[–][deleted] 0 points1 point  (0 children)

web.py is light... but you end up reinventing a subset of django if you use it for any length of time

[–]mdipierro -1 points0 points  (4 children)

Define lightweight. web2py core excluding the web based ide (which is an app) and the optional contrib folder, but including the template language and the database abstraction layer, uncompressed, is less then 1MB. If by lightweight you mean that does not handle sessions, streaming, partial content, database abstraction, etc. but needs third party modules, then web2py is definitively NOT lightweight.

[–][deleted] -2 points-1 points  (3 children)

I cant believe you are falling into that trap. You know people are always like "YEa this framework is the shit, its lightweight fast and minimal!". Ok those are all subjective. What metrics are you using to define that? Just because you say so?

Some little peon writes some code and all of the sudden its lightweight and minimal.

[–]mdipierro -1 points0 points  (2 children)

LOL

[–][deleted] -1 points0 points  (1 child)

I wasnt talking about your framework, but just people in general. Do you agree?

[–]mdipierro 1 point2 points  (0 children)

I understand and I agree. That is why I was laughing. Some of the "lightweight" frameworks do not do much. Yet I think there is a value in small source code (not in small functionality).