-
Notifications
You must be signed in to change notification settings - Fork 85
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
Can't import models module #63
Comments
first you could take a look at #16 because of your BaseModel. i think the command fails because it can't import your module: |
You can try adding the following lines to the beginning of the migration file: import os
import sys
sys.path.append(os.path.dirname("__file__")) |
Whew, answers coming in 4 years later 😁 Appreciate it, but I've moved on |
They're not just for you 🙂 |
Hi there,
first of all thank you so much for taking the time and publishing this library, appreciate it a lot since peewee doesn't come with automatic migrations included.
I'm trying to use the cli to migrate my model, but
load_models
raises an Exception, saying that it can't import the models module (the one at the --auto path).This is the failing command:
$ pw_migrate create --auto ~/myproject/model/ --database "postgres://zudibytvipthsa:c8c2d7f0blabla" --directory ~/myproject/model/ mymigration
Could it be that peewee_migrate doesn't resolve the database connection URL with
playhouse.db_url.connect
but expects something else instead? This isn't really clear from the help text.My model module is structured as follows:
I would appreciate getting some hints as to what might be causing this :)
The text was updated successfully, but these errors were encountered: