When I try to migrate my db, I'm getting this error:
Running migrations for easy_thumbnails:
- Nothing to migrate.
- Loading initial data for easy_thumbnails.
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 285, in execute
output = self.handle(*args, **options)
File "/Library/Python/2.7/site-packages/south/management/commands/migrate.py", line 111, in handle
ignore_ghosts = ignore_ghosts,
File "/Library/Python/2.7/site-packages/south/migration/__init__.py", line 233, in migrate_app
migrator.load_initial_data(target, db=database)
File "/Library/Python/2.7/site-packages/south/migration/migrators.py", line 222, in load_initial_data
self.post_1_6(target, db)
File "/Library/Python/2.7/site-packages/south/migration/migrators.py", line 240, in post_1_6
old_cache = django.db.models.loading.cache
AttributeError: 'module' object has no attribute 'loading'
Apps versions are:
Django 1.6.2
Easy thumbnails 1.4
Mptt 0.5.5
Pymorphy 0.5.6
Python 2.7.5
Pytils 0.3dev
South 0.8.4
Suit 0.2.5
It's looks like not easy_thumbnails problem, because when I try to migrate my django-allauth it raises the same error.
Please, help me!
It seems like your django package was broken. Check that there is python2.7/site-packages/django/db/models/loading.py file in your environment. Or just reinstall django package.
pip install -U --force-reinstall django
Related
I am trying to install djangoCMS on my Ubuntu 15.04.
First I had a "pillow not compiled with jpeg" issue, but managed to solve it by installing another pip version (pip install Pillow==2.3) before running djangocms -f -p . myproject.
Running migrations:
Rendering model states...Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/user/.virtualenvs/folder/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
utility.execute()
File "/home/user/.virtualenvs/folder/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/user/.virtualenvs/folder/local/lib/python2.7/site-packages/django/core/management/base.py", line 393, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/user/.virtualenvs/folder/local/lib/python2.7/site-packages/django/core/management/base.py", line 444, in execute
output = self.handle(*args, **options)
File "/home/user/.virtualenvs/folder/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 221, in handle
executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
File "/home/user/.virtualenvs/folder/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 104, in migrate
state = migration.mutate_state(state, preserve=do_run)
File "/home/user/.virtualenvs/folder/local/lib/python2.7/site-packages/django/db/migrations/migration.py", line 83, in mutate_state
operation.state_forwards(self.app_label, new_state)
File "/home/user/.virtualenvs/folder/local/lib/python2.7/site-packages/django/db/migrations/operations/models.py", line 53, in state_forwards
list(self.managers),
File "/home/user/.virtualenvs/folder/local/lib/python2.7/site-packages/django/db/migrations/state.py", line 81, in add_model
self.reload_model(app_label, model_name)
File "/home/user/.virtualenvs/folder/local/lib/python2.7/site-packages/django/db/migrations/state.py", line 122, in reload_model
related_models.update(get_related_models_recursive(rel_model))
File "/home/user/.virtualenvs/folder/local/lib/python2.7/site-packages/django/db/migrations/state.py", line 57, in get_related_models_recursive
rel_app_label, rel_model_name = rel_mod._meta.app_label, rel_mod._meta.model_name
AttributeError: 'NoneType' object has no attribute '_meta'
Can anyone explain to me why? And how to solve it?
Thank you!
UPDATE:
I installed django CMS inside the virtualenv like this:
pip install djangocms-installer
pip freeze:
cmsplugin-filer==0.10.1
dj-database-url==0.3.0
Django==1.8.3
django-appconf==1.0.1
django-classy-tags==0.6.2
django-cms==3.1.2
django-filer==0.9.11
django-mptt==0.7.4
django-polymorphic==0.7.1
django-reversion==1.8.5
django-sekizai==0.8.2
Django-Select2==4.3.1
django-treebeard==3.0
djangocms-admin-style==0.2.7
djangocms-column==1.5
djangocms-flash==0.2.0
djangocms-googlemap==0.2
djangocms-inherit==0.1
djangocms-installer==0.7.8
djangocms-link==1.6.2
djangocms-style==1.5
djangocms-text-ckeditor==2.5.2
easy-thumbnails==2.2
html5lib==0.999999
Pillow==2.3.0
pytz==2015.4
six==1.9.0
tzlocal==1.2
Unidecode==0.4.18
wheel==0.24.0
This problem is solved in support/3.1.x branch of django-cms.
You can checkout it or wait the next release : 3.1.3 tag.
I'm using celery in my django app. I have setup celery as usual. But, when i try to migrate, it displays error:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.4/dist-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.4/dist-packages/django/core/management/__init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.4/dist-packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/local/lib/python3.4/dist-packages/django/core/management/base.py", line 338, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python3.4/dist-packages/django/core/management/commands/makemigrations.py", line 111, in handle
convert_apps=app_labels or None,
File "/usr/local/lib/python3.4/dist-packages/django/db/migrations/autodetector.py", line 42, in changes
changes = self._detect_changes(convert_apps, graph)
File "/usr/local/lib/python3.4/dist-packages/django/db/migrations/autodetector.py", line 109, in _detect_changes
self.old_apps = self.from_state.render(ignore_swappable=True)
File "/usr/local/lib/python3.4/dist-packages/django/db/migrations/state.py", line 57, in render
self.apps = Apps([AppConfigStub(label) for label in sorted(self.real_apps + list(app_labels))])
File "/usr/local/lib/python3.4/dist-packages/django/apps/registry.py", line 56, in __init__
self.populate(installed_apps)
File "/usr/local/lib/python3.4/dist-packages/django/apps/registry.py", line 89, in populate
"duplicates: %s" % app_config.label)
django.core.exceptions.ImproperlyConfigured: Application labels aren't unique, duplicates: djcelery
Operations to perform:
Synchronize unmigrated apps: djcelery
Apply all migrations: auth, contenttypes, admin, djcelery, sessions
Synchronizing apps without migrations:
Creating tables...
Installing custom SQL...
Installing indexes...
Running migrations:
Applying djcelery.0001_initial...Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.4/dist-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.4/dist-packages/django/core/management/__init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.4/dist-packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/local/lib/python3.4/dist-packages/django/core/management/base.py", line 338, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python3.4/dist-packages/django/core/management/commands/migrate.py", line 161, in handle
executor.migrate(targets, plan, fake=options.get("fake", False))
File "/usr/local/lib/python3.4/dist-packages/django/db/migrations/executor.py", line 68, in migrate
self.apply_migration(migration, fake=fake)
File "/usr/local/lib/python3.4/dist-packages/django/db/migrations/executor.py", line 96, in apply_migration
if self.detect_soft_applied(migration):
File "/usr/local/lib/python3.4/dist-packages/django/db/migrations/executor.py", line 140, in detect_soft_applied
apps = project_state.render()
File "/usr/local/lib/python3.4/dist-packages/django/db/migrations/state.py", line 57, in render
self.apps = Apps([AppConfigStub(label) for label in sorted(self.real_apps + list(app_labels))])
File "/usr/local/lib/python3.4/dist-packages/django/apps/registry.py", line 56, in __init__
self.populate(installed_apps)
File "/usr/local/lib/python3.4/dist-packages/django/apps/registry.py", line 89, in populate
"duplicates: %s" % app_config.label)
django.core.exceptions.ImproperlyConfigured: Application labels aren't unique, duplicates: djcelery
I'm using django version 1.7.5 and celery version 3.1.17. In the sample code, only djcelery app is added in the app list in settings.py .
I think that I had the same problem. I tried to find duplicate names on installed apps and even modules named djcelery inside other packages. Didn't find anything to help. In my case, the app was running fine in some machines, but was failing in others. I could even make it run, but migrate kept failing.
What solved my problem was to reinstall all my pip packages. Supposing that you have all your packages listed in a file requirements.txt:
pip uninstall -r requirements.txt
and then
pip install -r requirements.txt
I think this problem may be caused by a dead pyc or a bad dependency chain. I also found a problem with mysql for python being installed partially by pip and part by apt-get (running on Ubuntu). You can check this running your command like:
python -m pdb manage.py migrate
The error reported by pdb was related to a bad connection. Without pdb I had the same message as yours.
Tested on Ubuntu with Python 2.7.6, pip 6.1.1, django 1.7, celery 3.1.8, django-celery-3.1.16.
The problem definitely stems from the fact that djcelery appears in both unmigrated and migrated apps. From what I've seen this is usually symptomatic of having both south and django style migrations in the same app. In any case likely something is off with djcelery's migrations directory.
I'm trying to add a translation (localization) layer to my appliaction.
I have tried to follow the instructions from: https://docs.djangoproject.com/en/1.7/topics/i18n/translation/#how-to-create-language-files
But I run in some problems when I tried to run
django-admin.py makemessages -l he
In order to create a translation file for Hebrew.
When I first run this code I got the following error:
CommandError: Can't find msguniq. Make sure you have GNU gettext tools 0.15 or newer installed.
So I run the command:
brew install gettext
But I still got an error:
CommandError: Can't find msguniq. Make sure you have GNU gettext tools 0.15 or newer installed.
So I saw in some places that I need to run:
brew link gettext --force
Now when I try to run the command:
django-admin.py makemessages -l he
I get the following error:
Traceback (most recent call last):
File "/usr/local/bin/django-admin.py", line 5, in <module>
pkg_resources.run_script('Django==1.7.1', 'django-admin.py')
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 492, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 1350, in run_script
execfile(script_filename, namespace, namespace)
File "/Library/Python/2.7/site-packages/Django-1.7.1-py2.7.egg/EGG-INFO/scripts/django-admin.py", line 5, in <module>
management.execute_from_command_line()
File "/Library/Python/2.7/site-packages/Django-1.7.1-py2.7.egg/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/Library/Python/2.7/site-packages/Django-1.7.1-py2.7.egg/django/core/management/__init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Library/Python/2.7/site-packages/Django-1.7.1-py2.7.egg/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Library/Python/2.7/site-packages/Django-1.7.1-py2.7.egg/django/core/management/base.py", line 338, in execute
output = self.handle(*args, **options)
File "/Library/Python/2.7/site-packages/Django-1.7.1-py2.7.egg/django/core/management/base.py", line 533, in handle
return self.handle_noargs(**options)
File "/Library/Python/2.7/site-packages/Django-1.7.1-py2.7.egg/django/core/management/commands/makemessages.py", line 283, in handle_noargs
potfiles = self.build_potfiles()
File "/Library/Python/2.7/site-packages/Django-1.7.1-py2.7.egg/django/core/management/commands/makemessages.py", line 299, in build_potfiles
file_list = self.find_files(".")
File "/Library/Python/2.7/site-packages/Django-1.7.1-py2.7.egg/django/core/management/commands/makemessages.py", line 358, in find_files
ignored_roots = [os.path.normpath(p) for p in (settings.MEDIA_ROOT, settings.STATIC_ROOT)]
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpath.py", line 327, in normpath
initial_slashes = path.startswith('/')
AttributeError: 'NoneType' object has no attribute 'starts with'
I'm using a Mac with Django 1.7 and Python 2.7.6
please help to understand what I'm missing
try for instance python ../manage.py makemessages -l en inside your app
django-admin.py didn't work for me either
You should point django to your project's settings.py file.
export DJANGO_SETTINGS_MODULE=/path/to/settings.py
After I solve the issue with "image not found" when I run python manage.py syncdb by adding "export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/" into .bash_profile.
The problem comes with python manage.py runserver
Does anyone know how to solve OSError(Errno 20)?
System check identified no issues (0 silenced).
October 07, 2014 - 18:19:56
Django version 1.8, using settings 'dbtest.settings'
Starting development server at http:/127.0.0.1:8000/
Quit the server with CONTROL-C.
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Library/Python/2.7/site-packages/Django-1.8-py2.7.egg/django/core/management/__init__.py", line 330, in execute_from_command_line
utility.execute()
File "/Library/Python/2.7/site-packages/Django-1.8-py2.7.egg/django/core/management/__init__.py", line 322, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Library/Python/2.7/site-packages/Django-1.8-py2.7.egg/django/core/management/base.py", line 363, in run_from_argv
self.execute(*args, **cmd_options)
File "/Library/Python/2.7/site-packages/Django-1.8-py2.7.egg/django/core/management/base.py", line 412, in execute
output = self.handle(*args, **options)
File "/Library/Python/2.7/site-packages/Django-1.8-py2.7.egg/django/core/management/commands/runserver.py", line 80, in handle
self.run(**options)
File "/Library/Python/2.7/site-packages/Django-1.8-py2.7.egg/django/core/management/commands/runserver.py", line 89, in run
autoreload.main(self.inner_run, None, options)
File "/Library/Python/2.7/site-packages/Django-1.8-py2.7.egg/django/utils/autoreload.py", line 320, in main
reloader(wrapped_main_func, args, kwargs)
File "/Library/Python/2.7/site-packages/Django-1.8-py2.7.egg/django/utils/autoreload.py", line 286, in python_reloader
reloader_thread()
File "/Library/Python/2.7/site-packages/Django-1.8-py2.7.egg/django/utils/autoreload.py", line 262, in reloader_thread
change = fn()
File "/Library/Python/2.7/site-packages/Django-1.8-py2.7.egg/django/utils/autoreload.py", line 200, in code_changed
stat = os.stat(filename)
OSError: [Errno 20] Not a directory: '/Library/Python/2.7/site-packages/MySQL_python-1.2.3-py2.7-macosx-10.9-intel.egg/MySQLdb/converters.py'
I just realize that I install both mysql-python and mysql-connector-python packages.
By changing the database 'ENGINE' setting from 'django.db.backends.mysql' to 'mysql.connector.django', the issue is solved.
Lesson learned here: I should probably use virtualenv to try different python package.
I´m having a issue when I ran "python manage.py rebuild_index" in my app supported by haystack and elasticsearch.
Python 2.7
Django version 1.6.2
Haystack 2.1.0
Elasticsearch 1.0
Please see the error that is appearing:
Traceback (most recent call last):
File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/usr/lib/python2.7/site-packages/django/core/management/init.py", line 399, in > execute_from_command_line
utility.execute()
File "/usr/lib/python2.7/site-packages/django/core/management/init.py", line 392, in > execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 242, in >run_from_argv
self.execute(*args, **options.dict)
File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
output = self.handle(*args, **options)
File "/usr/lib/python2.7/site-packages/haystack/management/commands/rebuild_index.py", line 15, in handle
call_command('clear_index', **options)
File "/usr/lib/python2.7/site-packages/django/core/management/init.py", line 159, in call_command
return klass.execute(*args, **defaults)
File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
output = self.handle(*args, **options)
File "/usr/lib/python2.7/site-packages/haystack/management/commands/clear_index.py", line 48, in handle
backend = connections[backend_name].get_backend()
File "/usr/lib/python2.7/site-packages/haystack/utils/loading.py", line 98, in getitem
self._connections[key] = load_backend(self.connections_info[key]['ENGINE'])(using=key)
File "/usr/lib/python2.7/site-packages/haystack/utils/loading.py", line 51, in load_backend
return import_class(full_backend_path)
File "/usr/lib/python2.7/site-packages/haystack/utils/loading.py", line 18, in import_class
module_itself = importlib.import_module(module_path)
File "/usr/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
import(name)
File "/usr/lib/python2.7/site-packages/haystack/backends/elasticsearch_backend.py", line 21, in
raise MissingDependency("The 'elasticsearch' backend requires the installation of 'requests'.")
haystack.exceptions.MissingDependency: The 'elasticsearch' backend requires the installation of 'requests'.
I've installed all the packages needed to run those apps however is asking about requests, What is it about?
just do
pip install pyelasticsearch
If you just install requests module through pip this error should go away.