I have a relatively large flat application that I\'m working on. To maintain separation of concerns, I\'ve split the model and view files into auth_models
, d
If your auth_models.py
contains a model class MyUserModel
, you need to put the following in the __init__.py
under app/models
:
try:
from .auth_models import MyUserModel
except ImportError as e:
sys.stderr.write("Error: failed to import models module ({})".format(e))
P.S. Another suggestion would be to improve the style you name your files with. Since auth_models.py
, dashboard_models.py
and taxonomy_models.py
are all under app/models
you can simply truncate the _models.py
ending. I.e. rename your files under /models
:
auth_models.py -> auth.py
dashboard_models.py -> dashboard.py
taxonomy_models.py -> taxonomy.py
To import the Model classes as instructed above:
from .auth import MyUserModel