Skip to main content

CLI tool for running basic static websites with password protection

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

passwordprotectedhttpserver-1.0.1.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

passwordprotectedhttpserver-1.0.1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file passwordprotectedhttpserver-1.0.1.tar.gz.

File metadata

File hashes

Hashes for passwordprotectedhttpserver-1.0.1.tar.gz
Algorithm Hash digest
SHA256 25c509c95e7f78fccd8b8aecf98811fa79eac68b5f03c467628b211133c02c94
MD5 fe58f5a5c1ddded14bbdd0c9095c49db
BLAKE2b-256 9a921f7b5a4b4c97f35071bcbfe5a19384247b2aef706582da92a7b1e8f2e994

See more details on using hashes here.

File details

Details for the file passwordprotectedhttpserver-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for passwordprotectedhttpserver-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d5d88f9e6d9473c0eee324526262ed128072b7f80d7ac45f5105f77dfc428794
MD5 bb05fcff36f7313351aefb4072fa4d68
BLAKE2b-256 01960582dadd6b2c3e5d27c9d78894bccd5f6367350a8efaadbd8eaf1b4df450

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page