radaczynski / Shabti

fork of shabti

Shabti (pylons + elixir template) cut down to just basic elixir stuff plus scaffolding.

Clone this repository (size: 2.1 MB): HTTPS / SSH
$ hg clone http://bitbucket.org/radaczynski/shabti/

Welcome

This is a simple fork of shabti, which was based on tesla, which added Elixir bindings for pylons (python web-framework for rapid application development).

All of this aims to make developing pylons-based web-applications easier.

Tutorial

So here's a short tutorial on using this stuff:

  • install mercurial
  • make a directory for shabti:
mkdir shabti
cd shabti
  • clone this repo:
hg clone http://bitbucket.org/radaczynski/shabti
  • make paster see this template
sudo python setup.py develop
  • create your project (select mako as templating engine and True for sqlalchemy)
paster create -t shabti blog
  • go to blog/model/init.py, describe your entities with elixir language like this:
class Page(elixir.Entity):
    title=elixir.Field(sqlalchemy.types.Unicode(30),nullable=False)
    body=elixir.Field(sqlalchemy.types.UnicodeText,nullable=False)
    created_at=elixir.Field(sqlalchemy.types.DateTime,nullable=False,default=datetime.datetime.now)
    created_at=elixir.Field(sqlalchemy.types.DateTime,nullable=False,default=datetime.datetime.now)    
    comments=elixir.OneToMany('Comment')
    tags=elixir.ManyToMany('Tag')
    
class Comment(elixir.Entity):
    title=elixir.Field(sqlalchemy.types.Unicode(30),nullable=False)
    body=elixir.Field(sqlalchemy.types.UnicodeText,nullable=False)
    created_at=elixir.Field(sqlalchemy.types.DateTime,nullable=False,default=datetime.datetime.now)
    created_at=elixir.Field(sqlalchemy.types.DateTime,nullable=False,default=datetime.datetime.now)    
    page=elixir.ManyToOne('Page')
    
class Tag(elixir.Entity):
    name=elixir.Field(sqlalchemy.types.Unicode(30),nullable=False)
    pages=elixir.ManyToMany('Page')

this of course should go before setup_all() }}}

  • create the databe and tables
paster setup-app development.ini
  • make the scaffolds
paster scaffold page pages
paster scaffold comment comments
paster scaffold tag tags
  • run the server
paster serve --reload development.ini

This revision is from 2008-10-03 16:12