Jonathan Vanasco Wed, 24 Sep 2008 08:20:09 -0700
I've had to do this before...
you'll want to rename the appropriate files / directories , and then replace all the module name instances in your project
ie: if your project is named ASDFGHJK , then you'll need to rename: /ASDFGHJK /ASDFGHJK/asdfhjk /ASDFGHJK/asdfhjk.egg-info
then do a s/ASDFGHJK/? on the files
if you're using a mac, TextWrangler has a great find/replace function that works on directories
if you're using subversion for version control, i generaly like to do it like this: 1- rename files 2- commit 3- find/replace text 4- commit
if you're using git or mercurial, i think you can do the commits in one step. svn needs them in two though.
seems like the best way to do lossless image (jpeg) rotation in python is to use the commands jpegtrans and jhead, both open source, but command line. easy enough to wrap in a system call of sorts (subprocess.Popen)
see simple browser gallery for examples.
see also dreamhost pylons-deploy.txt
forms are closely related to models
you'll need a way to persist the data.
if it's not tied to a specific directory of content, then it should probably be stored in a database of sorts to allow data lookup.
with pylons that probably means using sqlalchemy
if you didn't enable it in your project to begin with, you'll need to do so now following: | http://wiki.pylonshq.com/display/pylonsdocs/Using+SQLAlchemy+with+Pylons
set up meta.py set up model
init_model in __init
configure database string in config (development.ini) sqlalchemy.url = sqlite:///%(here)s/jb-dev.sqlite
environment.py websetup.py
don't forget! paster setup-app development.ini
forms are closely related to models
you'll need a way to persist the data.
if it's not tied to a specific directory of content, then it should probably be stored in a database of sorts to allow data lookup.
with pylons that probably means using sqlalchemy
if you didn't enable it in your project to begin with, you'll need to do so now following: | http://wiki.pylonshq.com/display/pylonsdocs/Using+SQLAlchemy+with+Pylons
set up meta.py set up model
init_model in __init
configure database string in config (development.ini) sqlalchemy.url = sqlite:///%(here)s/jb-dev.sqlite
environment.py websetup.py
don't forget! paster setup-app development.ini
to start working with forms, you will new to methods to a class... one to show the form, one to handle the form.
you will also need to import the validate code. (formencode)
layouts and other form validation can be stored with other model code (I'm torn if that is more UI or model validation... pylons seems to go with model validation).
Pylons comes with an easy to use validate decorator, imported by default in your lib/base.py. Using it in your controller is pretty straight-forward:
#this gets the validate decorator. from pylons.decorators import *
to start working with forms, you will new to add methods to a class... one to show the form, one to handle the form.
you will also need to import the validate code. (formencode)
layouts and other form validation can be stored with other model code (I'm torn if that is more UI or model validation... pylons seems to go with model validation).
Pylons comes with an easy to use validate decorator, imported by default in your lib/base.py. Using it in your controller is pretty straight-forward:
#this gets the validate decorator. from pylons.decorators import *
once you have a basic pylons instance created, there are a few things that need to be configured for most sites to get started.
This seems beyond the scope of a basic installation document, but nonetheless should be documented.
from root of project:
paster controller name-of-new-controller
start with a main controller:
for simple sites this may be enough. (i.e. sites with only one level deep) for these sites it seems like over kill to make a separate controller for each page if there is really only an index page for each one.
some might argue to just stick with a templating system for a simple site, but just incase needs grow in the future, it is nice to have a framework in place. Pylons doesn't add a lot of bloat to even a simple site... so why not. Also keeps things consistent across projects.
make images and css directories in public:
remove public index.html (otherwise it will be default)
add standard templates
update routes
paster controller name-of-new-controller
start with a main controller:
for simple sites this may be enough. (i.e. sites with only one level deep) for these sites it seems like over kill to make a separate controller for each page if there is really only an index page for each one.
It may be adequate to stick with a template system (i.e. manual static, sphynx, webby) for a simple site. On the other hand, if you're comfortable with python and needs grow in the future, it is nice to have a framework in place. Pylons doesn't add a lot of bloat to even a simple site. A framework keeps things consistent across projects.
python tree - Google Search | http://www.velocityreviews.com/forums/t355467-tree-and-graph-structures-in-python.html | Tree and Graph structures in Python. | http://mail.python.org/pipermail/python-list/2007-November/464998.html | What about a Python Tree container? | http://www.google.com/search?q=boost+graph+python&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a | boost graph python - Google Search | http://www.osl.iu.edu/~dgregor/bgl-python/ | Boost Graph Library - Python Bindings | http://mail.python.org/pipermail/python-list/2007-November/465011.html | What about a Python Tree container? | https://networkx.lanl.gov/wiki | NetworkX | https://networkx.lanl.gov/wiki/Tutorial | Tutorial - NetworkX | https://networkx.lanl.gov/wiki/gallery | gallery - NetworkX