This is the work-in-progress user documentation for Portfolyo. It doesn't really tell you much about actually using Portfolyo through the web, though. At this point this is so trivial that there's not much sense in documenting it. Rather less trivial are the installation and customization of Portfolyo, so this is what this document is mainly about.
Portfolyo will work on any system that runs Python. When giving specific instructions this document covers mostly Unix-ish systems, though. Still, figuring out equivalent instructions for a Windows (or even weirder) type of system on your own shouldn't be too hard.
Note that this document was written by a non-native English speaker. You'll undoubtedly stumble over some strange or even plain wrong wording. We'll not feel offended at all if you report corrections or suggestions for improvement of this text.
If this document cannot resolve your problems, you can direct your questions to Portfolyo's author, Nik Haldimann, at portfolyo@ubique.ch. He also likes to receive feature requests and bug reports at this address.
Portfolyo's home on the web is at http://ubique.ch/code/portfolyo.
Portfolyo is Copyright (c) 2003-2005 Nik Haldimann.
Portfolyo is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
Portfolyo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
For third-party licenses, see Appendix: Third-party Licenses.
Porfolyo is a CGI-based application written in Python. To run it you need a web server featuring:
Cheetah is the templating system Portfolyo uses to generate HTML output. It is included in the Portfolyo source and installed during a standard install. The performance of this Cheetah version is suboptimal, since it's a pure-Python version. It is highly recommended you download Cheetah yourself and install it separately (with compiled C extensions). Portfolyo will detect an existing Cheetah installation and use it.
Portfolyo has only been tested with Cheetah version 0.9.16a2. Please use that or a higher version.
Portfolyo will automatically create thumbnails (small preview versions) of pictures attached to projects. To do this the Python Imaging Library (PIL) is required. Install PIL if you want thumbnails.
Download the most recent Portfolyo release from the website. The downloaded file will be called Portfolyo-0.2.1.tar.gz. Unpack it using your favourite zip application. In a Unix shell you'd do it like this:
tar xvzf Portfolyo-0.2.1.tar.gz
Or if you're system doesn't have GNU tar:
gunzip < Portfolyo-0.2.1.tar.gz | tar xvf -
If you have shell access to your web server, you'll want to use Portfolyo's ready-made install script, install.py (with no shell access, see the section Manual installation). The installer will perform most of the setup related stuff for you, namely:
To do all of this the installer needs some data from you, which you pass in as command line arguments. The usage pattern looks like this:
python install.py --db=<db> --user=<dbuser> [--pwd=<dbpwd>]
[--host=<dbhost>] [--dbtype=<dbtype>]
--cgidir=<cgidir> [--templatedir=<tmpldir>]
[--picdir=<picdir>] [--libdir=<libdir>] [--silent]
[--help]
Each of the options also has a short form specified below. The short form is used like this: -o<argument> (no space between option and argument!)
Here's what the options mean:
Here's a practical example. You have already created a local MySQL database called portfolyo and the database user pinky can access it. The directory /var/www/cgi-bin on your web server is the CGI-enabled directory where you want the Portfolyo scripts to reside. The default location for template files - which is the subdirectory templates of the CGI directory - is acceptable for you. You are logged in as root, and you want the Portolyo modules to go to the default Python site-packages directory.
Now, on a command prompt in the root directory of the unpacked Portfolyo release, you type:
python install.py --db=portfolyo --user=pinky --cgidir=/var/www/cgi-bin
After you were prompted for pinky's password the installer will setup Portfolyo.
If you don't have root access to your web server, you might have to install the modules somewhere else. It's probably best to put them in the CGI directory, too. So we have (still on one line, of course):
python install.py --db=portfolyo --user=pinky --cgidir=/var/www/cgi-bin
--libdir=/var/www/cgi-bin
If the installation was successful, the installer will report so. You should now already be able to look at your brandnew portfolio through the web. Provided the CGI directory you specified maps to the URL www.yourdomain.com/cgi-bin, hit www.yourdomain.com/cgi-bin/portfolyo.cgi in a web browser to check if it's working.
Next, you might want to start entering data in the admin interface at www.yourdomain.com/cgi-bin/pfadmin.cgi. The default user name to access it is admin. You'll have to look up the password - it's initialized to a random value during the installation and saved as the parameter adminPwd in the config file pfconfig.cgi in your CGI directory. If you want the password to be easier to remember, you should now set the adminPwd parameter in the config file to a value of your choice.
If the installation fails or if the CGI scripts refuse to work after the installation, check out the Troubleshooting section.
Maybe you don't have shell access to your web server - it's not uncommon to only have FTP access on a shared host. Or maybe you want more control over the installation process. In either case you can install Portfolyo manually as described in the following sections.
First create the database tables. You can find the SQL statements needed for that in the file db/create_tables_mysql.sql for MySQL or in db/create_tables_postgresql.sql for PostgreSQL. Execute the contents of this file on your database. How exactly that is done is hard to predict without knowning the specifics of your system.
If you have some kind of web-based admin interface available (e.g. phpMyAdmin or phpPgAdmin), use that. If you happen to be able to connect to your database server from your local machine, you can feed the file directly to the command line client. Using MySQL:
mysql -u user -h host -p database < db/create_tables_mysql.sql
Using PostgreSQL:
psql -U user -h host -f db/create_tables_postgresql.sql database
You must copy three types of files to your web server: CGI scripts, library files and template files. You should also create a picture directory.
The CGI scripts are in the directory cgi-bin of a Portfolyo release. Copy the files in there to the directory on your server, where you want them to be accessed via the web. It should be a directory in which your web server can execute CGI Python scripts.
If you're web server is Apache, you'll most probably have to make sure that the shebang lines of these files point to your Python interpreter. For example, if the Python interpeter on your server is at /usr/local/bin/python change the first line of all CGI scripts (except for the config file pfconfig.cgi) to this:
#!/usr/local/bin/python
Then set the correct (execute) permissions on the CGI files. On a Unix-ish system you might do that like this:
chmod 755 *.cgi
The library files are in the directory portfolyo of a Portfolyo release. If you have the privileges to do so, copy this directory to the site-packages directory of the Python installation on your server.
If you can't do this or don't know where your site-packages directory is, you can also copy the library directory to the CGI directory you installed the CGI scripts to. For example, if you installed the CGI scripts to the directory cgi-bin on your web server, copy all files in the portfolyo directory of your release to the directory cgi-bin/portfolyo.
The template files are in the directory templates of a Portfolyo release. Copy this directory to a location of your choice on the web server. Just make sure that it's some place where the CGI scripts can access them.
It's recommended to install them in the same directory you put the CGI scripts. For example, if you installed the CGI scripts to the directory cgi-bin on your web server, copy all files in the templates directory of your release to the directory cgi-bin/templates.
Preferrably the directories below the templates are world-writeable, so the CGI scripts can compile templates in them. Here's how you'd assert this on a Unix-ish system, assuming you've copied the templates to the directory /var/www/cgi-bin/templates on your server. In a terminal type this:
cd /var/www/cgi-bin/templates chmod 777 *
The picture directory is used to store pictures and binary files uploaded through the administration interface. It's most convenient to elect a subdirectory of the CGI directory as picture directory. Simply create a directory and make it world-writeable. On a Unix-ish system you'd do:
mkdir pictures chmod 777 pictures
As an example, this is a typical directory layout after you copied all files to your web server:
public_html/ (web server root)
cgi-bin/ (CGI scripts)
pictures/ (picture directory)
portfolyo/ (library files)
templates/ (template files)
Everything else in place, you should now update your config file. You will have to change at least the database parameters, the templatePath, the picturePath and the adminPwd. The default config file is sprinkled with comments explaining the parameters, so you should be able to figure out what values to use. For a more in-depth discussion see the section Configuration parameters.
If the installer was successful, it will report back with a message along the lines of "Successfully installed Portfolyo". If you don't see the success message after the installer finished, it must have encountered a problem during installation.
Here are some things you can check when the installer fails:
Are you using the correct Python version? You need Python 2.2 or greater. Type "python -V" in your shell to display your Python's version number.
Are you specifying valid database parameters? If the installer issued a Python stack trace and it seems to be about MySQL/PostgreSQL, there is most likely a problem with the database parameters you passed to the installer. Using MySQL, the last line of the stack trace will look like this in most of those cases:
_mysql_exceptions.OperationalError: (1045, "Access denied for user: 'someuser@localhost' (Using password: YES)")
Using PostgreSQL, you will probably get a similarly looking OperationalError.
Verify that the database you specified exists, and that the user you specified does have privileges on this database. The user especially needs privileges to create tables on this database. Also verify that you correctly typed the password of the user. Then run the installer again.
Do you have write permissions on all installation directories? You need write permissions on the directories you passed as cgidir, templatedir and libdir to the installer. If you don't, you'll normally see this as the last line of output from the installer:
error: could not create '/usr/lib/python2.2/site-packages/portfolyo': Permission denied
Most problems happen with libdir. If you don't specify a libdir, the installer will try to install libraries into the site-packages directory of your Python installation. Normally, only administrators have access to this directory. If you didn't specify a libdir and the installer failed with the above error message, log in to your system as an administrator (i.e. use sudo on Unix-ish systems) to run the installer - if you can. If you can't, install the libraries somewhere else. It's recommended to specify the same directory for libdir as for cgidir in that case.
Are your distutils broken? The Portfolyo installer uses the Python standard module distutils to do part of its work. If the installer issued a Python stack trace which mentions distutils, the module is most likely not present or broken. Some Linux distributions do not bundle distutils with their standard Python package. Check if there's something like a python-devel package for your distribution and install that. If this doesn't apply to you or doesn't help, you should try a Manual installation.
If you think you're experiencing a problem not described above, contact us at portfolyo@ubique.ch. Don't forget to include the output of the installer and information about your system (operating system, Python version number and other stuff relevant to your problem) in your email.
The first thing you should do when you think the CGI scripts portfolyo.cgi or pfadmin.cgi are not working when viewed in a browser, is turn on debug mode. You do this by setting the debug parameter in the config file pfconfig.cgi to "1".
Having turned on debug mode, hit the failing CGI script again. What do you see in your browser, now? Three common cases are covered below.
You get a "500 Internal Server Error". This means there is a problem not in the script itself, but in the CGI environment it's being executed in. Two situations are common:
The CGI scripts don't have execute permission. Verify that the scripts can be executed. On a Unix-ish system you can ensure this by typing issuing the chmod command in a shell in the CGI directory:
chmod 755 *.cgi
Using Apache, the shebang line of the CGI scripts doesn't point to a Python interpreter. For example, if the Python interpreter on your server is at /usr/bin/python the first line of the CGI scripts - the so-called "shebang" - must look like this:
#!/usr/bin/python
You see a Python stack trace. This means the script was handed over to the Python interpreter, but there was an error during execution. If you're familiar in any way with Python, you should be able to figure out what caused the error. If reading stack traces is not your thing, here's some things that could have gone wrong:
The code of the script is shown in plain text. This means your web server doesn't interpret the file as a CGI script. You have to tell it to - consult the documentation of your web server on how this is done. If you're using Apache, you'd normally do it by creating a text file named .htaccess with these contents:
Options +ExecCGI AddHandler cgi-script .cgi
Copy this file to the directory of your CGI scripts and see if this fixes the problem.
Don't forget to turn off debug mode, as soon as you have solved your problem. Leaving it on won't hurt you directly, but it's considered safer to turn it off when the general public is browsing around your portfolio.
If you think you're experiencing a problem not described above, contact us at portfolyo@ubique.ch. Don't forget to include the text seen in your browser (maybe you can even provide a link to the CGI script) and information about your system (operating system, web server, Python version number and other stuff relevant to your problem) in your email.
An upgrade of an existing Portfolyo installation with the command line installer basically works exactly the same way as a fresh install. You simply pass the installer arguments that match your existing installation, and it will detect that you're performing an upgrade. Read the section The command line installer for details on arguments to the installer.
Before it performs an upgrade, the installer separately checks for the presence of prior versions of the Portfolyo libraries, the CGI scripts, templates and database. It will present you with a list of what exactly it found and (unless you specified the --silent flag) prompt you for a confirmation that you really want to upgrade.
During the upgrade, existing libraries, CGI scripts and standard template sets will be overwritten. Existing config files and the database will be preserved.
Here's an example. You've installed Portfolyo 0.1 on your system. The directory /var/www/cgi-bin contanins the CGI scripts. The template sets are in a directory called templates below the CGI directory (the standard location for templates). The libraries are in Python's site-packages directory, the default location for Python libraries. The Portfolyo database is named portfolyo, pinky is a user with access rights to this database.
Now, on a command prompt in the root directory of the unpacked Portfolyo release, you type:
python install.py --db=portfolyo --user=pinky --cgidir=/var/www/cgi-bin
After you were prompted for pinky's password the installer will detect that there's an existing Portfolyo installation in the locations you specified for the CGI, template and library directories. After an additional confirmation prompt, the upgrade is performed.
That's all there is to it. Since the upgrade doesn't touch your config file and your data, you should be able to access your brandnew Portfolyo version through the web already.
Usually you won't have to take any manual actions if you use the installer for an upgrade. You should, however, check the Upgrade notes section for your particular version numbers. There may be reservations or additional things you should look at.
If you're in the unfortunate position to not be able to use the installer, maybe because you don't have shell access to your server, you can still manage an upgrade manually.
A manual install consists of replacing existing CGI scripts, libraries and templates with new ones. Which files need to be placed where is described in the section Installing files - simply use the locations of your existing Portfolyo installation.
A thing to look out for: Don't overwrite your existing config file (pfconfig.cgi in your CGI directory). You can normally simply reuse old config files for newer versions of Portfolyo.
After you've replaced CGI scripts, libraries and templates, check the Upgrade notes section for additional remarks on your particular upgrade.
Versions after 0.1 have template compiling turned on by default. Template compiling works only, if the CGI scripts have write access to the template directories. Usually this means, these directories need to be world-writeable. The installer cannot manage these access rights, so you should do that yourself after an upgrade from Portfolyo 0.1.
Here's how you'd do it on a Unix-ish system, assuming your template sets are in the directory /var/www/cgi-bin/templates. In a terminal type this:
cd /var/www/cgi-bin/templates chmod 777 *
If you can't or don't want to take care of this, you can also simply turn off template compiling by adding the compileTemplates parameter to your config file:
compileTemplates = 0
Starting from version 0.2 the database schema changes slightly with almost every release. The installer will migrate your existing data to the new schema - but only if the existing version you're using is 0.1.3 or higher. If you want to upgrade to 0.2 (or higher) from a version lower than 0.1.3, please upgrade to 0.1.3 first.
Version 0.2 introduced the configuration parameter picturePath. You have to add this manually to your configuration file after the upgrade. If you haven't specified anything else while executing the installer, it has created a subdirectory of your CGI directory called pictures. So normally you can simply add this line to your configuration file:
picturePath = pictures
Migrating a database from MySQL to PostgreSQL (or the reverse) is possible - but only starting from version 0.1.3. If you want to migrate and you're currently using a lower version, first upgrade to version 0.1.3.
In the Portfolyo administration you will now find a new "Maintenance" tab in the navigation. On the maintenance page click on "Export to XML". This exports all data in your database to a file (you will be prompted to choose a location for this file on your computer).
Now prepare the database you want to migrate to. First create the Portfolyo tables in this new database as described in the Database tables section. Then edit the Portfolyo config file to point at the new database (don't forget to change the dbType!).
You're now ready to import the previously exported data. Go to the Portfolyo administration interface and there to the maintenance page. In the import section indicate the file you exported in the previous step, then click "Import from XML". You have now successfully migrated your data.
Portfolyo is configured through the config file pfconfig.cgi located in the directory you installed the CGI scripts. It consists of parameter definitions, usually one per line. The general syntax for parameter definitions is very simple:
parameter = value
If you want a value to span multiple lines, put a "\" (backslash) at the end of continued lines:
parameter = This is a value spanning\
multiple lines.
Lines starting with "#" or ";" are comments ignored by the parser:
# This is a comment describing the purpose of the below parameter. parameter = value
(In case you're wondering: The config file is parsed using the ConfigParser standard Python module. So, no, it's not an actual CGI script. The name and location are chosen like this for simplicity and to prevent the file from being displayed in plain text when viewed in a browser.)
Here's an alphabetically ordered list of all configuration parameters. Parameters not explicitly marked as optional are required to be present in the config file.
In Portfolyo versions prior to 0.2, the configuration parameters used a different naming convention (with underscores, e.g. template_path instead of templatePath). The old names for parameters are still supported for backwards compatibility.
This documentation is a work-in-progress, we told you. This section has yet to be written in a comprehensive form. But here are some rudimentary instructions for the fearless:
"Customizing" Portfolyo basically means customizing it's appearance by creating your own template set or adapting the standard one. For a start, copy all files from the standard directory in the template directory into a new directory called, say, mytemplates, also in the template directory. Then set the config parameter templateSet to the name of the template set you just created, mytemplates.
The web frontend will now use the templates in the mytemplates directory. You can start to change or completetly rewrite these copied templates. If you mess up, you can still switch back to the standard template set by setting the templateSet config parameter back to standard.
The .tmpl files are basically HTML files interspersed with Cheetah commands. Learn about writing Cheetah templates from their excellent User's Guide.
Documentation about the Portfolyo API to generate the dynamic parts of the pages is what's sorely lacking here. But we're confident that you're smart enough to figure out the basics from reading the standard templates, for now.
Please note that the Portfolyo API as used by the templates is not stable and may change without warning. If you're getting unexpected behaviour from your customized templates after an upgrade, compare your templates to the standard ones to figure out the API changes.
Portfolyo bundles Cheetah which is Copyright 2001, The Cheetah Development Team: Tavis Rudd, Mike Orr, Chuck Esterbrook, Ian Bicking.
Permission to use, copy, modify, and distribute this software for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of the authors not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission.
THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
CNRI OPEN SOURCE LICENSE AGREEMENT
IMPORTANT: PLEASE READ THE FOLLOWING AGREEMENT CAREFULLY. BY COPYING, INSTALLING OR OTHERWISE USING QUIXOTE-1.2 SOFTWARE, YOU ARE DEEMED TO HAVE AGREED TO THE TERMS AND CONDITIONS OF THIS LICENSE AGREEMENT.