Python and web stuff – Python

This is going to be incredibly cryptic, simply because this entry is just a quick reminder to myself.

I have installed MAMP (MacOSX, Apache, mySQL, PhP), then I made sure it was all running…

and I created a directory where all my localhost files will live…


I created another dir where the python cgi will live


and, finally I created a file named with the following script


print 'Content-Type: text/html'
print '<html>'
print '<head><title>Hello from Python</title></head>'
print '<body>'
print '<h2>Hello from Python</h2>'
print '<p>'
print '''

so now you decide to work
you big fat sack of sh!t.

print '</p>'
print '</body></html>'

with changed permisions…

$ chmod 755 test.txt

Next step is to start python, like this

$ python -m CGIHTTPServer

which should return something similar to this

Serving HTTP on port 8000 ...

so we can now access it through port 8000



Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s