Project source code layout?
Lawrence D'Oliveiro
ldo at geek-central.gen.new_zealand
Thu Jun 4 18:26:34 EDT 2009
In message <mailman.1112.1244128369.8015.python-list at python.org>, Allen
Fowler wrote:
> 1) Do you use virtualpython?
No idea what that is.
> 2) How do you load the modules in your lib directory?
At the beginning of my scripts, I have a sequence like
test_mode = False # True for testing, False for production
if test_mode :
home_dir = "/home/shop-test"
else :
home_dir = "/home/shop"
#end if
sys.path.append(home_dir + "/lib")
import common
[etc]
I have an installation script that looks for that "test_mode = True/False"
assignment and edits it accordingly. That flag is used to select the top-
level directory (as above) as well as the database name, etc. This allows me
to run two complete parallel sets of code and data, so I can mess around
with the testing version without impacting the production system.
> 3) How do you reference your configuration directives from within your
> modules and CGI/daemon scripts?
For my last project using the above system, I used XML as the config file
format.
More information about the Python-list
mailing list