简体   繁体   中英

buildout configuration issue for my django project,not get specified version of django

I installed zc.buildout using easy_install . I used the tutorial at http://jacobian.org/writing/django-apps-with-buildout/ .

My problem is, am not able to install the versions specified in the buildout.cfg:

[buildout]
parts = python 
        django
develop = .
versions = versions

eggs = nltk
       html5lib
       pysolr
       python-openid
       django-shorturls

[versions]
django = 1.4.1

[python]
recipe = zc.recipe.egg
interpreter = python
eggs = ${buildout:eggs}

[django]
recipe = djangorecipe

When I try ./bin/python

>>> import pysolr
>>> pysolr           #  it worked from my buildout 
<module 'pysolr' from '/home/builout-tests/sandbox/eggs/pysolr-3.0.4-py2.7.egg/pysolr.pyc'>
>>> import django
>>> django.VERSION
(1, 3, 1, 'final', 0)  # its my django version in system's python dist-packages
>>> django
<module 'django' from '/usr/lib/python2.7/dist-packages/django/__init__.pyc'>

And also how can I keep different versions of python, django, pylsolr, nltk, etc. for development and production versions?

尝试在[版本]部分中用Django(带大写D)替换django

The eggs you specify in your [buildout] part don't really do anything. It is common practice to put eggs there that you need in a couple of parts, like [python] and [django] in your case.

So... fix number one is to add eggs = ${buildout:eggs} to your [django] part, as that's probably what you intend.

Regarding the django/Django upper/lowercase version: there are two solutions for it. If you use a pre-2.0 buildout version, add extension = buildout-versions to your [buildout] part. It prints versions it picked and it removes the case sensitiveness.

Best option, though, is to use the latest 2.0 buildout. You probably have to download a fresh bootstrap.py from http://downloads.buildout.org/2/bootstrap.py and re-run bootstrap and bin/buildout . This also removes case insensitiveness. For more clarity, add show-picked-versions = true to your [buildout] part to get a nice listing of picked versions. Way easier to spot weirdness and unexpected behaviour that way :-)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM