packages feed

happs-tutorial-0.9.4: templates/runtutoriallocally.st

<h3>Run This Tutorial Locally</h3>

<p> Before going further, you may want to inform yourself about the <a href=/tutorial/prerequisites>basic prerequisites</a>, both knowledge and equipment, you need to make the best use of this tutorial. </p>

<p>To fetch the latest version of this tutorial, install <a href="http://www.darcs.net/">darcs</a>, fetch the repo, and run happs-tutorial from within the repo:

<pre style="margin-left: 1em;">
darcs get http://patch-tag.com/r/wchogg/happstack-tutorial/pullrepo happstack-tutorial
cd happstack-tutorial
cabal install
happs-tutorial 5001 True True
</pre>

<p>You should now be able to browse this tutorial offline by running the executable, and opening http://localhost:5001 in your browser.</p>

<p>If you've never used cabal install or need more detailed info see the <a href="http://hackage.haskell.org/trac/hackage/wiki/CabalInstall">cabal install</a> homepage.</p>

<p>If you prefer to run the app in ghci, do ./hackInGhci.sh and then execute runInGhci inside Main.hs.

<p>Every so often, when starting via runInGhci, you may get an error message like:</p>

<p>*Main> runInGhci
happs tutorial running in ghci.
exit :q ghci completely and reenter ghci, before restarting.
*** Exception: _local/happs-tutorial_state/events-0000000006: openFile: resource busy (file is locked)
</p>

<p>Don't worry about it. Every time I get this error I simply run runInGhci again, and the second time it always works.</p>

<p>This issue does not occur when you run the tutorial from a compiled executable, which is of course how you should be running for a production application.</p>


<p>If you get the error "`Control.Monad.Trans' was found in multiple packages: transformers-0.1.4.0 mtl-1.1.0.2", you can use the command "ghc-pkg hide transformers" to prevent ghci from seeing the conflicting package.</p>

<p>You may also want to <a href="start-happstack-on-boot">start Happstack on boot</a>.</p>

<p>Next up is a first example of using <a href="/tutorial/your-first-happstack">Happstack</a>.</p>