尝试做python manage.py runserver时出错

时间:2016-07-18 18:58:54

标签: python django postgresql geos

尝试执行manage.py runserver时出现错误。 GEOS已经安装好了。创建数据库(我使用PostgreSQL),成功安装了所有需求包。当我运行python manage.py runserver时,我会收到此消息。

(virualenv) C:\Users\Alexander\Desktop\myproject>python manage.py runserver
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Users\Alexander\Desktop\myproject\virualenv\lib\site-packages\django\core\management\__init__.py", line 338, in execute_from_command_line
    utility.execute()
  File "C:\Users\Alexander\Desktop\myproject\virualenv\lib\site-packages\django\core\management\__init__.py", line 312, in execute
    django.setup()
  File "C:\Users\Alexander\Desktop\myproject\virualenv\lib\site-packages\django\__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "C:\Users\Alexander\Desktop\myproject\virualenv\lib\site-packages\django\apps\registry.py", line 108, in populate
    app_config.import_models(all_models)
  File "C:\Users\Alexander\Desktop\myproject\virualenv\lib\site-packages\django\apps\config.py", line 198, in import_models
    self.models_module = import_module(models_module_name)
  File "C:\Python27\Lib\importlib\__init__.py", line 37, in import_module
    __import__(name)
  File "C:\Users\Alexander\Desktop\myproject\virualenv\lib\site-packages\django\contrib\auth\models.py", line 41, in <module>
    class Permission(models.Model):
  File "C:\Users\Alexander\Desktop\myproject\virualenv\lib\site-packages\django\db\models\base.py", line 139, in __new__
    new_class.add_to_class('_meta', Options(meta, **kwargs))
  File "C:\Users\Alexander\Desktop\myproject\virualenv\lib\site-packages\django\db\models\base.py", line 324, in add_to_class
    value.contribute_to_class(cls, name)
  File "C:\Users\Alexander\Desktop\myproject\virualenv\lib\site-packages\django\db\models\options.py", line 250, in contribute_to_class
    self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
  File "C:\Users\Alexander\Desktop\myproject\virualenv\lib\site-packages\django\db\__init__.py", line 36, in __getattr__
    return getattr(connections[DEFAULT_DB_ALIAS], item)
  File "C:\Users\Alexander\Desktop\myproject\virualenv\lib\site-packages\django\db\utils.py", line 240, in __getitem__
    backend = load_backend(db['ENGINE'])
  File "C:\Users\Alexander\Desktop\myproject\virualenv\lib\site-packages\django\db\utils.py", line 111, in load_backend
    return import_module('%s.base' % backend_name)
  File "C:\Python27\Lib\importlib\__init__.py", line 37, in import_module
    __import__(name)
  File "C:\Users\Alexander\Desktop\myproject\virualenv\lib\site-packages\django\contrib\gis\db\backends\postgis\base.py", line 8, in <module>
    from .features import DatabaseFeatures
  File "C:\Users\Alexander\Desktop\myproject\virualenv\lib\site-packages\django\contrib\gis\db\backends\postgis\features.py", line 1, in <module>
    from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures
  File "C:\Users\Alexander\Desktop\myproject\virualenv\lib\site-packages\django\contrib\gis\db\backends\base\features.py", line 3, in <module>
    from django.contrib.gis.db.models import aggregates
  File "C:\Users\Alexander\Desktop\myproject\virualenv\lib\site-packages\django\contrib\gis\db\models\__init__.py", line 12, in <module>
    "See also https://docs.djangoproject.com/en/%s/ref/contrib/gis/install/geolibs/" % get_docs_version())
django.core.exceptions.ImproperlyConfigured: GEOS is required and has not been detected. Are you sure it is installed? See also https://docs.djangoproject.com/en/1.8/ref/contrib/gis/install/geolibs/

任何想法如何解决?

UPD:pip freeze的结果:

 (virualenv) C:\Users\Alexander\Desktop\myproject>pip freeze
    amqp==1.4.9
    anyjson==0.3.3
    beautifulsoup4==4.1.3
    billiard==3.3.0.23
    bleach==1.4.1
    boto==2.0
    celery==3.1.23
    chardet==2.3.0
    Django==1.8.2
    django-ajax-selects==1.3.6
    django-appconf==1.0.2
    django-celery==3.1.17
    django-celery-email==1.1.4
    django-contrib-comments==1.6.1
    django-datatable-view==0.8.3
    django-debug-toolbar==1.3.0
    django-extensions==1.5.5
    django-filter==0.10.0
    django-formtools==1.0
    django-grappelli==2.6.5
    django-haystack==2.4.0
    django-liststyle==0.2a0
    django-multiselectfield==0.1.3
    django-nocaptcha-recaptcha==0.0.18
    django-postman==3.2.2
    django-registration-redux==1.2
    django-schedule==0.5b0
    django-static-jquery==2.1.4
    django-tagging==0.4
    djangorestframework==3.1.2
    docopt==0.4.0
    ecdsa==0.13
    elasticsearch==1.7.0
    Fabric==1.10.1
    filebrowser-safe==0.3.8
    future==0.9.0
    geopy==1.10.0
    grappelli-safe==0.3.13
    html5lib==0.99999
    ipython==3.1.0
    jsonfield==1.0.3
    kombu==3.0.35
    mailchimp==2.0.9
    Mezzanine==4.1.0
    mutagen==1.29
    oauthlib==0.7.2
    opbeat==3.0.2
    paramiko==1.15.2
    Pillow==2.8.1
    psycopg2==2.6
    pyactiveresource==2.1.1
    pycrypto==2.6.1
    pygeocoder==1.1.4
    pysolr==3.3.2
    python-dateutil==2.4.2
    python-ptrace==0.8.1
    pytz==2015.4
    PyYAML==3.11
    requests==2.7.0
    requests-oauthlib==0.5.0
    ShopifyAPI==2.1.3
    six==1.9.0
    sqlparse==0.1.15
    tzlocal==1.0
    urllib3==1.16
    vobject==0.6.6
    Werkzeug==0.10.4

0 个答案:

没有答案