0

I have created a little framework and my directory structure is this

myframework -> contrib -> jinja2
myframework -> contrib -> session
myframework -> start.py

the problem is for package under contrib, infact jinjia2 like session have subdirectory and in the __init__.py of jinja2 there're some imports relative to root position so now to make it working, I must put jinja2 package into root dir, there's a way to make working in

Lennart Regebro
  • 167,292
  • 41
  • 224
  • 251
LXG
  • 1,957
  • 3
  • 22
  • 45
  • 1
    I have some trouble understanding your question. Does jinja2 lie under contrib as well as session or does session lie in a folder contrib inside jinja2? It looks like you never finished your last sentence either, making it a bit hard to see what you want :D – Skurmedel Jan 24 '11 at 09:48
  • ops sorry I have a start.py where I import the jinja2 template, but I I put under a directory (contrib) imports in jinja2 don't work so if I want include jinja2 in session/__init__.py don't work because jinjia2 expect to be in site root dir :) – LXG Jan 24 '11 at 16:51

1 Answers1

3

You are going to have a hard time if you are going to redesign the structure of package where relative imports are already used. Just use the package in the way it was designed to and for multiple packages, just make sure that they are all in PYTHONPATH. relative imports work best under the following directory structure and reference mechanism. Just make sure that your modules are accessing the files in the similar way.

Community
  • 1
  • 1
Senthil Kumaran
  • 54,681
  • 14
  • 94
  • 131