Forums

calling a .py on this server from a HTML page

I am trying to execute a .py script

!/usr/bin/env python3

print("Content-Type: text/html\n\n") # html markup follows print(""" <html> <Title>Hello in HTML</Title> <body> <p>Hello There!</p> <p><b>Hi There!</b></p>
</body> </html> """)

from within a html file

<script type="HTML/python" src="http://www.pythonanywhere.com/user/hwolff1962/files/home/hwolff1962/test.py"></script>

and it just don't work. Di I need to put the .py somewhere special or somehow mark it executable or am I just calling it wrong. It does what it supposed to do from the console so I think I just can't figure out how to call it or something.

Thanks Hwolff1962

That doesn't work like that. See https://blog.pythonanywhere.com/169/