I cannot get PyCharm to recognize buildout eggs without using djangorecipe

I have 2 Django projects that use buildout. One uses djangorecipe and the other does not. djangorecipe generates a file called bin/django that you need to point the PyCharm settings to. bin/manage looks like:

import sys

sys.path[0:0] = [

    '/Users/haitran/.buildout/eggs/Django-1.4-py2.6.egg',

    '/Users/haitran/.buildout/eggs/django_grappelli-2.4.0-py2.6.egg',

    '/Users/haitran/.buildout/eggs/South-0.7.3-py2.6.egg',

    '/Users/haitran/.buildout/eggs/django_tastypie-0.9.11-py2.6.egg',

    ...

    ]



import djangorecipe.manage


if __name__ == '__main__':

    djangorecipe.manage.main('project.settings')

In my second Django project, I use z3c.recipe.scripts instead of djangorecipe. The relevant part of buildout.cfg looks like:

[django]

recipe = z3c.recipe.scripts

eggs =

    Django

    South

    ...

I use a setuptools entry point script called bin/manage_development instead of the normal Django manage.py file. bin/manage_development looks like:

import sys

sys.path[0:0] = [

    '/Users/haitran/Desktop/src/project/parts/django',

    ]



import os

path = sys.path[0]

if os.environ.get('PYTHONPATH'):

    path = os.pathsep.join([path, os.environ['PYTHONPATH']])

os.environ['PYTHONPATH'] = path

import site # imports custom buildout-generated site.py


import project.manage


if __name__ == '__main__':

    project.manage.development()

This is the script that I pointed PyCharm's "Use paths from script" in the "Buildout Support" pane to. I suppose PyCharm is not running bin/manage_development and therefore does not run import site and therefore does not find the buildout eggs.

How do I tell PyCharm where the buildout eggs are without using djangorecipe?

Please sign in to leave a comment.