So, I finally gave in and grabbed South. The problem is, every time I try to follow the tutorial and run
"python manage.py schemamigration myapp --initial"
I get an error
"There is no enabled application matching 'myapp'"
--Things I have tried--
I have tripple checked my settings file, running Import South from the django shell returns no errors, and I have added manage.py containing folder to PYTHONPATH, as well as wsgi.py and settings.py.
I have run python manage.py and python C:\path\to\manage.py variants, even went into my python directory and verified that south was in the site-packages folder. syncdb runs fine, ending with "not synced (use migrations)". python manage.py migrate runs without returning errors but otherwise seems to have no effect. I have tried running the said command both before and after running syncdb, which has no effect on the outcome.
--Other potentially pertinent info--
Django 1.5.1, Python 2.7, no other external apps used, Windows 7 64 bit, python is added to the windows path, South installed via python setup.py install command. Installation completed successfully. I do not use a virtualenv, and would really prefer to avoid this as it would mean alot of refactoring of this current project's setup and wasted time. I plan to move to a virtualenv setup in the future, but not now.
What's going on? How do I fix this? Net searches revealed no good info at all, I am completely at a loss...
This error can be misleading: it is thrown not when South tries to import the app, but when it tries to get the app's models
module.
INSTALLED_APPS
)models
module, because the file models.py
does not exist, or because the directory models/
does not contain an __init__.py
.South doesn't import the models
module itself. Instead, it leaves that job to django.db.models.get_app('app_of_interest')
, which according to its docstring "Returns the module containing the models for the given app_label." The error message raised by get_app
is, in fact, different depending on whether it failed to import the app or the model, but both exceptions are ImproperlyConfigured
, and the schemamigrations
script doesn't look any deeper than that.
Because South says it is accepting security updates only (it entered end-of-life with Django 1.7's migration feature), I'm not submitting a fix to its codebase, but instead documenting the problem here.
migrations exist on a per-app basis. each app may or may not have its own migrations, but you need to create them for each app where you want to use them. (often all apps)
./manage.py migrate
is a shortcut that runs migrations for all apps
Check once whether you have included the app name in INSTALLED_APPS in settings.py
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With