I have a web space package at Strato and they say that I can use Python on their webspace. Currently I use PHP with CakePHP since PHP works, but I’d rather use Python with some framework, where Django seems to be the match.
So I uploaded a little script into /cgi-bin/test.py:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
print "Content-Type: text/html"
print
print "Hello, World!"
And it indeed prints Hello, World!.
Then I tried to import django below the “Hello, World!“:
try:
import django
except Exception as e:
print e
All I got is an “Internal Server Error“.
Does it make sense to use this server for Python at all, or is that just some half hearted support that will not be fun anyway?
The import doesn’t work because you haven’t set up the required environment variable. However, even if you managed to get the import working, Django deployment is a bit more involved than putting a script in your cgi-bin directory. You need to choose a method such as WSGI, or FastCGI, and configure your webserver (Apache/Nginx/etc).
You have three categories of hosts for deploying Django.