The MapFish framework provides a command for automatically generating MapFish applications. To create a MapFish application named HelloWorld use:
(venv) $ paster create -t mapfish HelloWorld
Most people would use Mako as the template engine, and SQLAlchemy as the Object Relational Mapper in their MapFish applications. So answer mako (the default) to the first question and True to the second question. To run the command in a non-interactive way you will use:
(venv) $ paster create --no-interactive -t mapfish HelloWorld sqlalchemy=True
Note
Pure Pylons applications are created with the paster create -t pylons command. When using paster create -t mapfish we tell paster to use mapfish as opposed to pylons as the application template. In practise the MapFish framework applies the pylons template before applying the mapfish template. This is why any MapFish application is also a Pylons application.
The main directories and files in the HelloWorld directory are:
Now let’s look at the main application directory (helloworld):
Hint
Recommended reading: The Definitive Guide to Pylons - Chapter 3.
You can use the Paste HTTP server to execute a MapFish application. For example, use the following to make the Paste HTTP server serve the HelloWorld application:
(venv) $ cd HelloWorld
(venv) $ paster serve --reload development.ini
The --reload option make the Paste server monitor all Python modules used by the HelloWorld application and reload itself automatically if any of them is modified. This is useful during development.
By default MapFish (and Pylons) applications are served on port 5000. You can change by editing the development.ini configuration file.
If you visit http://localhost:5000 in your web browser you should see the Welcome to Pylons page.
To stop the Paste server, use Ctrl+C on Unix and Ctrl+D on Windows.
Hint
Recommended reading: The Definitive Guide to Pylons - Chapter 3.