I've had to deal with the same issues. I can't say my solutions are ideal
or the final word, but here's what I did:
* I put non-servlet Python classes in a subdir called Middle/.
* I put Python dictionary files and comma separated value (CSV) files that
control the site in Configs/. I added to my SitePage a method called
config(self, filename). You give it something like config('NavLinks') and
it finds the file in Configs and loads it as a Python dict or a CSV (via
MiscUtils DataTable class). It caches the file. I haven't gotten around to
checking the timestamp yet, but that would be a pretty easy enhancement.
* I put HTML fragments in a Frags/ directory and made a supporting
SitePage.frag() method that also caches them.
* I taught my users how to modify the stylesheet, dictionaries, CVSs and
frag files so they could make many site changes without knowing Python.
* I did in fact use subdirectories for my servlets.
* To fix all the path situations, I created an __init__.py to beef up sys.path:
# begin __init__.py
def addPath(path):
path = os.path.normpath(path)
if path not in sys.path:
sys.path.append(path)
path = __path__[0]
addPath(path)
addPath(os.path.join(path, 'Middle'))
addPath('..')
# end __init__.py
Disclaimer: I made up that addPath('..'). I didn't need it for my site
(yet) and haven't tested it.
Questions, comments and thoughts are welcome.
-Chuck
At 03:26 PM 9/20/00 -0400, Geoff Talvola wrote:
>Does anyone have any recommendations on how to structure my files and
>directories within a WebKit application?
>
>Where should I put supporting Python files that are used by and related
>to the servlets in my application, but do not actually contain servlets
>themselves? Right now I'm just sticking them in the same directory as
>the servlets.
>
>What about a bunch of servlets that are related somehow. I'd like to
>create a subdirectory for them, but then they can't import the
>supporting modules from the parent directory.
>
>--
>
>
>- Geoff Talvola
> Parlance Corporation
> gtalvola@...
>
>_______________________________________________
>Webware-discuss mailing list
>Webware-discuss@...
>http://lists.sourceforge.net/mailman/listinfo/webware-discuss
|