The Artima Developer Community
Sponsored Link

Python Buzz Forum
Paste App Installation

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Ian Bicking

Posts: 900
Nickname: ianb
Registered: Apr, 2003

Ian Bicking is a freelance programmer
Paste App Installation Posted: Jan 13, 2006 10:27 AM
Reply to this message Reply

This post originated from an RSS feed registered with Python Buzz by Ian Bicking.
Original Post: Paste App Installation
Feed Title: Ian Bicking
Feed URL: http://www.ianbicking.org/feeds/atom.xml
Feed Description: Thoughts on Python and Programming.
Latest Python Buzz Posts
Latest Python Buzz Posts by Ian Bicking
Latest Posts From Ian Bicking

Advertisement

I just made a first run at some tools in Paste Script for installing web applications.

The idea is a two-phase installation; first you install the package distribution and ask it to write out a sample configuration. Then you edit the configuration. Then you ask the application to set itself up (maybe setting up databases, making directories, etc).

This is not unlike a fancier-seeming system where there's a web interface or GUI or whatnot; except all that interaction is encapsulated in editing a text configuration file. I think this is a good technique because (a) it much much easier to implement, (b) it is consistent with later maintenance, (c) it uses a powerful native UI that many people are comfortable with (the text editor), and (d) it requires very little work for an application to support.

So, in the trunk you can do:

$ paster prepare-app \
  -f http://pythonpaste.org/package_index.html \
  PasteHelloWorld helloworld.ini
$ edit helloworld.ini
$ paster setup-app helloworld.ini

You can also combine this all into:

$ paster prepare-app \
  --edit --setup \
  -f http://pythonpaste.org/package_index.html \
  PasteHelloWorld helloworld.ini

Which will immediately open the configuration file in your editor, and when you are done editing it will set up the application. (And prepare-app also installs the application with easy_install, so it really can be just one step).

This is a pretty early prototype, really, so I'm still very interested in feedback on even the most minor details. Like, what should these commands be called?

Also, people lay out their systems differently. I have a vague concept of a "system configuration" which will determine some basics about what goes where. But it's very vague. Ideally I'm hoping that hosting companies could setup such a configuration so that everything Just Works for users, including system hooks to be run on installation and whatnot. Now that I think about it, that probably means entirely new system-specific command-line options as well.

I've also written a simple class for setting up applications, so that you can add this to your application's setup.py:

setup(...
    entry_points="""
    [paste.app_install]
    main = paste.script.appinstall:Installer
    """)

This will look for a template configuration file in MyPackage.egg-info/paste_deploy_config.ini_tmpl (a Cheetah template, actually), and run mypackage.websetup.setup_config() on setup, and probably more things over time.

At some point I also plan to add such a generic setup class to SQLObject, so that a SQLObject-using application will be able to automatically set up its database on installation, as well as upgrade its database later (these classes should be reentrant, so you can run paster setup-app config_file.ini at any time to confirm and apply any new things to be setup).

Read: Paste App Installation

Topic: Another nice Python Tutorial Previous Topic   Next Topic Topic: Regenjas

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use