aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitja Felicijan <m@mitjafelicijan.com>2023-07-01 20:07:33 +0200
committerMitja Felicijan <m@mitjafelicijan.com>2023-07-01 20:07:33 +0200
commit71b7c639fa0b4ffe7425ec9bd6c3b0fef08b0028 (patch)
tree1dff08f9b42c0f3cad1198120b969665ee1de60c
parent313813f8fbde17d1eae2c53f043e64905e016dc8 (diff)
downloadmitjafelicijan.com-71b7c639fa0b4ffe7425ec9bd6c3b0fef08b0028.tar.gz
Post: Added Python example to Caddy post
-rw-r--r--content/posts/2023-07-01-bringing-all-of-my-projects-together-under-a-single-umbrella.md24
1 files changed, 22 insertions, 2 deletions
diff --git a/content/posts/2023-07-01-bringing-all-of-my-projects-together-under-a-single-umbrella.md b/content/posts/2023-07-01-bringing-all-of-my-projects-together-under-a-single-umbrella.md
index a08614f..259d4fc 100644
--- a/content/posts/2023-07-01-bringing-all-of-my-projects-together-under-a-single-umbrella.md
+++ b/content/posts/2023-07-01-bringing-all-of-my-projects-together-under-a-single-umbrella.md
@@ -105,6 +105,7 @@ examples.mitjafelicijan.com {
105 cgi /bash-test /opt/projects/examples/bash-test.sh 105 cgi /bash-test /opt/projects/examples/bash-test.sh
106 cgi /tcl-test /opt/projects/examples/tcl-test.tcl 106 cgi /tcl-test /opt/projects/examples/tcl-test.tcl
107 cgi /lua-test /opt/projects/examples/lua-test.lua 107 cgi /lua-test /opt/projects/examples/lua-test.lua
108 cgi /python-test /opt/projects/examples/python-test.py
108 109
109 root * /opt/projects/examples 110 root * /opt/projects/examples
110 file_server 111 file_server
@@ -119,8 +120,8 @@ examples.mitjafelicijan.com {
119 config file. 120 config file.
120 121
121I did a small batch of tests with [Bash](https://www.gnu.org/software/bash/), 122I did a small batch of tests with [Bash](https://www.gnu.org/software/bash/),
122[Tcl](https://www.tcl-lang.org/) and [Lua](https://www.lua.org/). Here is a 123[Tcl](https://www.tcl-lang.org/), [Lua](https://www.lua.org/) and
123cheat sheet if you need it. 124[Python](https://www.python.org/). Here is a cheat sheet if you need it.
124 125
125Let's get Bash out the way first. 126Let's get Bash out the way first.
126 127
@@ -158,6 +159,24 @@ for {set i 0} {$i < 10} {incr i} {
158} 159}
159``` 160```
160 161
162And for all you Python enjoyers.
163
164```python
165#!/usr/bin/python3
166
167import os
168
169print("Content-type: text/plain\n")
170
171print("Hello from Python\n")
172print("PATH_INFO [{}]".format(os.environ['PATH_INFO']))
173print("QUERY_STRING [{}]".format(os.environ['QUERY_STRING']))
174print("")
175
176for i in range(10):
177 print("> {}".format(i))
178```
179
161And for the final example, Lua. 180And for the final example, Lua.
162 181
163```lua 182```lua
@@ -194,6 +213,7 @@ examples.mitjafelicijan.com {
194 cgi /bash-test /opt/projects/examples/bash-test.sh 213 cgi /bash-test /opt/projects/examples/bash-test.sh
195 cgi /tcl-test /opt/projects/examples/tcl-test.tcl 214 cgi /tcl-test /opt/projects/examples/tcl-test.tcl
196 cgi /lua-test /opt/projects/examples/lua-test.lua 215 cgi /lua-test /opt/projects/examples/lua-test.lua
216 cgi /python-test /opt/projects/examples/python-test.py
197 217
198 root * /opt/projects/examples 218 root * /opt/projects/examples
199 file_server 219 file_server