Getting back on topic, I'd like to know what is a recommended way of
structuring a python app that uses elixir.
My app is really a python package, that would be import'ed from an
external script. It will implement various functionality splitted in
sub packages, and that looks good to me, but I need to pass around
something to reach the data from every sub-package.
Currently I'm passing around the model, since sub-packages won't have
the first directory level in their "path". The whole thing looks like
this:
/__init__.py
========================================================
import elixir, model
def init(db):
elixir.metadata.bind(db)
elixir.setup_all()
elixir.create_all()
import this, that, anotherone
for foo in (this, that, anotherone):
foo.setup(model)
/model/__init__.py
# here are my elixir classes
/this/__init__.py
def setup(my_model):
global model
model = my_model
/that/__init__.py # repeat...
/anotherone/__init__.py # repeat...
inserting the model in the module's global namespace seems to work but
I'm not 100% sure it is the best solution.
How would you guys manage an app / package and pass around elixir
stuff?
--
You received this message because you are subscribed to the Google Groups
"SQLElixir" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlelixir?hl=en.