V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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 · 2015-07-25 01:05:17 +08:00 · 2947 次点击
    这是一个创建于 3197 天前的主题,其中的信息可能已经有所发展或是发生改变。
    RT,和同学一起写的一个基于Django的网站,之前是在我们两个人的Mac上开发调试的,同时也在一台美团云的机器上部署代码,最近想把代码部署到阿里云的机器上时,就出现如题所示的问题。

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