推荐学习书目
› 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
stackpop
V2EX  ›  Python

stackoverflow上没人回答,请教V2EXer~~~关于django的包管理

  •  
  •   stackpop ·
    sjtubinlong · Sep 11, 2012 · 4296 views
    This topic created in 5126 days ago, the information mentioned may be changed or developed.
    I generate a django project and its directory structure is like the following:

    -myproject

    --__init__.py

    --settings.py

    --rooturls.py

    --dbUtils.py

    --app1

    ---__init__.py

    ---views.py

    ---urls.py

    --app2

    ---__init__.py

    ---views.py

    ---urls.py
    I want to import dbUtils in my apps , so I configure in my settings.py:

    PROJECT_ROOT = os.path.dirname(__file__)
    sys.path.insert(0, PROJECT_ROOT)
    However, the program still can't find the moudle.
    2 replies  •  1970-01-01 08:00:00 +08:00
    bigeagle
        1
    bigeagle  
       Sep 11, 2012
    PROJECT_ROOT = os.path.dirname( os.path.abspath(__file__) )
    ccp0101
        2
    ccp0101  
       Sep 12, 2012
    我的Django项目写的是

    SITE_ROOT = os.path.dirname(os.path.realpath(__file__))
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2587 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 01:14 · PVG 09:14 · LAX 18:14 · JFK 21:14
    ♥ Do have faith in what you're doing.