Issue with importing and Blueprints
- Willy Cordeiro
- 2012-07-02 @ 00:17
I'm trying to import my database object in one of my Blueprints but I'm
having trouble getting this to work.
Here's my code.
But here is the most relevant code.
This is my __init__.py for my top level app
and then this is the models.py file within my registration blueprint.
I'm not quite sure what's wrong with the code. Sublime Text 2 is able to
follow the import statement and code complete.
But when I try to enter my interactive shell and import a Model this is the
>>> from skyroket.registration import User
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "skyroket\__init__.py", line 10, in <module>
from skyroket.registration import auth as auth_blueprint
File "skyroket\registration\__init__.py", line 6, in <module>
File "skyroket\registration\urls.py", line 2, in <module>
from . import views
File "skyroket\registration\views.py", line 3, in <module>
from .models import User
File "skyroket\registration\models.py", line 1, in <module>
from skyroket import db
ImportError: cannot import name db
How should I correct this?
-Wellington "Willy" Cordeiro