From 4c2445f1e7a2b508e0ad144c86a9bde802f5b1c9 Mon Sep 17 00:00:00 2001 From: David Beniamine <david.beniamine@imag.fr> Date: Fri, 24 Feb 2017 16:59:48 +0100 Subject: [PATCH] Set webserver root --- passchecker/commands/web.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/passchecker/commands/web.py b/passchecker/commands/web.py index 95c8c80..e29c8e7 100644 --- a/passchecker/commands/web.py +++ b/passchecker/commands/web.py @@ -16,16 +16,19 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +import os +import pkg_resources from http.server import HTTPServer from http.server import CGIHTTPRequestHandler from .passcheckerdefaults import PASS_CHECKER_DEFAULTS def server(address=PASS_CHECKER_DEFAULTS['address'], port=PASS_CHECKER_DEFAULTS['port']): + os.chdir(os.path.dirname(__file__)+"/../") server_address = (address, port) server = HTTPServer handler = CGIHTTPRequestHandler - print("Server up and running at: http://{}:{}/cgi-bin/index.py".format(address,port)) + print("Server up and running at: http://{}:{}/cgi-bin/index.py".format(address, port)) httpd = server(server_address, handler) try: -- GitLab