

Ask HN: Learn PHP or django? - butwhy

I primarily work in ops but want to explore some dev work. Is it worth picking up PHP from scratch (I don&#x27;t know any), or learning how to use django? I&#x27;m wondering what is easier.<p>I know a bit of python right now so that could make it better to pick up django, but I&#x27;m not quite how sure intertwined they are. AKA. if you have an existing python script, how much would be involved to integrate it with django and display output on a webpage. And as for PHP, I suppose I would like to avoid picking up another language (AKA if I improve my python.. it could help my serverside scripting as well as for web stuff, whereas PHP is only web), but would do it if the barrier to entry is easier&#x2F;quicker than django.
======
markbranly
PHP is _not_ Web only. You can write CLI tools and server scripts with it.
Look at Composer. That is pure PHP.

PHP is a highly marketable skill. WordPress, with their mission to power 50%
of the Web, is PHP. Not to mention … the Book of Faces.

There are modern frameworks for PHP like Laravel that play the same role as
Django.

But, if you're learning a new language, why not JavaScript? Everything is JS
now—server side scripts, full stack Web dev, "Internet of Things." It is well
on its way to Total World Domination.

~~~
butwhy
Good points. And I'm at the point where I can create a site in html/css and
bootstrap, but want to start populating the data with dynamic content and
interaction with a database etc. Do you think javascript would be a good thing
for me to focus on now to achieve those things?

I guess I had plans to look into javascript at some point, but it was
primarily going to be for traditional ui manipulation. Do you think it can
totally replace what I was going to originally do with php/django?

------
gt565k
Let me weigh in here. I've worked with Rails, ported a php application to
Django, currently working with Spring MVC and Angular JS.

PHP is a scripting language, Django is a framework. I think you are comparing
2 different things.

If you want to get into web development, there are 2 major concepts/skills you
need to get down. First, understanding of MVC, or "MTV"[0], as in Django's
case, or whatever other variation of said design pattern (MVP, MVVC, etc..).
Second, writing and consuming REST APIs. The frameworks will handle or at
least guide you through the rest. CSS, HTML, and JS will help you with the
front end, but I think as someone who works in ops, you'd be more comfortable
establishing a solid back-end first. You can always bootstrap the front-end.

Personally, I try to stay away from anything PHP based. I don't think anyone
in their right mind would start a new project with a PHP stack. Frameworks
like Django, Rails, and other JS frameworks are much more mature, in terms of
utility, than anything you'll find in PHP.

Since you already have experience with it, it would be fairly easy to work
with Django after running through a few tutorials.

IMO if you go the PHP route, you'll get stuck with old technologies, as in
your job prospects would involve maintaining legacy php apps. I haven't heard
of anyone starting a new project with PHP.

A developer should be concerned with building applications to meet
requirements, writing and consuming REST APIs, and implementing features and
utility functions around those.

Once you become fairly experienced with one web framework, whether it's Django
or Rails, explore another framework. Don't get stuck with a single technology
stack. That's the mistake most developers make. They never get out of their
comfort zone. Become a polyglot.

Fact of the matter is, some frameworks have better integration with certain
tools, because of community support. Learn one framework, then learn another,
and keep going.

Personally, Django is one of my favorites, but I also love Rails. Both do
certain things better than the other. There's no perfect framework.

Check this book out, it's free if you read it online. It is a really good
resource on TDD with Python and Django
[http://www.obeythetestinggoat.com/](http://www.obeythetestinggoat.com/)

0\.
[https://docs.djangoproject.com/en/1.8/faq/general/](https://docs.djangoproject.com/en/1.8/faq/general/)

~~~
aregsarkissian
If you do decide to go with php, I would use Laravel which is essentially php
on rails.

------
rfc791
I worked in ops for several years but never really got passed simple scripts
in various languages. Then out of pure frustration with the lack of tools to
do my job I decided to dig deeper into Python.

I started off with a project to track Application Outages using Django. It
took me three months and a lot of reading but the application is still in use
after 3 years with very little maintenance. I have then gone on to use Django
and Flask for various one off web apps. Pandas for data analysis and a lot of
third-party packages.

During that time I have looked at Javascript(Node stuff), Ruby and Go. Python
keeps winning because my brain can understand it and I get things done the
fastest in it. You need to find what works for you there will be plus and
minus for it all but getting things done is where it matters.

------
giaour
What's your end goal?

Picking up PHP will make it very easy for you to find work as a developer, but
python will make your soul hurt less.

------
mrorbitman
It doesn't really matter what server side language you use. If you like
python, absolutely dive into django :)

------
lutt
Django

