[Dancer-users] Dancer + Plack/Starman - location of .psgi matters?

Takeshi OKURA okura3 at gmail.com
Mon May 9 13:24:00 CEST 2011


2011/5/7 Richard Huxton <dev at archonet.com>:
> This works:
>  starman -E development -a bin/app.development.psgi ...
> This doesn't (complains about config not being loaded):
>  starman -E development -a res/app.development.psgi ...

Dancer.pm have a below code in sub _init_script_dir.
-------------------------------------------------------------------------
    # in bin/ or public/ we need to go one level upper to find the appdir
    $LAYOUT_PRE_DANCER_1_2 = 0
      if ($script_dirs[$#script_dirs - 1] eq 'bin')
      or ($script_dirs[$#script_dirs - 1] eq 'public');

    my $appdir = $ENV{DANCER_APPDIR} || (
          $LAYOUT_PRE_DANCER_1_2
        ? $script_path
        : File::Spec->rel2abs(Dancer::path($script_path, '..'))
    );
    Dancer::setting(appdir => $appdir);
-------------------------------------------------------------------------

So, bin and public dir are special case which appdir is set to one
level upper path.

You may work around the problem to set DANCER_APPDIR environment
variable. for example
DANCER_APPDIR=`pwd` starman -E development -a res/app.development.psgi ...

-- 
Takeshi OKURA


More information about the Dancer-users mailing list