views:

49

answers:

2

Hi!

I have a Django Application. I want to have all my models to be separated in files and lay in the specific directory, for instance:

/usr/project/models/myModel.py

Is it any possible? Just importing through from myModel import * doesn't work, unfortunately.

Is there any specific way to do this?

A: 

You can split your models into separate files, it's just Python code.

Ned Batchelder
yes,but what about the child directories?
ifesdjeen
@opetrov: the standard import statement rules apply. Simply read up on the import statement.
S.Lott
@s.lott from myModel import * does not work since there's no such package named myModel.
ifesdjeen
+1  A: 

Create file /usr/project/models/__init__.py containing from myModel import *. __init__.py file is required to make directory a python package.

Denis Otkidach