3 ms·
I 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
by agazso 17y ago
I 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.