3. Directories

Karrigell distribution is organized in directories. They are defined by default when you install the package, but you can change these values in the configuration files

3.1 Default directory structure

Files and directories Directory name Comments
  Karrigell.py
  server_config.py
  default_host_conf.py
  hosts
Server directory At the toplevel of the distribution are the scripts that manage the built-in web server :
  • Karrigell.py and the other scripts that start the built-in servers
  • server_config.py defines the server options
  • default_host_conf.py is the default configuration options for hosts
  • hosts is a text file with host names and the location of their configuration file
+ karrigell
  + core
  + package
  + ...
Karrigell directory The Karrigell framework scripts
  • core : Karrigell core scripts
  • package : modules that can be imported by user-defined scripts
+ data
  + www
      + sessions
      conf.py      
Data directory Stores all the information related to the hosts defined for the server
The default host (localhost) information is stored in the subdirectory www
  • conf.py : configuration options for this host
  • sessions : a directory where session information is stored
  • log files, users database are also stored in this subdirectory
+ www
    index.pih
    ...
Root directory for the default host (localhost) This is the root directory for the default host (localhost) : the path where files requested by the url http://localhost are searched
This directory contains the script index.py, which is served when you type in the url http://localhost in your browser (the URL resolution mechanism searches for index files when the URL matches a directory)
Note that the name of this root directory is www, the same as the name of the subdirectory of the Data Directory where information related to this host is stored
+ common
  + admin
  + demo
  + doc
  + ...
Common directory This directory holds scripts that can be used by different hosts, for instance the administration services
Although they are not located in a host-specific root directory, they can be served with a url such as http://localhost/admin by using an alias defined in the configuration file conf.py for the host localhost

3.2 Customization

If you want to customize the directories where you store server- or host-specific information, here is what you have to do :

  • to change the directory for the script server_config.py, start the built-in server with an additional argument on the command line :

    python Karrigell.py [ServerConfigDirectory]
    
  • to change the directory for the file hosts, edit the value of host_conf_dir in server_config.py
  • to change the location of the data directory for the default host, edit the value of data_dir in the configuration script for this host