Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add Module

mauricelambert edited this pageFeb 16, 2023 ·2 revisions

Add Module

Build the module

Write in./scripts/py/hello.py:

defhello(environ,user,server,filename,arguments,inputs,csrf_token=None):return"200 OK", {"Content-Type":"text/plain"},f"Hello{user.name} !"defpage_500(error):returnerror, {"Content-Type":"text/html; charset=utf-8"}, [b"<h1>ERROR 500</h1><br><br>\n\n",error.encode()]defpage_401(error):returnerror, {"Content-Type":"text/html; charset=utf-8"}, [b"<h1>ERROR 401</h1><br><br>\n\n",error.encode()]defpage_403(error):returnerror, {"Content-Type":"text/html; charset=utf-8"}, [b"<h1>ERROR 403</h1><br><br>\n\n",error.encode()]defpage_404(error):returnerror, {"Content-Type":"text/html; charset=utf-8"}, [b"<h1>ERROR 404</h1><br><br>\n\n",error.encode()]

Add configuration

In aserver configuration file inserver section (usingINI syntax):

modules=hellomodules_path=./scripts/py

Load configurations

Restart the server.

Get the pages

Open your web browser onhttp://127.0.0.1:8000/hello/hello/.To test custom page for error 404:http://127.0.0.1:8000/hello/.To test custom page for error 403:http://127.0.0.1:8000/api/scripts/view_users.py.To test custom page for error 500:http://127.0.0.1:8000/get/.

Clone this wiki locally

[8]ページ先頭

©2009-2025 Movatter.jp