librelist archives

« back to archive

Issue with importing and Blueprints

Issue with importing and Blueprints

From:
Willy Cordeiro
Date:
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.
https://docs.google.com/open?id=0B9f6c5BvpZX8UVJ3blNnM0YwTVk

But here is the most relevant code.
This is my __init__.py for my top level app
http://dpaste.com/766182/
and then this is the models.py file within my registration blueprint.
http://dpaste.com/766185/

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
output.

>>> 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>
    import urls
  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