Live data from Hacker News

I only know PHP. How do I write a Web application in Python?

me.veekun.com

1–10 of 196 posts

Re: I only know PHP. How do I write a Web application in Python?

#3
Say wat you want of php. But it's (insert personal pejorative option) made for it.

Sure Its a_little_inconsistent AndSomewhatChaotic

But all the basics for the web are incredible accessible right away.

With every other language you have to start with a framework.

I find php easier than rails to prototype applications and do fast hacks that need a web face.

It's simply the right tool for the job on those occasions. Of course, later they become huge systems...

Re: I only know PHP. How do I write a Web application in Python?

#4
post #3

Say wat you want of php. But it's (insert personal pejorative option) made for it. Sure Its a_little_inconsistent AndSomewhatChaotic But all the basics for the web are incredible accessible right away. With every other language you have to start with a framework. I find php easier than rails to prototype applications and do fast hacks that need a web face. It's simply the right tool for the job on those occasions. Of…

That's why e.g. Flask exists: it gives you the basics, plus light structure and templating and routing and XSS protection and deployment options and whatever else. With no setup and no boilerplate.

It's about as much effort as typing `<?php`.

Re: I only know PHP. How do I write a Web application in Python?

#8
post #3

Say wat you want of php. But it's (insert personal pejorative option) made for it. Sure Its a_little_inconsistent AndSomewhatChaotic But all the basics for the web are incredible accessible right away. With every other language you have to start with a framework. I find php easier than rails to prototype applications and do fast hacks that need a web face. It's simply the right tool for the job on those occasions. Of…

That's a nice sentiment that's completely inaccurate. Even 6 years ago when I first started programming Python, simple Python cgi scripts were very easy to write. It's as simple as:

  print """\
  Content-type: text/html
  
  ..."""
With %(var)s interpolation, you can even slap in locals() easily to trivially put variables' values into the page.

Re: I only know PHP. How do I write a Web application in Python?

#10
I'd say the necessity of this post is why PHP is as popular as it is. With PHP, there are no package managers I have to install; there is no template language to learn; there is often no version control; there is no "framework"; etc. You just drop in a .php file and, most likely, it will just run. If I need a quick dynamic page on my server, it's much easier to do this in PHP than in Python or Ruby.

Until Python or Ruby have that kind of simplicity, they can't overtake PHP. While it might not be the kind of design that leads to well-designed web apps or even good code, it is the kind of design that leads to more — especially less technical, or, like me, lazy — users. It's up to the developers of those languages if this is even a market they want. There may need to be something new to do the same job as PHP, but better, without the innumerable warts.

Post reply on HN