How to get a website containig pyscript running on a hosted domain

With the advent of py-script it is now really easy to make a pretty webapp using python. If you already pay for a hosted domain you may want your python-powered app right there.


You may run into the problem that your python file seems unaccessible. It might look like this:

(PY0500): Fetching from URL foo/ failed with error 500 (Internal Server Error). Are your filename and path correct?

Reason: (at least in my case) The provider uses the Apache Webserver and configured it to not allow script-execution by default.

Solution: To allow script-execution you can use the Apache Webserver’s .htaccess file (note the dot that marks it as a hidden file). I created a subfolder “foo” (below where my index.html resided), put my python files in this folder. Then I created (in the folder “foo”) the file “.htaccess” and configured it as such:

Option -ExecCGI

AddHandler python-script .py

And that was it.

Was this helpful?

0 / 0

Cookie Consent with Real Cookie Banner