1

Question about creating a custom skin

Im trying to figure out how to create a custom skin, and the official method for creating a custom skin as described here and here seems a bit backward to me. easy_install installs askbot under /usr/lib/python.. for me, and creating a new directory there under skins for customizing my webapp that lives somewhere else is not really an option since that is a directory writeable only by root, and is not under version control.

It would make much more sense to put your customizations under the main app directory created by startforum, but there doesn't seem to be any way to do this, or am i missing something? The only way i could think of to accomplish this was add a directory to TEMPLATE_DIRS in settings.py, eg /home/me/askbotproject/templates, and then copy the files i want to customize there, eg. base.html. That way django seems to read them first before going to the default skin.

Is this a really bad way of accomplishing this? Is there a better way? Did i miss something?

akiro's avatar
13
akiro
asked 2010-08-17 11:32:53 -0600
edit flag offensive 0 remove flag close merge delete

Comments

Hi, the first answer goes in detail on how to install on shared host and second on the maintenance of custom skins. Sorry maybe you don't need all that info, but other people may benefit. Cheers.
Evgeny's avatar Evgeny (2010-08-17 12:29:12 -0600) edit
also you can try python setup.py develop after git checkout or untarring the pypi distribution
Evgeny's avatar Evgeny (2010-08-17 13:31:30 -0600) edit
add a comment see more comments

2 Answers

0

Hi Akiro, no you are not missing anything.

If the askbot app is installed in the site-packages or dist-packages of your sitewide python system, then you don't have (yet) a good option to tweak skins.

To edit skins the app is best installed into the project directory. Then you can either follow the directions that you have pointed out or try another method that I will describe below in a minute.

I'll also try to come up with a better method :) and update this post once I do.

Sorry about the long explanation (and most of this can be automated later), but I want to be as detailed as possible.

1) you've mentioned that you are on a shared host.

Since you do not have access to /usr/lib tree where python packages live usually you will need to use --prefix option to easy_install

Let's say you want to install under /home/akiro/python-stuff then you'll run:

easy_install --prefix=/home/akiro/python-stuff askbot

If you run this and directory /home/akiro/python-stuff/lib/python2.6/site-packages or /home/akiro/python-stuff/lib/python2.6/dist-packages (likely on ubuntu, also 2.6 is version of python - it should be the same as the actual version of the python interpreter you use 2.6 is recommended) - you'll get a complaint and easy_install will bail.

Actually, run that command once anyway and see which directory easy_install actually wants, then create it:

mkdir -p /the/missing/long/path

all of that will be created at once.

next: this directory myst be on PYTHONPATH

see what your PYTHONPATH is (most likely - empty) and correct

on bash shell (example):

PYTHONPATH=$PYTHONPATH:/home/akiro/python-stuff/lib/python2.6/site-packages
export PYTHONPATH

or if empty, you can just type:

PYTHONPATH=$PYTHONPATH:/home/akiro/python-stuff/lib/python2.6/site-packages
export PYTHONPATH

Then run the easy_install command as shown above.

2) Now you'll have two options to deploy:

(a) - use startforum - but then you are out of luck editing the skins easily, b/c they won't be in your local directory. To run startforum it must either be in your system path or you need to type full path to the script:

~/python-stuff/bin/startforum

(b) - deploy askbot from github

git clone git://github.com/ASKBOT/askbot-devel.git myproject
#that will create directory "myproject" with askbot installed locally (without dependencies)

If you first run easy_install and then git clone - you'll have dependencies stashed in some other directory and askbot app in both places - you may want to remove askbot from dependency directory.

do:

ls /home/akiro/python-stuff/lib/python2.6/site-packages

It may be something like:

~/python-stuff/lib/python2.6/site-packages

askbot-0.6.8-py2.6.egg

See where askbot is and remove that whole directory. Also delete the line with askbot record from any .pth files within /home/akiro/python-stuff/lib/python2.6/site-packages. This way you will have uninstalled sitewide instance.

(c) actual deployment of the "git clone".

cd myproject
cp ...
(more)
Evgeny's avatar
13.2k
Evgeny
updated 2010-08-17 12:20:51 -0600, answered 2010-08-17 11:51:21 -0600
edit flag offensive 0 remove flag delete link

Comments

Thanks for a very thorough answer, all i need to get started :-)
akiro's avatar akiro (2010-08-17 23:46:20 -0600) edit
add a comment see more comments
0

I'll give a second answer - suppose you have successfully deployed from github - how to edit skins now?

One method is to have a separate skin directory and change the skin setting in the /settings url (as in the document that you've mentioned).

This way the files that you've copied are "yours" completely, which actually brings the following problem: if any of the template tags/variables change - you'll have to replicate those changes in your custom skin. This may not be a lot of fun. Also I plan to rewrite skins in Jinja2 some time down the road for extra speed - so default skin is an area of future changes.

An alternative (but it requires use and some understanding of the git system) is that you just edit anything in askbot/skins/default tree, commit that stuff into your repository, then merge in any updates. This way it will be possible to "upgrade" your custom skin in the future.

Evgeny's avatar
13.2k
Evgeny
updated 2010-08-17 12:32:22 -0600, answered 2010-08-17 12:21:37 -0600
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments