PHP to Python – Framework Considerations for Migration

djangoframeworksPHPpythonweb-framework

As a long time PHP developer, I am now starting to explore the Python world.

I have narrowed the choice of framework down to Django and Pyramid, probably no big surprise there. I have played a bit both both frameworks.

I really like Djangos admin, and the fact that everything is already integrated. My concern with Django, however, is that it appears more difficult to break out of doing things the way that they want you to. For a large complex site, that could be problematic down the road. Is this a valid concern?

What really caught my eye is that the community for Django seems MUCH larger. Let alone the massive number of docs and tutorials for Django (couldnt fine much for Pyramid outside the official docs?). Of biggest concern is the sheer number of apps that have been built specifically for Django: south, tastypie, multi-tenancy, registration, etc. Am I right to assume that these apps are (mostly?) Django specific, and that they cant be used in Pyramid? Where are the Pyramid specific apps? Or, will they interoperate just fine?

Best Answer

The short answer is to learn both. It's always good to have a lot of tools in your tool belt.

The long answer, though, is to learn Django first and then add Pyramid in later.

Your first reaction to the breadth of Django documentation and resources available is the right one. As you're picking up python, you'll find more help for building, deploying, and scaling your Django apps than you will your Pyramid apps. You'll learn how to do pythonic web development and how to use the language to efficiently meet your business requirements.

Lots of large applications use django - Instagram and Disqus come to mind first. So you don't have to worry about how complex a django app can be. Here are the dev blogs for both of those companies:

http://instagram-engineering.tumblr.com/

http://code.disqus.com/

Coming from PHP, you'll find a few things about Django that will be more obvious as well. Take, for example, retrieving POSTed form data:

PHP

$foo = $_POST['bar']

Django Python

foo = request.POST['bar']

Pyramid Python

foo = request.params['bar']

Once you've built a few Django apps and shipped a thing or two, then go and learn Pylons or Flask and add SQLAlchemy to your tool belt as well.

Related Topic