GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — bpo-36345: Include the code from Tools/scripts/serve.py for the wsgiref-base web server example by matrixise · Pull Request #12562 · python/cpython Conversation
|
|
@vstinner feel free to review this PR. Thank you so much |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
d176d16 to
30b5249
Compare
|
make check suspicious html SPHINXOPTS="-q -W -j4" failed with the following error on Travis CI: I'm not sure why literalinclude is seen as an error? @JulienPalard: Any idea? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I have made the requested changes; please review again |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks for making the requested changes! : please review the changes made to this pull request. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Can you explain what the server does? It seems like it serves the directory passed as the first argument on the command line, and accept an optional port number as the second parameter. Proposition:
"Example of a WSGI application serving the directory passed on the command line:"
By the way, would it make sense to modify the example of use the current directory by default, rather than require to pass a directory?
path = sys.argv[1] if len(sys.argv) > 1 else os.getcwd()
with:
"Example of a WSGI application serving the current directory, accept optional directory and port number on the command line:"
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
By the way, would it make sense to modify the example of use the
current directory by default, rather than require to pass a directory?
```
path = sys.argv[1] if len(sys.argv) > 1 else os.getcwd()
```
with:
"Example of a WSGI application serving the current directory, accept
optional directory and port number on the command line:"
I am fine with the optional directory, and because it's an example, it's
not a problem, we don't break the backward compatibility.
+1
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…ef-base web server example
optional directory and port number on the command line.
8d3c270 to
a3dbd35
Compare
|
I have made the requested changes; please review again |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks for making the requested changes! : please review the changes made to this pull request. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
When I tested the example, it wasn't obvious to me how to access the server.
Maybe the script should display somehow the URL http://localhost:8000/?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| path = sys.argv[1] if len(sys.argv) > 1 else os.getcwd() | ||
| port = int(sys.argv[2]) if len(sys.argv) > 2 else 8000 | ||
| httpd = simple_server.make_server('', port, app) | ||
| print("Serving {} on port {}, control-C to stop".format(path, port)) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
When I press CTRL+C, I get a ResourceWarning. Please add httpd.server_close() after print("\b\bShutting down."). By the way, I'm not sure that "\b" is supported on Windows. I suggest to remove ""\b\b" to make the script more portable.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| # Serve until process is killed | ||
| httpd.serve_forever() | ||
| Example of a WSGI application serving the current directory, accept optional | ||
| directory and port number on the command line: |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
| directory and port number on the command line: | |
| directory and port number (default: 8000) on the command line: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
When I tested the example, it wasn't obvious to me how to access the server.
Yep, it's the default output of `Tools/scripts/serve.py`
Maybe the script should display somehow the URL http://localhost:8000/?
Like the output of python -m http.server -d DIRECTORY?
I propose to submit an other bpo issue/pull request where we suggest to
change the default output of the `Tools/scripts/serve.py`
What do you think?
> @@ -25,7 +25,7 @@ def app(environ, respond):
return [b'not found']
if __name__ == '__main__':
- path = sys.argv[1]
+ path = sys.argv[1] if len(sys.argv) > 1 else os.getcwd()
port = int(sys.argv[2]) if len(sys.argv) > 2 else 8000
httpd = simple_server.make_server('', port, app)
print("Serving {} on port {}, control-C to stop".format(path, port))
When I press CTRL+C, I get a ResourceWarning. Please add
httpd.server_close() after print("\b\bShutting down."). By the way, I'm
not sure that "\b" is supported on Windows. I suggest to remove "\b\b"
to make the script more portable.
👍
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM. You can merge it once you will be able to merge changes ;-)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Two things:
Doc/whatsnew/X.Y.rst even if you're a core developer, though.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I'm wasn't sure on that point. In case of doubt, I said nothing :-)
Well, Stéphane wrote this PR before he was a core dev :-) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@berkerpeksag Thank you for your advice, which I will use next time. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I'm not sure how that is an argument here? It could be easily noticed and fixed before merging the PR. @matrixise welcome! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.