推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
armstrong
V2EX  ›  Python

到新机器上部署 Django 项目时遇到 Error: cannot import name autodiscover_modules 问题

  •  
  •   armstrong · Jul 25, 2015 · 3923 views
    This topic created in 4022 days ago, the information mentioned may be changed or developed.
    RT,和同学一起写的一个基于Django的网站,之前是在我们两个人的Mac上开发调试的,同时也在一台美团云的机器上部署代码,最近想把代码部署到阿里云的机器上时,就出现如题所示的问题。

    我们俩写的过程中,用到了一些第三方的库,都是随用随 pip install,有些指定了版本号,有些就是pip默认的版本号,现在代码部署的时候,把之前依赖的第三方库都pip install了,但是始终跑不起来。个人觉得可能是一些第三方库的依赖问题,但是目前也看不到更详细的错误栈信息,也不好定位问题。求各位Python大神指点,感激不尽
    5 replies    2015-07-27 13:32:21 +08:00
    paloalto
        1
    paloalto  
       Jul 25, 2015
    确定不是权限问题吗?
    chengzhoukun
        2
    chengzhoukun  
       Jul 25, 2015 via Android   ❤️ 1
    试试在开发环境上用pip freeze 到requirements.txt 然后 在部署的环境上pip install -r requirements.txt(如果确实是版本依赖问题的话)
    VicYu
        3
    VicYu  
       Jul 25, 2015
    发完整的stack trace看看
    ericls
        4
    ericls  
       Jul 25, 2015
    我猜是 Django 版本不一致 而且一个在1.7之前
    armstrong
        5
    armstrong  
    OP
       Jul 27, 2015
    谢谢楼上各位,问题解决了,确实是版本依赖问题,有个组件最近升级了,我用pip install安装时没有显式指定,直接装了一个新的版本,出问题了。
    采用@chengzhoukun所说的pip freeze > requirements.txt 能看到之前在本地机器上安装时的版本,然后部署的时候就方便了,谢谢各位!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   953 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 19:49 · PVG 03:49 · LAX 12:49 · JFK 15:49
    ♥ Do have faith in what you're doing.