ID: c6d4c2ee33d35d96560a7f927d2f04d2b9527ded
14 lines
—
669B —
View raw
| #!./venv/bin/python3
import os
from freepost import bottle
# freepost uses Bottle's function get_url() extensively (see https://bottlepy.org/docs/dev/_modules/bottle.html#Bottle.get_url
# for a description). This function uses the env variable SCRIPT_NAME internally,
# which is set by Apache to "/freepost.cgi" when redirecting URLs from .htaccess.
# The result is that all the URLs created by get_url() will start with "/freepost.cgi",
# for example "/freepost.cgi/post/<post_id>" instead of "/post/<post_id>".
# So, here it's overwritten to an empty string in order to remove the script name from the URLs.
os.environ['SCRIPT_NAME'] = ''
bottle.run(server='cgi')
|