<<TableOfContents: execution failed [Too many arguments] (see also the log)>>
Uche's development/test setup
Note: see some extra details recorded for what it took to rescue the old, broken Copia Weblog into BC: UcheOgbuji/Copia
MacBook Pro with OS X Leopard and built-in Python 2.5.
Install easy_install
curl -O http://peak.telecommunity.com/dist/ez_setup.py sudo python ez_setup.py
Install virtualenv
sudo easy_install virtualenv
Set up a main virtual environment in your home directory
python -m virtualenv $HOME
This will create $HOME/lib/python2.5/site-packages, and as long as you're in that virtual environment, that's where installed packages will go.
You can go into the VE as follows:
source $HOME/bin/activate
You only need to create the virtual environment once. Next time you want to do any development, e.g. after reboot or opening a new shell, just re-activate as above.
If you ever want to create a separate virtual environment, for example to test different versions of Python packages, make sure you do so with the system Python: /System/Library/Frameworks/Python.framework/Python -m virtualenv...
Install the latest 4Suite 1.03 egg, 4Suite_XML-1.0.3-py2.5-macosx-10.5-i386.egg. This version is not yet released pending additional testing. Download the attachment, then
easy_install 4Suite_XML-1.0.3-py2.5-macosx-10.5-i386.egg
Ditto XSLTemplates-0.4.2-py2.5.egg
Install other prerequisites
easy_install amara paste webob selector wsgixml httplib2
Go to your development/test directory ($HOME/dev for me), grab the latest BC (requires Mercurial) and install it.
cd $HOME/dev hg clone http://hg.4suite.org/brightcontent bctrunk cd bctrunk python setup.py develop
Now set up a directory for your blog and make the BC package available, so you can use the templates and such. Also copy the INI and Atom store set-up files so you can customize them.
cd $HOME/dev mkdir copia; cd copia ln -s ../bctrunk brightcontent cp brightcontent/docs/devel_config.ini dev.ini cp brightcontent/docs/store.*.xml .
Finally, I assume you'll be creating or customizing your own template files, in which case I recommend creating your own template space.
mkdir templates; cd templates ln -s ../brightcontent/brightcontent/templates/common . ln -s ../brightcontent/brightcontent/templates/ionrock .
Repeat that last line for any other templates you want to use from the main distribution. ionrock includes 2 sets of templates: one for the Weblog front page, and another for the administrative interface. You can use one, the other, or both. Most people will design their own front page templates, and just use the ionrock admin template set. Let's say you want to create your own front end templates, called bestever, based on ionrock, but customized:
cp -R ionrock bestever
You'll need to update dev.ini to match the set-up prescribed above. As a useful reference here is the one I use:
[server:main] use = egg:Paste#http host = 0.0.0.0 port = 7100 [DEFAULT] base_url = http://127.0.0.1:7100/ template_directory = %(here)s/templates [pipeline:main] pipeline = session evalerror logger main_app [app:main_app] use = egg:Paste#urlmap / = blog /comments = comments /static = static [app:static] #Mount static files needed by templates use = egg:Paste#static document_root = %(template_directory)s [app:comments] use = egg:brightcontent#annotations_comments store.comments.module = pkg:brightcontent.core.application.annotations.store#CommentStoreManager store.comments.service = %(here)s/store.comments.service.xml store.comments.config = %(here)s/store.comments.config.xml [app:blog] use = egg:brightcontent#blog weblog_base_url = %(base_url)s template_directory= %(template_directory)s entries_per_page = 100 blog_template = bestever admin_template = ionrock template_files = %(base_url)sstatic/bestever/htdocs admin.template_files = %(base_url)sstatic/ionrock/htdocs xsltemplate_namespace = http://brightcontent.net/ns/ # blog application store info # This can be used in the wsgi environ via get_bc_store(environ)['entries'] # store.entries.module = pkg:brightcontent.core.application.blog#BlogStoreManager store.entries.service = %(here)s/store.entries.service.xml store.entries.config = %(here)s/store.entries.config.xml ### pipeline of middleware ### [pipeline:main_pipeline] pipeline = session evalerror logger [filter:session] use = egg:Beaker#beaker_session [filter:evalerror] use = egg:Paste#evalerror [filter:logger] use = egg:Paste#translogger [filter:gzip] use = egg:Paste#gzip
Then launch the server
paster serve --reload dev.ini
There are no entries at first, so go to the admin interface to add one:
http://127.0.0.1:7100/admin/
Click "write" (http://127.0.0.1:7100/admin/write), fill in at least the title and content and click "POST". Now visit your blog, with the new entry: http://127.0.0.1:7100/
You can also import from an existing feed:
python import-feed.py news.atom http://127.0.0.1:7100/atom/entries/
If you're launching this from a different shell, don't forget to set it to the needed virtual environment.
Using comments
The store setup by default includes comments capability (you should, for example have store.comments.service.xml), but double-check your dev.ini file.
You can use the import-feed.py To pull comments alongside entries:
python brightcontent/etc/import-feed.py -c http://localhost:7100/comments/ http://copia.ogbuji.net/blog/2007-07-27/index.atom http://localhost:7100/atom/entries/
Check what was added to entries and comments using your browser:
Webfaction setup
- Make some additions to .bashrc:
alias python=python2.5
export PYTHON=/usr/local/bin/python2.5
export PYTHONPATH=$PYTHONPATH:${HOME}/lib/python2.5
export PATH=$PATH:$HOME/bin- Set up .pydistutils.cfg
$ cat ~/.pydistutils.cfg [install] install_lib = ~/lib/python$py_version_short install_scripts = ~/bin
- Install Mercurial:
mkdir dl; cd dl wget http://www.selenic.com/mercurial/release/mercurial-1.0.tar.gz cd .. mkdir -p src; cd src tar zxvf ../dl/mercurial-1.0.tar.gz cd mercurial*/ python setup.py install
Check that it works by running hg
Optional: set up virtualenv
wget http://peak.telecommunity.com/dist/ez_setup.py python ez_setup.py easy_install virtualenv python -m virtualenv $HOME/lib/python-brightcontent source $HOME/lib/python-brightcontent/bin/activate
Install prerequisites
cd ~/src cvs -d:pserver:anonymous@cvs.4suite.org:/var/local/cvsroot login #Just hit enter at password prompt cvs -d:pserver:anonymous@cvs.4suite.org:/var/local/cvsroot get -r XML1_0-maint 4Suite mv 4Suite 4Suite-CVS; cd 4Suite-CVS python setup.py install --install-docs=$HOME/share --install-data=$HOME/share --install-devel=$HOME/lib/test cd .. cvs -d:pserver:anonymous@cvs.4suite.org:/var/local/cvsroot get Amara #Don't use easy_install since we didn't for 4Suite mv Amara Amara-CVS; cd Amara-CVS python setup.py install cd .. easy_install pastedeploy pastescript BeautifulSoup xsltemplates amplee hg clone http://hg.4suite.org/brightcontent/trunk brightcontent-HG cd brightcontent-HG python setup.py install
Note: for now you may want to use AmpLee SVN (0.6.1dev) for a big performance boost
cd ~/src svn co https://svn.defuze.org/oss/amplee/ amplee-SVN cd amplee-SVN python setup.py install
Now configure and launch. See for example Copia setup below
If you have your Weblog setup at ~/myweblog, test the setup as follows (but do not use this setup for production):
paster serve --reload ~/myweblog/devel.ini curl -i http://localhost:7100
Hooking up the Web site
Go to apps control panel page: https://panel.webfaction.com/app_/list
"Custom app (listening on port)"
See http://blog.webfaction.com/custom-application-faq for more details.
Go back to the apps list and check which port the app is assigned to. For this example use port 4444, calling the app "brightcontent"
Go to Web sites control: https://panel.webfaction.com/site/list
Pick the site you want and set the app brightcontent to mount at /, or /blog, or wherever you prefer
In order to ensure restart on a server crash, as explained in http://blog.webfaction.com/custom-application-faq , set up a script in $HOME/webapps/brightcontent/autostart.cgi with mode 711. See the following example:
#As explained in http://blog.webfaction.com/custom-application-faq
print "Content-type: text/html\n"
print """<html><head>
<META HTTP-EQUIV="Refresh" CONTENT="5;URL=/"></head>
<body>Site is restarting...<a href="/">click here to continue<a></body></html>
"""
import os
import sys
os.setpgid(os.getpid(), 0) # prevents Apache shutting it down when idle for a period of time.
#See http://www.faqts.com/knowledge_base/view.phtml/aid/3298
HOME = '/home/mywebfactionuser'
os.environ["PYTHONPATH"] = os.path.join(HOME, "lib/python2.5/site-packages/")
os.system('~/bin/paster serve --daemon --log-file ~/logs/user/myweblog/paster.log ~/myweblog/production.ini')
Copia
Copia is Uche and Chime Ogbuji's Weblog, at http://copia.ogbuji.net . It's hosted on Webfaction so the first steps were as documented above. See UcheOgbuji/Copia for more info.
mkdir copia; cd copia wget "http://wiki.xml3k.org/UcheOgbuji/Copia?action=AttachFile&do=get&target=copia.ini" wget "http://wiki.xml3k.org/UcheOgbuji/Copia?action=AttachFile&do=get&target=import-copia.py" cp ~/src/brightcontent-HG/docs/store.*.xml . mkdir templates; cd templates hg clone http://hg.4suite.org/sandbox/ogbuji/copia-template ogbuji ln -s ~/src/brightcontent-HG/brightcontent/templates/zen/ . ln -s ~/src/brightcontent-HG/brightcontent/templates/common/ . mkdir ~/logs/user/copia ln -s ~/logs/user/copia ~/copia/logs
To launch by hand:
paster serve --daemon --log-file ~/logs/user/copia/paster.log ~/copia/copia.ini
Then import from present Copia
mkdir ~/lib/java; cd ~/lib/java wget http://home.ccil.org/~cowan/XML/tagsoup/tagsoup-1.2.jar cd ~/copia export TAGSOUP=$HOME/lib/java/tagsoup-1.2.jar python import-copia.py -t $TAGSOUP -c http://localhost:7100/comments/ http://oldcopia.ogbuji.net/blog/2005/index.atom http://localhost:7100/atom/entries/ python import-copia.py -t $TAGSOUP -c http://localhost:7100/comments/ http://oldcopia.ogbuji.net/blog/2006/index.atom http://localhost:7100/atom/entries/ python import-copia.py -t $TAGSOUP -c http://localhost:7100/comments/ http://oldcopia.ogbuji.net/blog/2007/index.atom http://localhost:7100/atom/entries/ python import-copia.py -t $TAGSOUP -c http://localhost:7100/comments/ http://oldcopia.ogbuji.net/blog/2008/index.atom http://localhost:7100/atom/entries/
Should now be set up:
curl -i http://localhost:7100
Server news development/test setup
Environment is already set up to install Python modules in home:
uogbuji@gonzaga:~$ echo $PYTHONPATH /home/uogbuji/lib/lib/python2.4/site-packages uogbuji@gonzaga:~$ cat .pydistutils.cfg [easy_install] prefix=/home/uogbuji/lib site_dirs=/home/uogbuji/lib/lib/python$py_version_short/site-packages [install] install_lib = ~/lib/lib/python$py_version_short/site-packages install_scripts = ~/bin
Pull BC
mkdir brightcontent; cd brightcontent hg clone http://hg.4suite.org/brightcontent bctrunk ln -s bctrunk brightcontent
Pull BC
Pull BC
Old stuff
Initializing the store
Requires the httplib2 library:
easy_install httplib2
Then make sure the APP server plug-in is enabled in config and launch the server:
cd ~/dev/brightcontent/ paster serve --reload copia.ini
Finally do the import:
python trunk/etc/import-feed-via-app.py -f http://copia.ogbuji.net/blog/index.atom -s entries -u http://localhost:8080/atom
