diff options
| author | Mitja Felicijan <m@mitjafelicijan.com> | 2023-07-01 20:07:33 +0200 |
|---|---|---|
| committer | Mitja Felicijan <m@mitjafelicijan.com> | 2023-07-01 20:07:33 +0200 |
| commit | 71b7c639fa0b4ffe7425ec9bd6c3b0fef08b0028 (patch) | |
| tree | 1dff08f9b42c0f3cad1198120b969665ee1de60c | |
| parent | 313813f8fbde17d1eae2c53f043e64905e016dc8 (diff) | |
| download | mitjafelicijan.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.md | 24 |
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 | ||
| 121 | I did a small batch of tests with [Bash](https://www.gnu.org/software/bash/), | 122 | I 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 |
| 123 | cheat sheet if you need it. | 124 | [Python](https://www.python.org/). Here is a cheat sheet if you need it. |
| 124 | 125 | ||
| 125 | Let's get Bash out the way first. | 126 | Let'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 | ||
| 162 | And for all you Python enjoyers. | ||
| 163 | |||
| 164 | ```python | ||
| 165 | #!/usr/bin/python3 | ||
| 166 | |||
| 167 | import os | ||
| 168 | |||
| 169 | print("Content-type: text/plain\n") | ||
| 170 | |||
| 171 | print("Hello from Python\n") | ||
| 172 | print("PATH_INFO [{}]".format(os.environ['PATH_INFO'])) | ||
| 173 | print("QUERY_STRING [{}]".format(os.environ['QUERY_STRING'])) | ||
| 174 | print("") | ||
| 175 | |||
| 176 | for i in range(10): | ||
| 177 | print("> {}".format(i)) | ||
| 178 | ``` | ||
| 179 | |||
| 161 | And for the final example, Lua. | 180 | And 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 |
