6 ms·
> It's easy to deploy. Yup. This is the reason PHP is trouncing Python. Python should be where PHP is, right? But it isn't. If you ask the Python folks for ea
by garnet7 17y ago
> It's easy to deploy.
Yup. This is the reason PHP is trouncing Python. Python should be where PHP is, right? But it isn't. If you ask the Python folks for easy deployment, they'll go into a lecture about how it's ugly, or a hack, or not general enough. And then they'll start telling you about how you should be using WSGI.
You: "I like vanilla."
Python: "What? Vanilla? There are better flavors than that. C'mon. Let's get you some nice strawberry."
You: "But I don't like strawberry.
Python: "Well, you should! It's a great flavor! How many scoops would you like?"
You: "[Sigh]. 2. Sugar cone, please."
Python: "Here you go!"
You: "Hey, this is a wafer cone. And it's only one scoop. And it's sherbet!"
Also, learning to make a scripting language spit out some html is easy. Learning how to get various apache modules built, configured, and installed -- or convincing an inexpensive ISP to do so -- is a whole nother ball of wax.
AFAICT, PHP did deployment right, and is still making "better" languages look like they can't get their act together. I should be able to drop a .py file into my docroot and a persistent apache-managed python should execute it (when it's requested) and spit the results back to my browser. It's astonishing that we don't have that.
You: "I like vanilla."
PHP: "Here you go. Vanilla. Also take these napkins -- it's a little drippy."
- dasil003 17y agoPassionate software developers need to accept the fact that web programming has hit the mainstream. There are tons of amateurs doing it, and the number is growing explosively thanks to platforms like Facebook. It's pretty much a given that these type of people coming in with a passion for the end result are going to be different from the geeks for past generations who were just as obsessed with the process of programming. PHP is ideal for seeing a quick result. HTML + PHP is the most rewarding platform ever invented in that regard. Naturally, many of these individuals will evolve and outgrow PHP, but it's also powerful enough to keep a lot of talent around just due to inertia. Ease of deployment is just one piece of this perfect storm.
- gaius 17y agoWebsites are a small corner of the Python world, but all of the PHP world.
- garnet7 17y agoEverywhere I look, when new programmers ask what language to learn first, they are most often told to learn Python. C is too low-level, Perl's too old and crufty, Ruby's too trendy, Scheme is too esoteric, Haskell's too difficult, Lua doesn't have enough libraries, Java's too verbose and corporate, ... the list of reasons not to go with other languages is a mile long. Note: PHP is usually never even mentioned. Then the new programmer asks what language they should use for web programming. At this point, everyone looks at the floor, scratches the back of their neck, clears their throat a bit, and says that, well, you should probably use PHP because that's what everyone else is using. So, in most corners of the programming world, many experienced programmers are recommending Python. You know how to get "everyone else" to use Python for web development? You make it easy to deploy -- just like PHP.
- carbon8 17y ago"Everywhere I look ... they are most often told to learn Python ... in most corners of the programming world ... recommending Python" Combined with "Ruby's too trendy" There's that cognitive dissonance again.
- plinkplonk 17y ago"Then the new programmer asks what language they should use for web programming. At this point, everyone looks at the floor, scratches the back of their neck, clears their throat a bit, and says that, well, you should probably use PHP because that's what everyone else is using." wow! This is some seriously fucked up advice. if someone were to ask me what language he should learn first, the answer is Python. When "Then the new programmer asks what language they should use for web programming" the answer is still Python - use Django with its awesome documentation and uber friendly community- (and PostGres as a database). This steers them clear of two terrible (but popular) pieces of software, PHP and MySQL.
- nostrademons 17y agoI usually tell people "Use Python and Django" when they ask me what language they should use for web programming. I agree though, Python apps should be much easier to deploy on the web. Just because it's currently the best solution doesn't mean it can't be better.
- brodie 17y agoWell, that's the goal of mod_wsgi, isn't it? To make it easier to deploy Python web applications, especially in shared hosting environments? mod_wsgi should allow you to just drop in a .wsgi anywhere and run it, provided your host allows for that. Do you think there's anything preventing it from catching on?
- agazso 17y agoI agree with you completely. Recently we created a small web app (http://hnwatch.scalien.com http://hnwatch.scalien.com, Hacker News Watch) which already had a python back end for crawling and text processing, so we decided to try out python instead of choosing php which we were already familiar with. We decided to use apache+mod_wsgi as it seemed the most performant option to use, and then we realized that you cannot use python as you would php, but you have to use a framework to do even the most simple things. What's worse, with mod_wsgi python caches the interpreter between page requests, which means it also caches modules with errors, and randomly runs several versions of the same file! So we hacked mod_wsgi to not to cache, and also created a minimalistic framework (150 lines) so that file deploying is like with php and you can easily use GET parameters, cookies and even mixed html and python code between <? and ?>. The only drawback is that python use indentation, so you have to be careful when writing one-line codes etc. Now it is working correctly, but I was constantly wondering that nobody did that before us. Still I'm not sure we shouldn't use php again :)
- steamboiler 17y agoI like to add automated tests for any application I write. These are mostly to prevent regression and to maintain sanity. Python makes this easy (as do the popular Python web frameworks such as Django). Do correct me if I am wrong, but I do not see the same importance given to automated unit testing in the PHP world. This leaves those who do want to automate tests with fewer choices of tools and accessories.
- agazso 17y agoWell, I admit that I don't make automated testing as part of the web development process, so I don't really know the options (neither in python, nor in php). But back when I worked on a quite big web application with the front-end developed in php, we did two things to detect errors early: - before building a package to be deployed, run a syntax check on all php files. - caught all runtime exceptions and sent an email to ourselves with a stack trace. Sure it generated a lot of traffic in the beginning, but it was quite rewarding after we filtered out the duplicates. Effectively our users tested the code paths for us :) I think these can be done in any web development language, additionally to the automated testing. The other thing came to my mind, that in php you can detect if you are running as a webserver process or from command line. This creates a handy option to write automated tests too.
- seldo 17y agoIf you ask me why Python -- and Rails, for that matter -- aren't trouncing PHP, it's because Python ignores Windows, and doesn't focus on the web. Hold the flame throwers for a second. Everyone on this site knows you shouldn't be deploying websites on Windows. And I agree. WAMP is not a sensible production environment. But it's a great learning environment. Because what the Python hackers of the world seem to forget is that 95% of all the computers in the world are running Windows. And for very large numbers of the owners of those computers "buy a second box and put Linux on it" is not an available option, and "run a virtual machine with Linux on it" is really complicated. They don't want to learn a new operating system, they want to learn a language to build websites in. In fact, all they want to do is _build websites_, and the language is the means to an end. They will take the path of least resistance, not the path that is most elegant. You want to build a website in Python on Windows? Good luck. Sure, Python has a great Windows installer -- but then what? Django? Some other web framework? Have you tried installing Django on Windows? It is a gigantic pain in the ass. Oh, and the MySQL libraries aren't included. Oh, and they don't work with Python 2.6 unless you find a super-secret download mentioned only on a mailing list. And then you have to learn Python, and then Django, and then you have to work out how to deploy it to your host's web server. Here's how you do the same thing in PHP. You go somewhere like here: http://www.wampserver.com/ http://www.wampserver.com/ You download one file, run one installer, and it gives you Apache, PHP, and a MySQL server, all at the same time. You put some .php files in there and web pages start turning up in your browser. It's not pretty, it's not elegant, it doesn't scale, but it's your first web page ever and it's ready in 10 minutes. Ready to deploy? Copy your three PHP files to your web host via FTP, and presto, they work just like they did on your home machine. Later, you discover frameworks. You learn about encapsulation, and MVC, and loose coupling and scalability. You work out that Windows is not exactly like your web host, which is running Linux. You might get around to installing Linux at that point, but you don't really have to because the differences are pretty minor. But whatever happens, at that point, you already know PHP. You're not going to switch languages. Until Ruby and Python hackers swallow their pride and accept that welcoming newbies to the language means not forcing them to switch operating systems, PHP will continue to monopolize the market for beginner web developers, and hence the market for the professional developers that they turn into.
- 17y ago