PyWebScrapBook icon indicating copy to clipboard operation
PyWebScrapBook copied to clipboard

Environment Variable to specify configuration location for use in WGSI servers

Open jdunn0 opened this issue 2 years ago • 1 comments

I was thinking of using mod_wsgi to host PyWebScrapBook via my Apache server but the only way to configure scripts in mod_wsgi is by using Environment Variables.

From looking at the documentation for PyWebScrapBook, it appears that the only places it supports for a configuration location is the script directory, the working directory or the user's home directory.

For security reasons, the script location and web server user home directory will usually only allow write access for the root user. As for the working directory, as the mod_wsgi documentation on the working directory, says "When Apache is started it is typically run such that the current working directory for the application is the root directory, although the actual directory may vary dependent on the system or any extra security system in place." thus using the working directory is not a reliable way to specify a configuration location.

So it appears the best way of getting a configuration location when using a WSGI server like mod_wsgi would be allow setting the configuration location via an Environment Variable.

jdunn0 avatar Feb 07 '23 00:02 jdunn0

I'm not quite familiar with mod_wsgi, but the config path is usually determined by the path of the WSGI script. Otherwise you should be able to configure it through the config file or environment variable of Apache.

You can also setup a reverse proxy for the PyWSB app, which is a popular way to setup web services.

danny0838 avatar Feb 10 '23 13:02 danny0838