第一次用pycharm建django项目试运行就出现报错

来源:2-3 pycharm和navicat的简单使用

田丰丰丰丰丰丰丰

2019-03-08

"C:\Program Files\JetBrains\PyCharm 2018.3.1\bin\runnerw64.exe" C:\Users\hello\Envs\testvir2\Scripts\python.exe C:/Users/hello/PycharmProjects/djangostart/manage.py runserver 8000
Unhandled exception in thread started by <function wrapper at 0x0000000004107B38>
Traceback (most recent call last):
  File "C:\Users\hello\Envs\testvir2\lib\site-packages\django\utils\autoreload.py", line 226, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\hello\Envs\testvir2\lib\site-packages\django\core\management\commands\runserver.py", line 109, in inner_run
    autoreload.raise_last_exception()
  File "C:\Users\hello\Envs\testvir2\lib\site-packages\django\utils\autoreload.py", line 249, in raise_last_exception
    six.reraise(*_exception)
  File "C:\Users\hello\Envs\testvir2\lib\site-packages\django\utils\autoreload.py", line 226, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\hello\Envs\testvir2\lib\site-packages\django\__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "C:\Users\hello\Envs\testvir2\lib\site-packages\django\apps\registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "C:\Users\hello\Envs\testvir2\lib\site-packages\django\apps\config.py", line 116, in create
    mod = import_module(mod_path)
  File "c:\python27\Lib\importlib\__init__.py", line 37, in import_module
    __import__(name)
  File "C:\Users\hello\Envs\testvir2\lib\site-packages\django\contrib\contenttypes\apps.py", line 7, in <module>
    from .management import update_contenttypes
ImportError: cannot import name update_contenttypes
写回答

2回答

Ethreal

2019-03-10

你是不是用同一个环境跑了多个项目,而且这个contenttype 对model的追踪依赖 建议重新开一个虚拟环境安装django 然后pycharm直接选择环境运行

0
0

bobby

2019-03-10

你的django的版本是多少呢?

0
0

Python3.6+django+xadmin,打造在线教育平台

【毕设】Python 2.7到3.6 完美适配,Django升级2.0

3677 学习 · 4038 问题

查看课程