distribute and reference static content in a python package
forgetta at gmail.com
Thu Feb 2 14:09:26 EST 2012
I assume this is an appropriate solution to my problem:
On Thu, 2012-02-02 at 13:42 -0500, Vince Forgetta wrote:
> I have developed a python program that contains multiple python modules
> and static content in the form of fonts (pil,pbm and tff files), html,
> I want to share the program with others as a python package. I have
> followed the instructions at
> I have created an identical structure (apart from directory naming) as
> specified in the link, with the exception of a "static" directory within
> the module directory (towelstuff in the example). Within this directory
> are sub-directories named "css", "html", "images", "fonts" and "js".
> When the user install the program using "python setup.py install", the
> modules (in towelstuff) are copied to the common python library path
> (e.g. /usr/lib/python2.7/site-packages/), but the static content is not
> What is common method to distribute static content, and how to I make
> reference to it in my python program?
> For programs in TowelStuff/bin (i.e. run.py), I currently make reference
> to the static content like so:
> sys.path + "../towelstuff/static/images/someimage.png"
> I am sure there is a more pythonic way of doing this ...
> Thanks in advance for the help.
More information about the Python-list