Live data from Hacker News

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

me.veekun.com

31–40 of 196 posts

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

#31
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…

All we need is to be able to drop an .erb file in a server and have it instantly rendered with the same magic of .php files. How hard would that be?

Anyone here know how to write plugins for Apache?

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

#32
post #15
post #13

Earlier quoted context omitted.

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 ac…

This is actually documented behavior: "The CHECK clause is parsed but ignored by all storage engines." From: http://dev.mysql.com/doc/refman/5.5/en/create-table.html

I believe it was left to support certain migrations(?). You can create a trigger instead.

I'm pretty certain many people will consider MySQL a good tool with which they produce good work. While it may have its quirks, it's present on virtually all shared hosting environments, just like PHP, so it's very easy to create and deploy an application powered by both these technologies.

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

#34
I have no idea why web2py gotten such a bad rep. I am a beginning webdeveloper and seriously: web2py is a pleasure to work with. Simple to start, deploy, port and hack. It's backwards compatible and has a template language that really is non existant as so far as its pure python.

Compare that to Rails - which is (comparable) hell to set-up and breaks with upgrades etc.

If you want python web development to be simple, web2py is the way to go. Since I don't have a CS degree and I have often been wrong before - there might be a real problem somewhere. But I don't think so. One of the reasons for this is that Jakob Moss removed his web2py bashing from this thread. Didn't edit - removed it: https://www.quora.com/Is-web2py-a-good-Python-web-framework/...

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

#35
I would love to switch to Python from PHP but I can't. The reason is I keep getting told to learn Python 2. Python 3 has been out for ages!

Basically I am concerned that I will learn something and create app's which within a year will be out of date. I am confused why Python developers are advocating that newbies learn an old and presumably soon to be legacy version of the language.

I remember when this kinda happened with PHP and versions 4 and 5. I still run across hosts who default to PHP4!? WTF? Its 2012!

Is PYthon3 really that new that you shouldn't pick it up or is this developers still refusing to update?

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

#36
post #32
post #15

Earlier quoted context omitted.

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 ac…

This is actually documented behavior: "The CHECK clause is parsed but ignored by all storage engines." From: http://dev.mysql.com/doc/refman/5.5/en/create-table.html I believe it was left to support certain migrations(?). You can create a trigger instead. I'm pretty certain many people will consider MySQL a good tool with which they produce good work. While it may have its quirks, it's present on virtually all shared…

So, you are telling me that it is a good thing, a normal behavior for a reliable tool to just ignore instructions I send to it and do nothing with it, not even a warning? So when I migrate a database, I have to carefully check each and every instructions (schema and data) and make sure MySQL did not "decide" it was not worth it and just silently threw it by the window?

I have hard time to believe you are serious here...

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

#37
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…

PHP is a template language at heart, so it's a little disingenuous to say that it doesn't force you to learn one, as it does - it's like the erb template language part of rails without the controllers and models. That's fine for what it is, but becomes cumbersome if you want to persist data to the db, handle forms for your models, etc at which point you'd often be better served looking at a framework which does a lot of that work for you. Some are available in PHP, but there are IMHO better options in other languages, and of course, better languages.

Do we need to have one language which scales from 'throw together a web page' to complex web apps? Is it even possible or desirable?

While I think it'd be nice to see Python and Ruby have the number of users that PHP does (though perhaps it wouldn't, with scale comes a worse NSR), it's probably not going to happen, simply because they provide a bit more structure, and many people don't want structure. Those people will be happy with PHP (until they're not, and realise they needed that structure after all), and I don't think Ruby or Python frameworks really have any ambition of catering to them. That's fine and is not a failing on either side. For example no one on the ruby side is going to stop using gems as package management because users starting out might be confused, as they are just too useful. You will find plenty of web frameworks for ruby which are simply one gem to install and off you go though - hardly onerous.

It would certainly be possible to write a better PHP, but all the people who might do that are busy using slightly more complex frameworks which make web development easier.

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

#38
post #21
post #13

Earlier quoted context omitted.

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.

MySQL was a lot worse before 2004 or so. It wouldn't do transactions, nor proper joins, if I remember correctly. I think the bad reputation still sticks to it.

I won't talk for the others but for me the "bad reputation" is not because of missing features, it is because of a wrong handling of ambiguous cases. If you ask a (SQL) question to a database and your question is ill-formed, ambiguous, or meaningless, it is very dangerous for the database engine to try to guess your meaning and answer something.

There are enough troubles with SQL (eg the Null debate) to add up to the mess by adding guesses.

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

#40
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…

All we need is to be able to drop an .erb file in a server and have it instantly rendered with the same magic of .php files. How hard would that be? Anyone here know how to write plugins for Apache?

You just described python cgi scripts
Post reply on HN