Live data from Hacker News

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

me.veekun.com

11–20 of 196 posts

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

#11
post #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`.

While that's true (and I do love Flask), PHP comes installed on every discount web host. Deploying a PHP app is as easy as using FTP, deploying a Python app can be -- but doesn't have to be -- complex. I'd say this is the bigger sticking point than the framework.

Obviously Heroku and other PAAS providers are changing the game as far as deployment ease. It should be to see what happens in the next few years on that front.

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

#14

I like java for web app development, simply because it has a well-structured api and a massive community of developers who have run in to the majority of the road blocks you will most likely encounter on the way to launching your app.

What frameworks and platforms would you recommend for web development with java? I am writing my senior project at college in java (mainly because of the wide amount of image processing libraries available) and would love to add web capabilities.

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

#15
post #13
post #5

What's wrong with mysql?

Apparently, it isn't PostgreSQL; If you have no need for Postgres features and you're not familiar with it, sticking to MySQL is fine.

Well you can say the same for windows vs Linux or visual basic vs any other language, and you can also continue using paper glue to attach paintings on the wall.

It is not a matter of what you need, it is a matter of using good tools that will help you do good work, understand better what you do, build durable products, and so on.

Just one example: MySQL will not complain if you add a check constraint but will not actually add it to your schema. That's a very Microsoft-y way to handle things, and should give cold sweat to any coder.

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

#16
post #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 R…

Most of the post _isn't_ strictly necessary. You don't need a database to get your feet wet. You don't need to care about XSS for your first throwaway app (though, arguably, you should). I pimp Mako precisely because there's no separate language to learn: the core syntax is just Python.

I tried to describe the _ecosystem_, and I assume any serious PHP application will care about most of the same things.

Here's all you really need: look at http://flask.pocoo.org/ and do that thing it says right there. You don't even need to install a separate web server. (Yeah, yeah, 5.4, I know.)

A "quick dynamic page" is a deployment problem. If you're already running Apache and mod_php, you already have an environment ready to go to serve PHP, so of course it'll be easy for you. I don't run Apache, so PHP doesn't really help me there. (mod_passenger promises to, but I haven't tried it with Python yet.)

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

#17
"I only know PHP"

"I just trashed PHP rather harshly"

"I want to learn python"

Well, you're doing it wrong. How can you trash PHP if you know no other languages ?!

You're following articles, posts saying PHP is bad and.. you decide then that's right it's bad!

Ever though about thinking on your own first? Like, actually trying a language (python, why not) then deciding if it's better?

This kind of stuff always amaze me. You know, sheepish.

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

#18

I like java for web app development, simply because it has a well-structured api and a massive community of developers who have run in to the majority of the road blocks you will most likely encounter on the way to launching your app.

What frameworks and platforms would you recommend for web development with java? I am writing my senior project at college in java (mainly because of the wide amount of image processing libraries available) and would love to add web capabilities.

I tend to prefer Python/Flask for Web dev to Python but if you are inclined to use Java there's only really one framework that doesn't make me want to tear my eyeballs out.

That framework is Spring MVC.

It is DI, adapters for vendor-specific libraries and utility. It's probably not the easiest thing to start with just because it is so flexible that it can be hard to know where to start. A good "Hello World" Spring MVC 3.1 app would go a long way.

I really would like to use the Play Framework and it's so close to being great but it just falls too far short.

I really liked Play 1.x with Groovy templates. It was simple and it pretty much just worked.

Play 2.x has gone in a radically different (and backwards incompatible) direction. It is now part of Typesafe and the goal of Play 2.x is to make Scala a first-class citizen.

The problem is that many of the niceties of Play are either harder to use or just outright missing in Java Play 2.x (eg AppEngine support and the OAuth client were all present in 1.x and are slated for a future 2.1 release).

There really is a niche for a Java Web framework that like Play ditches the JEE/servlet model in favour of the Rails/Django way of doing things (including dynamic class reloading) but doesn't do it in a way that makes me want to stab myself repeatedly.

This would include playing nice with the Java ecosystem (seriously just use Maven and to hell with SBT).

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

#19
Nice littel overview, but...

"Unicode sucks. This is a universal truth."

And here I stopped reading. Unicode is the best thing around, what sucks it that Py2 does not implement it very well. Py3 does, and that is the main reason I really would like to use it and hope Django will soon fully support it. (Because: there are other languages beside the European ones)

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

#20

I like java for web app development, simply because it has a well-structured api and a massive community of developers who have run in to the majority of the road blocks you will most likely encounter on the way to launching your app.

What frameworks and platforms would you recommend for web development with java? I am writing my senior project at college in java (mainly because of the wide amount of image processing libraries available) and would love to add web capabilities.

[deleted]
Post reply on HN