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?
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 -r askbot/setup_templates/* .
This will copy all the necessary files (except that upfiles directory does not belong here - you can remove it).
After that you can follow the rest of the install doc (from python manage.py syncdb and on)
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.
Create your Q&A site at askbot.com. Managed Askbot hosting at just $15/mo. Dedicated hosting, support contracts, consulting services.
create your Q&A siteAsked: 2010-08-17 11:32:53 -0500
Seen: 119 times
Last updated: Aug 17 '10
How do we include "external" templates in our custom skin?
how much can Askbot be customized, the code changed
Creating a Table in Askbot Database
Best way to customize the MathJax settings in Askbot
Modifying jinja2 extra filters
Is it possible to evaluate the karma one receives at the site on a monthly basis?
How can I change the Fonts and the Background?
How to completely disable the question: "Know someone who can answer? Share a link to this ..."
Copyright Askbot, 2010-2011. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.