Live data from Hacker News

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

me.veekun.com

81–90 of 196 posts

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

#81
post #66
post #65

Earlier quoted context omitted.

That's a fair bit more involved than "FTP files to my web host and they usually just work"

It's actually easier... $ git push heroku master

Of course, this assumes you are using Git in the first place, or are willing to learn it. Most folks already have FTP/ssh down pat, so git is a big jump from just copying files.

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

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

It took me a while to get used to creating an HTML file and making part of it executable. How utterly obvious and convenient. Templating systems and MVC frameworks now seem like bureaucracy that solve a purely theoretical problem.

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

#83
post #61
post #51

Earlier quoted context omitted.

Color me as another interested specimen.

I wanted to do that now but did some lego with my kid instead, will keep you 3 informed when done.

It seems an article on Ars Technica has already compiled some defect of MySQL:

http://arstechnica.com/civis/viewtopic.php?f=20&t=92525

Another thing that reminds of PHP, the list of commands:

    mysql                       mysql_client_test_embedded  mysql_find_rows             mysqlrepair                 mysql_tzinfo_to_sql
    mysqlaccess                 mysql_config                mysql_fix_extensions        mysqlreport                 mysql_upgrade
    mysqladmin                  mysql_convert_table_format  mysql_fix_privilege_tables  mysql_secure_installation   mysql_waitpid
    mysqlanalyze                mysqld                      mysqlhotcopy                mysql_setpermission         mysql_zap
    mysqlbinlog                 mysqld_multi                mysqlimport                 mysqlshow                   
    mysqlbug                    mysqld_safe                 mysql_install_db            mysqlslap                   
    mysqlcheck                  mysqldump                   mysqlmanager                mysqltest                   
    mysql_client_test           mysqldumpslow               mysqloptimize               mysqltest_embedded  
Why the hell show we want a 'mysqldumpslow'? Is it because mysqldump is fast but wrong? And why not mysql_dump?

I have started with MySQL for my first (php) website, and to me the database was just the natural storage, I had no idea of the problems, because I didn't know that a relational database is a particular well-defined mathematical object, which asserts truths about the "world" in a manner that makes it possible to model this world safely and ask questions about it. Then I used PostgreSQL at my previous work, and discovered it all, the hard way. And PostgreSQL has (almost) always been a reliable companion taking care of the most valuable asset: the Data. Then I switched job and have to use MySQL again. I live with it, it's fine, but the difference is not benign, and I sometime wonder if the NoSQL movement is not a partly a misunderstanding and should renamed NoMySQL: when using an unreliable datastore, it is certainly better to use one that is explicitly not reliable and do not force on you the relational model while, at the same time, not giving you its strengths.

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

#84
post #66
post #65

Earlier quoted context omitted.

That's a fair bit more involved than "FTP files to my web host and they usually just work"

It's actually easier... $ git push heroku master

That is obviously not sufficent. For using PHP I literally have to tell people to open an ftp GUI client and drag+drop a folder, or do something like:

    sftp -r website user@host:
So, what is the full "this is how you use heroku" I can send to a windows user, who knows HTML and wants to just get started with 'hello world'.

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

#85
post #18

Earlier quoted context omitted.

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

That framework is Spring MVC.

Agreed that Spring MVC rocks, but Grails[1] is also awesome, and Wicket[2] is pretty cool.

[1]: http://grails.org/

[2]: http://wicket.apache.org

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

#86
post #66
post #65

Earlier quoted context omitted.

That's a fair bit more involved than "FTP files to my web host and they usually just work"

It's actually easier... $ git push heroku master

You can't have 'git' and 'easier' on the same phrase

Or maybe you can: Hg is easier than Git

Now, I don't hate git, I love git, but you're seriously overestimating the knowledge of most of the programmers.

Git for lots of people feels like being thrown in a plane cockpit and asked to fly the darn thing.

And this is seriously something Heroku needs to think about. Sure, for now, it's still mostly early adopters.

But I really wouldn't like to tie my production servers to a specific VCS.

Compare this with drag-and-drop of php files to their ftp server.

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

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

It took me a while to get used to creating an HTML file and making part of it executable. How utterly obvious and convenient. Templating systems and MVC frameworks now seem like bureaucracy that solve a purely theoretical problem.

Sure, if all you need is a mildly dynamic page the full blown MVC frameworks that are "standard" for other languages probably seem like bureaucracy to you. But they have their uses, and they also exist for PHP for a good reason. MVC makes massively complicated systems easier to maintain, especially if there's more than one contributor.

Example: I'm responsible for maintaining a "classic" ASP project that's evolved over many years ('98 was the oldest code comment I've found). A report has the wrong value for the record on it. Where do I go to find the source of the error?

You'd say "look at the page that edits that value". Well, sure, but there are dozens of pages that edit that database table plus dozens of other processes that could be altering it (stored procedures, print processes, scheduled tasks, people manually writing SQL statements, etc), looking at all of them would be a huge headache. In a MVC system, I would just go look at the model file of that table and debug the methods it uses to manipulate the database (that's simplified, but it's much less work than the spaghetti alternative).

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

#88
post #23
post #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)

Fair point. Correction: working with encodings sucks. Py3 isn't magnitudes better with Unicode; it's better about converting incoming bytes, and it makes literals into real strings. But the former isn't necessarily a good thing, and you can get the latter with a `__future__` import. Always dying on implicit conversions is definitely nice, though.

Working with encodings is indeed annoying in Python, but it’s not a “universal” problem.

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

#89

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.

Play! Framework.

I've been using it for over a year and I have to say it's the most "rails like" framework out there for Java.

However they have just released play! 2.0 (which I have not used yet). This makes some major changes to the framework and it's not all backward compatible.

I does have a heavy emphasis on Scala now, but you can still code everything using Standard Java if you want, although it does somewhat butcher Java "best practices".

it's default ORM is JPA/Hibernate which works well enough as it gives you a ton of helper functions, it even automatically creates getter/setter method at runtime allowing you to do C# Style properties simply by declaring entity members as public.

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

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

I agree on the simplicity of php. The barrier to write php is low. All you need is notepad and browser. This may be a transition from writing html. Compare this to other languages where you need multiple tools before you can even begin. This doesn't make php better. It just may explain why less people make the jump.

You also need a server, which I think is one of the crucial components for PHP adoption.

MAMP, XAMPP, WAMP are all really easy to install and you don't need to go into the CL to do anything.

Post reply on HN