Working locally | Dragonfly web framework

Working Locally

With Dragonfly web development is fast and painless. There's no need to upload your changes to some remote server for testing, nor do you have to setup and run a local Apache web server.

In this tutorial, we'll show you how to run this website on your computer. We will also cover some important caveats related to how we're able to remove the leading question-mark from the URL using the newlisp-redirection.lsp file.

Before following these steps, make sure you have the latest version of newLISP installed, preferably version 10.1.9 or later.

Step 1: Get Dragonfly

Download the latest version of Dragonfly from Google Code and unzip it somewhere.

Step 2: Run the 'newlispServer' script

Inside of the unzipped folder you'll find a folder called example-site, and inside of there are two newlispServer scripts, one is for UNIX-based operating systems, and is a bat file for Windows.

If you're running Windows, just double-click on the newlispServer.bat file. On OS X/Linux/UNIX we'll run newlispServer from the terminal:

$ cd path/to/dragonfly-newlisp/example-site
$ ./newlispServer
If all goes well visit http://localhost:8080 in your browser

As the script says, now visit http://localhost:8080! You should see this website in your browser.

That's it! Have fun!

Feel free to look through the files and folders inside of the example-site folder to get an idea of how everything works. Don't be afraid of tinkering around and making changes to files!

Unlike some other LISP-based web frameworks, Dragonfly is powered by newLISP which is an extremely dynamic interpreted language, perfectly suited for web development. The second you hit save the changes are live, no need to recompile!

Note on newlisp-redirection.lsp

Inside of the dragonfly-framework folder you'll find a file called newlisp-redirection.lsp. This file is only loaded when running newlispServer script, and it is what allows us to have URLs like this:

http://localhost:8080/working_locally

Instead of:

http://localhost:8080/?working_locally

You can think of it as the newLISP version of the .htacces file.

Normally you don't need to worry about it, but as with the .htaccess file, it determines which requests get handled by Dragonfly, and which requests get handled directly by the server (in this case, newLISP).

Thus, if you decide that you'd like requests for files ending in ".foo" to be routed through Dragonfly, then you'll need to edit a list called NEWLISP_REDIRECTION_EXTENSIONS which is defined in newlisp-redirection.lsp and by default is set to:

'(".html" ".nhtml" ".nl")

Because newlisp-redirection.lsp is loaded before anything else, you must edit NEWLISP_REDIRECTION_EXTENSIONS directly in that file itself, and add to it any additional file extensions that you would like Dragonfly to handle.

CONTINUE »

Rendered in 1 milliseconds. Used 83 KB of memory, 58 KB for Lisp Cells.