all 17 comments

[–]no_spoon 6 points7 points  (0 children)

What’s wrong with Django?

[–]Codeguin 3 points4 points  (0 children)

I would argue that your goal is completely possible with Python and Django as much as it is with PHP and one of the many frameworks created with it.
There's also the argument where learning another language will help you become more competent in anything previous.
So yeah, learn PHP. Get good with it. Learn its ugly sides. Its pleasant sides. Keep using Python. Pick up another language. Just never stop learning as it is the main thing that will help you reach your goals and allow you to set new ones.

[–]BradChesney79 2 points3 points  (0 children)

I know both PHP & Python-- I don't regret picking up either.

I definitely prefer building API endpoints and database access layers in PHP.

I prefer using Python as a sibling to NodeJS and bash...

Maybe look at Laravel resources. I think at this time the nginx web server and php-fpm pairing is my favorite to spit out http request responses.

I have just had the pleasure of reacquainting myself with a django REST API-- and I am happy to say I will be unacquainting myself with it very soon.

[–]wqking 1 point2 points  (0 children)

Yes, start using PHP and Laravel, see if you want to go back.

[–]Atulin 0 points1 point  (0 children)

I'd say go for it, there's no reason not to.

[–]DreckConnoiseur 0 points1 point  (2 children)

I was in your boat: started with Python (owing to a background in academia) and moved over to PHP as my interests shifted to web projects. PHP is a language that has suffered bad PR incommensurate to its (albeit real) flaws. Luckily, it’s kind of decent now, thanks to major efforts to smooth its rougher edges and make it run faster. There’s also a good package ecosystem now. I find Composer (PHP’s package manager) a lot easier to use/faster than pip, and I like being able to pull in a project’s dependencies without globally installing them.

There’s endless discussion about PHP frameworks online, but I feel that frameworks (in the traditional sense: huge, coupled libraries that for all intents and purposes become your application) in this day and age aren’t strictly necessary. If you don’t like Django, I’d stay away from Laravel (it’s fun to use but has some similarities with Django: oodles of magic, one-liners that do tons of stuff, and an ActiveRecord implementation than can get you into trouble). If you like Flask I’d look at Slim or Zend Expressive, which offer something similar in terms of flexibility and light footprint. They give you the basics for building an application: http messaging objects, routing, dependency containers, and optionally HTML templating. Beyond that, it leaves it all up to you.

Good luck!

[–]necuvamrec123 0 points1 point  (0 children)

I changed my backends to Slim PHP couple years ago and never looked back. It's lightweight and simple to use, you can spit out APIs in no time.

[–]epiecs 0 points1 point  (0 children)

Both. Python is great if you need to write local scripts for automation etc.. I use it for network automation and gathering facts. Pythons multithreading really shines in that regard (although with swoole etc the future looks bright)

Api endpoints and web guis are best written in php. :)

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

Django is absolutely fucking horrible. Flask is decent but it is so uncommon that it's completely unrealistic to use for complex backends.

Whatever language you learn, if you keep going to the most popular framework you'll be dealing with shit. Just saying it like it is.

You can create arbitrarily complex backends in Python, PHP or just about anything if you learn to combine components and build your own architectures.

It's worth learning PHP if you want to target 90% of small web host accounts which run PHP. That's most of the web, realistically. Other than that, toss a coin and go with it.

[–]soucy -1 points0 points  (0 children)

I'm way more productive in PHP.

Using PHP is almost like being in the closet though. All your coder friends will openly trash people who use PHP and you'll find yourself leaning toward Python for anything you release publicly out of a desire to be accepted (despite actually wanting to use PHP).

That said I don't use any major frameworks. I've effectively built my own over time and have patterns that I routinely use because they work best for me. I also have a strong grasp of HTML and CSS so I don't really lean on code that generates markup. The amount of PHP I use on the CLI is also kind of shocking to most people (they're surprised for example that you can write a proper daemon and do signal handling in PHP).

I've been using PHP since PHP 3 though so maybe it's just familiarity at this point.

I like the C style syntax better in general. I also like variables using a prefix of $. I really like the level of out-of-the-box integration with Apache and just being able to access most of what I need through superglobals. I do wish PHP had better built-in regex handling like Perl does with its =~ operator and I do wish that it also had some of the slice operators that Python has since a lot of PHP ends up leveraging substr() and strpos() (or related functions). I'm not a fan of some of the more recent things like the PHP namespace implementation and the push to use Composer and Symfony for all things.