I am trying to use admin.LogEntry objects during a datamigration on Django 1.7
The 'django.contrib.admin'
app is listed on INSTALLED_APPS
.
On the shell, it works:
>>> from django.apps import apps
>>> apps.get_model('admin', 'LogEntry')
django.contrib.admin.models.LogEntry
But during the migration, it fails:
def do_it(apps, schema_editor):
LogEntry = apps.get_model('admin', 'LogEntry')
Fails like this:
django-admin migrate
(...)
LookupError: No installed app with label 'admin'.
Using a debugger, I got that the 'admin' is not installed:
ipdb> apps.get_apps()
[]
ipdb> apps.all_models.keys()
['website', 'google', 'allauth', 'twitter', 'busca', 'conteudo', 'django_mobile', 'django_filters', 'videocenter', 'tinymce', 'oferta', 'programacaotv', 'contenttypes', 'suit', 'haystack', 'destaque', 'filer', 'galeria', 'auth', 'facebook', 'paintstore', 'critica', 'disqus', 'fichas', 'omeletop', 'autocomplete_light', 'modelsv1', 'temas', 'django_extensions', 'adv_cache_tag', 'taggit', 'social', 'personalidade']
WHY??
For me it shows
and I solve it by pip installing every requirements manually I m using ubuntu 16.04
I also had this same error of "no installed app label 'admin' ". I was able to solve it by running the pip install sqlparse command
I got the error when I used 'required=False' in my model like this: slug = models.SlugField(required=False)
I changed it to: slug = models.SlugField(blank=True,null=True) and the error disappeared
I don't know the exact cause for this. Will have to dig into the source code. but for now a workaround is add
('admin', 'name_of_last_migration_in_admin_app')
to the dependencies and the migrations shall go alright.I got the same error (but unrelated to the issue mentioned in question). I was using mysql db but there were no mysql client.
settings.py
I installed mysqlclient (In ubuntu & Python3):
The Django doc makes it clear:
Code example: