|
From: <ci...@on...> - 2022-05-21 20:47:41
|
> Now, I /suspect/ the reason that this hack above to was done because, > given the way this script is “invoked” (via exec), if you didn’t do > this, when you tried to exec the WSGIScript.py content, you’d get: > > NameError: name '__file__' is not defined > > but then why have all that logic in the WSGIScript.py determining > workDir in the first place? Is the WSGIScript.py file used in some > other context?> > And what was the point of adding –wsgi-script as an argument to > WaitressServer.py if it didn’t allow you to specify app location other > than the default? Hi Will, yes, the WSGIScript can be used in different contexts. Keep in mind that Webware can used with any WSGI server. Waitress is just the default development server, which can also be used for production if you do not need very high performance. For instance, with Apache mod_wsgi you could set the path of the WSGI script in the Apache configuration with WSGIScriptAlias. The work dir (project directory) would then be either set to the "workDir" path given in the WSGI script or to the directory two levels higher if no such path is specified, using the logic you mentioned. The WaitressServer script is used for the command line interface (the "webware serve" command). If you use this command, the work dir is always the directory that you run the command in. It is mainly intended to be used during development. The --wsgi-path option can be used to specify a different WSGI file, if you do not want to use the default path (Scripts/WSGIScript.py) inside the working directory. If you want to run the script in the standard location, just cd to your working directory and call WaitressServer or webware serve there. Hope that helps. -- Christoph |