question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Django 2.0 doesn't have GeoManager

See original GitHub issue

https://docs.djangoproject.com/en/2.0/releases/2.0/

Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/me/.local/share/virtualenvs/develtech-oQr_FNyw/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
    utility.execute()
  File "/Users/me/.local/share/virtualenvs/develtech-oQr_FNyw/lib/python3.6/site-packages/django/core/management/__init__.py", line 347, in execute
    django.setup()
  File "/Users/me/.local/share/virtualenvs/develtech-oQr_FNyw/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/Users/me/.local/share/virtualenvs/develtech-oQr_FNyw/lib/python3.6/site-packages/django/apps/registry.py", line 112, in populate
    app_config.import_models()
  File "/Users/me/.local/share/virtualenvs/develtech-oQr_FNyw/lib/python3.6/site-packages/django/apps/config.py", line 198, in import_models
    self.models_module = import_module(models_module_name)
  File "/Users/me/.local/share/virtualenvs/develtech-oQr_FNyw/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/me/.local/share/virtualenvs/develtech-oQr_FNyw/lib/python3.6/site-packages/cities/models.py", line 58, in <module>
    class Place(models.Model):
  File "/Users/me/.local/share/virtualenvs/develtech-oQr_FNyw/lib/python3.6/site-packages/cities/models.py", line 62, in Place
    objects = models.GeoManager()
AttributeError: module 'django.contrib.gis.db.models' has no attribute 'GeoManager'
Name: django-cities
Version: 0.5.0.5
Summary: Place models and worldwide place data for Django
Home-page: https://github.com/coderholic/django-cities
Author: Ben Dowling
Author-email: ben.m.dowling@gmail.com
License: MIT
Location: /Users/me/.local/share/virtualenvs/develtech-oQr_FNyw/lib/python3.6/site-packages
Requires: swapper, django-model-utils, six, tqdm

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9

github_iconTop GitHub Comments

2reactions
blagcommented, Feb 4, 2018

@muhammadtaqi @Mcnass Both of you please test the master branch and report back here. I’m waiting to cut a release to PyPI until I know that it works.

Also @Mcnass - dude, I can’t fix things in an hour, relax a little bit! 😆

1reaction
Siecjecommented, Apr 23, 2019

I am running python -Wa manage.py check on a Django 1.11 project and this message appears.

But it will work with Django > 2.

if DJANGO_VERSION < 2:
    from django.contrib.gis.db.models import GeoManager
else:
    from django.db.models import Manager as GeoManager
Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot find the GeoManager in module django.contrib.gis.db ...
Tring to use GeoManager but an error pops out saying module 'django.contrib.gis.db.models' has no attribute 'GeoManager' .
Read more >
Django 2.0 release notes
These release notes cover the new features, as well as some backwards incompatible changes you'll want to be aware of when upgrading from...
Read more >
Can you rename the Django GeoManager object instance?
The answer is yes, you can name the GeoManager attribute in your class anyway you want. However, I would not recommend it. Here...
Read more >
Seems like a geodjango bug with multiple databases
It could very well be an issue with GeoManager / GeoQuerySet. You also could ask on the geodjango list to see if anyone...
Read more >
Managers — Django 1.5.12 documentation
It doesn't have to return a QuerySet . For example, this custom Manager offers a method with_counts() , which returns a list of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found