V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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 · 4020 views
    This topic created in 4988 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   ·   Solana   ·   5835 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 551ms · UTC 06:25 · PVG 14:25 · LAX 23:25 · JFK 02:25
    ♥ Do have faith in what you're doing.