3 ms·
IIRC (untested), a "Hello world" webapp in the Python world is as simple as dropping this into your cgi-bin: #!/usr/bin/env python print 'Hello world'
by nostrademons 17y ago
IIRC (untested), a "Hello world" webapp in the Python world is as simple as dropping this into your cgi-bin:
#!/usr/bin/env python
print 'Hello world'
You can do CGI apps just as easily in Python as you can in other languages. It's just that CGI doesn't scale, and so you'll want a framework for anything more complicated than that.
Incidentally, have you tried to setup PHP on a machine that doesn't already have it installed? (Particularly without using a package manager - with port or apt-get, Python isn't all that difficult to install either.) It's a frigging nightmare of building shared libraries, making sure they're in the right place, finding the right Apache config files to edit, and adding the appropriate LoadModule/AddType/AddExtension/whatevers. The reason PHP's easy to deploy is because most webhosts already have it preinstalled - they've done the work for you. If you use a Django-aware webhost like Webfaction, the process of creating a new Django app is reduced to clicking a button on your web-based control panel.
- garnet7 17y ago> It's just that CGI doesn't scale, and so you'll want a framework for anything more complicated than that. No, that's not the issue. The issue is, when you have a relatively small webapp that you want to be fast. It's large and fancy enough -- you just want it to be fast. So, for that you want a persistent language runtime, such that when your page gets accessed the already running Python interpreter just grabs your .pyc file and runs it immediatly. The final ingredient is that with php you can put your php files into your docroot so that you don't even have to mess with apache rewrite. If Python had those things, there wouldn't be any reason for a new user to choose php over python.