Django vs PHP

macdonjo3

Elite Member
Jr. VIP
Joined
Nov 8, 2009
Messages
8,887
Reaction score
9,192
I'm trying to move from desktop based to web based applications. I thought since I know Python really well, Django would be a good bet but it's been such a hassle trying to setup django and especially virtualenv (which still has unresolved problems). PHP seems to simple to get started. Every web host pretty much supports PHP, while Python needs a VPS with Python installed and then you got to match the versions of the interpreter and the modules, and then make sure the right python is executed since most VPSs come with an old stable Python which probably isn't the version you wanted to use. On the other hand, they say Django is really efficient and can save you a lot of time, which I've been learning about while trying to deal with virtualenv. Hopefully I resolve these issues with installations, interpreter paths, etc and can move on soon to actually building some Django apps.

So in this industry, what language/framework do you prefer of the 2 to build web apps, and why? Have you tried both?
 
Last edited:
I'm in the process of developing my first web app. And as I'm expanding my knowledge in javascript frameworks and server side development I'm discovering that PHP seems to be the "easy" fix. As in it's relatively easy to tie in with MySQL, and it takes less time to code your application with a PHP based stack. But if you are looking at an application you need to be able to scale, or run efficiently, PHP usually isn't as good at those things.

If you're learning and developing, kind of like I am, I encourage you to maybe just work through a tutorial on virtualenv, it looks like there's a few out there, and then it'll benefit you during development and management after deployment.
 
Yeah, been reading lots of tutorials. Just so many 'little exceptions' that occur, and they seem to happen to only so few other people.
 
Django is more slick but harder to host as you already noticed. Both can be used to accomplish same things, but with Django you can do it a little bit faster.
 
I v been speaking with several IT guy to help me build a e-commerce website, they all use PHP, which get me thinking.
 
you can always use CGI to interface with your python scripts, chunky af but an easy starting point (esp when it comes to shared hosts etc)
 
I v been speaking with several IT guy to help me build a e-commerce website, they all use PHP, which get me thinking.

Doesn't mean much. They probably haven't tried both to give them both a fair chance.
 
I actually like both my favourite is python, however deploying php quickly up until now, (due to learning times and project urgency) has been how I have worked.

I will be moving over to django in slow time, it was just more convenient at the time to use php.
 
I actually like both my favourite is python, however deploying php quickly up until now, (due to learning times and project urgency) has been how I have worked.

I will be moving over to django in slow time, it was just more convenient at the time to use php.

Yeah, it seems to be the quickest way to get up a simple web page with a form. IPNs are almost entirely PHP too it seems.
 
You're comparing apples to oranges here, as PHP is just a general purpose language (with a focus on web page scripting) and Django is a web framework with a lot of built-in functionality that you don't get if you use PHP on its own. It would be better to ask whether you should use Django or a PHP framework such as Laravel, which also comes with a lot of free functionality.

You are right that Python-based web applications are harder to host. There is no way around that. With PHP, you can just drop your scripts into your htdocs directory and you're done, but with Python you're going to have to install mod_wsgi for Apache, resolve all your dependencies, etc. (It actually becomes very easy to do once you figure it out the first time.)

I have built web applications using Django and pure PHP without any framework sitting on top of it, and I found Django much better. The framework keeps you honest and keeps your code organized nicely, while removing the need to code lots of basic functionality such as authentication. Yes, it was easier to get started with PHP, but even with the additional deployment hassle at the start, Django paid for itself many times over with increased productivity towards the later stages of development.

Think of it this way: you only have to figure out how to deploy it once, but you'll have to live with the code you write for a long time, so you should choose the solution that enables you to create a friendlier, more understandable code base. In your case, that would probably be Python and Django. Of course it is possible to write nice maintainable code in PHP, but I find the language tempts you to do horrible hacky things. I wouldn't write it without a framework these days anyway.
 
Welcome to PHP. It's easy to setup and dive into. As for myself, I prefer using "Yii framework" for my applications. Since you have experience in programming already, I would strongly recommend Yii over any other frameworks if you decide not to go with core php and develop your own MVC framework.

and then.. we have wordpress shit haha :p
 
Thanks for the framework recommendations. Checking them both out now.
 
Ive been very happy using Laravel lately. There are nice tutorials on Laracasts.com and it has great libraries on Composer Packagist.
PHP has many many open source classes you can reuse. Im not sure about Python since I have never digged in into it.
 
^^ Yes Laravel is quite cool as well.. It's more sort of a trimmed down framework though. I mainly use it for better request routing.
 
I recommend php, easy to learn and implement. Since you have knowledge in programming, i guess it won't be that hard.
almost all web frameworks are with php. having a knowledge of it would be easier to work with web frameworks. :)
 
Don't say php is simple to start with. For me php is one of most advanced languages.
 
Well that's te beauty of this language. IT IS easy to start with and has almost every advanced features you will ever need on a server. Frankly speaking, it took me a project and 15 days to learn the basic. Since then, never had to look back.
Don't say php is simple to start with. For me php is one of most advanced languages.
 
since your good with python , use python with this http://www.web2py.com/ , reddit.com coded
using python with that framework .......

Just had a read through the paperwork, I have one question, (that I know would be answered if I downloaded it for a play) do aps function through rollbacks to the web2py server or is the application downloaded and hosted on your server?

The actual mechanism wasn't clear unless I missed something.
 
Back
Top