运行“ python manage.py check”时出现错误

时间:2019-05-12 05:26:40

标签: python django anaconda django-1.8

自从开始工作以来,我一直无法在本地运行我的Web应用程序。我已经花了一段时间了,仍然无法获得干净的python manage.py runserverpython manage.py check

我曾经在这里安装Anaconda,这会影响我的路径吗?

这是我遇到的错误。

(venv) BattleStationOnline 10:13:51 aggrigator$~python manage.py runserver
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/anaconda2/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
    utility.execute()
  File "/anaconda2/lib/python2.7/site-packages/django/core/management/__init__.py", line 312, in execute
    django.setup()
  File "/anaconda2/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/anaconda2/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate
    app_config.import_models(all_models)
  File "/anaconda2/lib/python2.7/site-packages/django/apps/config.py", line 198, in import_models
    self.models_module = import_module(models_module_name)
  File "/anaconda2/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/Users/andynguyen/Desktop/aggrigator/aggrigator/accounts/models.py", line 21, in <module>
    from simple_history.models import HistoricalRecords
  File "/anaconda2/lib/python2.7/site-packages/simple_history/models.py", line 18, in <module>
    from django.urls import reverse
ImportError: No module named urls

编辑:我正在运行Django 1.8,并且我的Web应用程序可以在ubuntu服务器上正常运行。

1 个答案:

答案 0 :(得分:1)

Django:1.8 doc for reverse()

使用

from django.core.urlresolvers import reverse

其他信息

  

django.core.urlresolvers.reverse
  从版本1.10开始不推荐使用:   在旧版本中,这些函数位于django.core.urlresolvers中。从旧位置导入将继续进行,直到Django 2.0。