4. Configuration options
Configuration options are set in a configuration file. By default it is the
Karrigell.ini file in directory data. You can set it to a different file in
the command line
A variable base is set by Karrigell before loading the configuration file, its
value is the server directory. See example of use with %(base)s/ in the default
Karrigell.ini file
The configuration file is split into several sections :
[Directories]
root
Set the root option to the full name of the Root Directory, the one from which
you'll want to serve files. On installation it is not set, the default is the folder
webapps in the Server Directory
cgi
The list of directories for cgi scripts
Defaults to webapps/cgi-bin in the Server Directory
protected
a list of protected directories ; for each script in these directories
a test if performed with the Login() function to see if user is logged as
administrator.
By default, only the directory webapps/admin is protected. Use
";" to add other ones
allow_directory_listing
If a url matches a directory with no index file in it, determine if the directory
content should be printed, or if an error message should be sent
Defaults to 1 (print directory content)
hide_extensions
A list of file extensions that will be hidden (return error 403)
hide_paths
A list of regular expression patterns that will be matched to url paths ; if a
match succeeds then the server will return error 403
This can be used to forbid access to a set of directories. For instance if
you have a version control that creates directories named cvs you
can forbid access to them with this line :
hide_paths = .*/cvs/.*
loggingFile
The name for a logging file. If not set, no logging is performed
loggingParameters
Parameters for logging handlers, refer to Python documentation, module logging
The following are for RotatingFileHandler:
mode="a", maxBytes=1000000, backupCount=10
[Applications]
Maps file extensions to MIME types ; as far as I know this works with Netscape, but Internet
Explorer overrides these settings
[Alias]
You can associate an alias to a path on the file system. For instance, if you create this alias
:
scripts=
then the url
htpp://localhost/scripts/index.htm will serve the file
[Server]
port
Set the port option to change the HTTP port (default 80)
reload_modules
If set to 1, all imported modules are reset at every import,
so you don't have to restart the server when you change something in an
imported script. Defaults to 1
show_trace
show_trace indicates if you want detailed information,
including the Python traceback, to be printed in case of error or exception
during script execution. Defaults to 1. if set to 0, only a message
like "Server was unable to process the request" will be printed, without
any other detail
debug
debug indicates if you want the "Debug" button to appear on
the error pages. You might want to set it to 0 for security reasons.
Default is 1 (the button is shown)
silent
If the silent option is set to 1, nothing is printed on the console window
gzip
If the gzip option is set to 1, and the user agent supports gzip encoding
(most browsers do), the server compresses the data sent to the user agent. This reduces
the use of the network, but slows down the server a little
global
In the global option, specify the path to the modules which must be imported in
every script run by Karrigell. If you have a line like
global=%(base)s/myScript.py;%(base)s/myScript1.py
both modules myScript and myScript1 will
be available in the namespace of all scripts
ignore
A list of urls to ignore if not found (return the HTTP code 204 instead of 404). Used
by default to ignore the url /favicon.ico, searched by many browsers
[Translation]
Specifies the language used in the application, regardless of the options
defined in the web browser. Set lang=default if you don't want any
translation, lang=en if you want to use translations in English, etc
[VirtualHost name]
Karrigell supports the notion of virtual hosts, allowing to serve different hosts
with different names on the same server
To specify a virtual host you add a line like this in the configuration file :
[VirtualHost name]
where name is the host name (like www.test.org)
In this section, you have to specify a directory from which the serve will
serve the requests to this specific host :
root = /web/mydir
|