PasswordProtectedHttpServer
CLI tool for running basic static websites with password protection.
installation
git clone https://github.com/marcelm9/PasswordProtectedHttpServer.git
cd chunky
pip install .
commands
# create new config file
python -m PasswordProtectedHttpServer newconfig
# run server
python -m PasswordProtectedHttpServer run
important info
- When running the server, it will always look for a "config.json" file (unless "--config" is set). This is important, as the paths specified in config.json are relative to the current working directory when launching the server. It is recommended to have the root directory of the server and the config file in the same directory.
- To run the example server, cd into to example_server directory and use the command
poetry run python ../main/PasswordProtectedHttpServer/__main__.py run. - If the password is an empty string, the login process will be skipped and the server will act like a regular webserver.
- The "login-filepath" config option is the relative filepath from the current working directory. This is different in "index-filepath-from-root", as this option is the filepath starting from the root directory. The reason for the difference is subtle, as it only lies in the possibility to make the login file inaccessible from the root directory after logging in. For example, if the login file is outside the root directory, when the user tries to open the website he will be prompted to enter the password. After logging in, the user is then unable to access the login file again (without going back in the browser). If the file was located inside the root directory, the user could theoretically directly access the login file via the url. This is avoided by storing the login file outside the root directory.
- In login files no other files can be imported. Any css and js has to be done directly inside the html file. To send the password attempt to the server, send a POST request to the /login endpoint. For more details have a look at the example server.
disclaimer
I know that the regular Flask server should not be used in production. For static websites however, I do not see any reason to setup anything more complex. Use at your own risk.
Release files for PasswordProtectedHttpServer 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| passwordprotectedhttpserver-1.0.1.tar.gz | 4.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| passwordprotectedhttpserver-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.0 kB
Release files / passwordprotectedhttpserver-1.0.1.tar.gz
| Download URL | passwordprotectedhttpserver-1.0.1.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
25c509c95e7f78fccd8b8aecf98811fa79eac68b5f03c467628b211133c02c94
|
|
BLAKE2b-256 checksum How to use checksums |
9a921f7b5a4b4c97f35071bcbfe5a19384247b2aef706582da92a7b1e8f2e994
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.11.4 Windows/10
|
Release files / passwordprotectedhttpserver-1.0.1-py3-none-any.whl
| Download URL | passwordprotectedhttpserver-1.0.1-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d5d88f9e6d9473c0eee324526262ed128072b7f80d7ac45f5105f77dfc428794
|
|
BLAKE2b-256 checksum How to use checksums |
01960582dadd6b2c3e5d27c9d78894bccd5f6367350a8efaadbd8eaf1b4df450
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.11.4 Windows/10
|