J. S.
J. S.

Reputation: 425

Deploying CGI on Pythonanywhere

I want to use Pythonanywhere for deploying my CGI-projects. I've uploaded home/[username]/hello.py file:

#!/usr/bin/env python2

print "Content-type: text/html\n"
print "<h1>Hello world!</h1>"

I think I should edit /var/www/[username]_pythonanywhere_wsgi.py and/or launch something like

python2 -m CGIHTTPServer

from /home/[username], but I can't understand what me to do. I want to run code described above by loading [username].pythonanywhere.com/hello.py. Also I have some html-s, css-s and other static files, and I want them to be opened too. Please help!

Upvotes: 0

Views: 193

Answers (1)

hwjp
hwjp

Reputation: 16071

PythonAnywhere dev here, we don't support the CGI model of web applications. We use a python protocol called "wsgi" instead. You can hand-write your own wsgi-compatible services, but most people choose to use a web framework like django or flask instead.

Head over to the "web" tab for some more info and some examples.

Upvotes: 1

Related Questions