1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Django vs PHP

Discussion in 'General Scripting Chat' started by macdonjo3, Jun 6, 2014.

  1. macdonjo3

    macdonjo3 Jr. VIP Jr. VIP Premium Member

    Joined:
    Nov 8, 2009
    Messages:
    5,562
    Likes Received:
    4,317
    Location:
    Toronto
    Home Page:
    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: Jun 6, 2014
  2. The Mentalist

    The Mentalist Power Member

    Joined:
    May 8, 2013
    Messages:
    737
    Likes Received:
    267
    Location:
    Inside your head
    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.
     
  3. macdonjo3

    macdonjo3 Jr. VIP Jr. VIP Premium Member

    Joined:
    Nov 8, 2009
    Messages:
    5,562
    Likes Received:
    4,317
    Location:
    Toronto
    Home Page:
    Yeah, been reading lots of tutorials. Just so many 'little exceptions' that occur, and they seem to happen to only so few other people.
     
  4. closedCaption

    closedCaption Regular Member

    Joined:
    Oct 3, 2011
    Messages:
    289
    Likes Received:
    111
    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.
     
  5. Yawn85

    Yawn85 Newbie

    Joined:
    May 15, 2014
    Messages:
    26
    Likes Received:
    1
    I v been speaking with several IT guy to help me build a e-commerce website, they all use PHP, which get me thinking.
     
  6. playerb

    playerb Junior Member

    Joined:
    Aug 25, 2010
    Messages:
    116
    Likes Received:
    54
    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)
     
  7. macdonjo3

    macdonjo3 Jr. VIP Jr. VIP Premium Member

    Joined:
    Nov 8, 2009
    Messages:
    5,562
    Likes Received:
    4,317
    Location:
    Toronto
    Home Page:
    Doesn't mean much. They probably haven't tried both to give them both a fair chance.
     
  8. rob1977

    rob1977 Power Member

    Joined:
    Mar 25, 2013
    Messages:
    773
    Likes Received:
    666
    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.
     
  9. macdonjo3

    macdonjo3 Jr. VIP Jr. VIP Premium Member

    Joined:
    Nov 8, 2009
    Messages:
    5,562
    Likes Received:
    4,317
    Location:
    Toronto
    Home Page:
    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.
     
  10. bicyclethief

    bicyclethief Newbie

    Joined:
    May 29, 2014
    Messages:
    25
    Likes Received:
    8
    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.
     
  11. trustedfire9

    trustedfire9 Jr. VIP Jr. VIP Premium Member

    Joined:
    Jun 15, 2010
    Messages:
    2,102
    Likes Received:
    1,779
    since your good with python , use python with this http://www.web2py.com/ , reddit.com coded
    using python with that framework .......
     
  12. Gogol

    Gogol Elite Member

    Joined:
    Sep 10, 2010
    Messages:
    3,063
    Likes Received:
    2,872
    Gender:
    Male
    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
     
  13. macdonjo3

    macdonjo3 Jr. VIP Jr. VIP Premium Member

    Joined:
    Nov 8, 2009
    Messages:
    5,562
    Likes Received:
    4,317
    Location:
    Toronto
    Home Page:
    Thanks for the framework recommendations. Checking them both out now.
     
  14. rodvan

    rodvan Jr. VIP Jr. VIP

    Joined:
    Jul 27, 2010
    Messages:
    1,226
    Likes Received:
    481
    Occupation:
    developer, marketing, automation, machine learning
    Location:
    Wizard of Bots
    Home Page:
    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.
     
  15. Gogol

    Gogol Elite Member

    Joined:
    Sep 10, 2010
    Messages:
    3,063
    Likes Received:
    2,872
    Gender:
    Male
    ^^ 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.
     
  16. member8200

    member8200 Regular Member

    Joined:
    Aug 9, 2014
    Messages:
    469
    Likes Received:
    33
    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. :)
     
  17. blackminder

    blackminder Junior Member

    Joined:
    Dec 9, 2011
    Messages:
    105
    Likes Received:
    8
    Don't say php is simple to start with. For me php is one of most advanced languages.
     
  18. Gogol

    Gogol Elite Member

    Joined:
    Sep 10, 2010
    Messages:
    3,063
    Likes Received:
    2,872
    Gender:
    Male
    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.
     
    • Thanks Thanks x 1
  19. rob1977

    rob1977 Power Member

    Joined:
    Mar 25, 2013
    Messages:
    773
    Likes Received:
    666
    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.