Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No module named 'user' #3

Closed
sabernar opened this issue Sep 30, 2014 · 5 comments
Closed

No module named 'user' #3

sabernar opened this issue Sep 30, 2014 · 5 comments

Comments

@sabernar
Copy link

When I try to run createdb, I get the following error:

(venv)/Users/joe/projects/flask-bootstrap (development) $ python manage.py createdb
Traceback (most recent call last):
  File "manage.py", line 5, in <module>
    from app.database import db
  File "/Users/joe/projects/flask-bootstrap/app/__init__.py", line 7, in <module>
    from app.login import login_manager, login_view, logout_view, user_create
  File "/Users/joe/projects/flask-bootstrap/app/login.py", line 5, in <module>
    from app.models.user import User, ROLE_USER, ROLE_ADMIN
  File "/Users/joe/projects/flask-bootstrap/app/models/__init__.py", line 1, in <module>
    from user import User
ImportError: No module named 'user'

I followed the instructions step by step and I can't seem to get past this point.

@esbullington
Copy link
Owner

Is the app/models/user.py file there? It's a strange error if the file is there. What Python version are you using?

Also, there is no python manage.py createdb in the instructions. My Makefile uses that manage.py command internally to create a db, but only after setting up the dependencies and config file. So if you're on Ubuntu (and possibly Debian), you should run make install. If you're on other OSs, you need to duplicate the tasks done by the Makefile on your OS before you run python manage.py createdb.

But first check to be sure that the user.py file is indeed in the app/models directory.

Also, what OS?

@sabernar
Copy link
Author

sabernar commented Oct 1, 2014

I'm on a Mac (Yosemite).

Yes, that file is there:

(venv)/Users/joe/projects/flask-bootstrap (development) $ la app/models/
total 16
-rw-r--r--   1 joe  staff  1214 Sep 30 10:03 user.py
-rw-r--r--   1 joe  staff    22 Sep 30 10:03 __init__.py
drwxr-xr-x   3 joe  staff   102 Sep 30 10:38 __pycache__
drwxr-xr-x  10 joe  staff   340 Sep 30 10:38 ..
drwxr-xr-x   5 joe  staff   170 Sep 30 10:38 .

@esbullington
Copy link
Owner

You didn't mention your Python version in response to my question, but it looks like you're running Python 3. The reason I asked is that Python 3 handles relative paths differently from Python 2 and could result in your problem.

Anyway, Python 3 isn't yet supported, although I hope to have something out soon. Given that so many Python projects are supporting Python 3, I should probably mention explicitly that I don't support it. I'll put something up on the README.

@esbullington
Copy link
Owner

So, I made the few changes needed to support Python 3, and I didn't actually run into the issue you've run into. Now, you wouldn't have been able to run it without the changes I just made, but that's not the cause of your problem.

Did you set up postgresql, and postgres-dev package (not sure what the equivalent is on OSX or how you install it)? I see it's on Macports using sudo port install py27-psycopg2 You'd also need to have the Python and Postgresql development packages installed (no idea how to do that on OSX, since I don't have one).

Anyway, if you do muddle through and get this installed on OSX, I'd be grateful if you'd make a brief addition to the README that lists the necessary dependencies and where to get them, and submit a pull request. That way, the next person on OSX wanting to use this app template won't have to wonder. I'd do it myself but I don't own or have access to a Mac.

@esbullington
Copy link
Owner

I think your issue likely stems from not having your database properly configured. But since I haven't gotten a response to my last two comments, I'm closing this issue for now.

However, if you're interested in trying to resolve the issue, please feel free to let me know if you'd like me to re-open this issue, or else open another one that references this it: #3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants