Changed __DIR__ constant to app_path() helper

This solves an issue of "missing view" error in some environments. Those environments are probably badly configured, but this is more fail-safe.

This has been referenced earlier in #2512 but it has been closed.

If this proposed change has more downsides than upsides, please state them here before closing this pull request.