2

I am trying to install the django autocomplete light examples : django autocomplete docs

with the following step (from the docs above):

virtualenv autocomplete_light_env
source autocomplete_light_env/bin/activate
git clone https://jpic@github.com/yourlabs/django-autocomplete-light.git
cd django-autocomplete-light/test_project
pip install -r requirements.txt
./manage.py runserver (also tried "python manage.py runserver")

But even on a clean environment, I am getting the following error when I try the to run the server (last step):

File "manage.py", line 8, in <module>
    from django.core.management import execute_from_command_line
ImportError: No module named django.core.management

I have tried a bunch of the suggestions from stackoverflow on how to fix this but nothing seems to work.

user3241019
  • 811
  • 9
  • 20
bdelliott
  • 463
  • 1
  • 7
  • 12

4 Answers4

1

I ended up installing django as suggested (I need to use django 1.5 for GAE compatibility):

pip install -e git+https://github.com/django/django.git@1.5b2#egg=django

So I got further, but now it is saying:

ImportError: No module named autocomplete_light.example_apps.non_admin_add_another

I see that the module is referenced in settings.py:

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',

'cities_light',

'autocomplete_light',
'autocomplete_light.example_apps.basic',
'autocomplete_light.example_apps.music',
'autocomplete_light.example_apps.autocomplete_test_case_app',
'autocomplete_light.example_apps.security_test',
'autocomplete_light.example_apps.dependant_autocomplete',
'autocomplete_light.example_apps.non_admin_add_another',

'navigation_autocomplete',
)

But I don't know how to resolve this problem.

UPDATE: Doing the "python setup.py install" as suggested did the trick!

bdelliott
  • 463
  • 1
  • 7
  • 12
  • I had the same problem, try running the python setup.py install on the main directory it solve this problem but nothing work related to city odels when getting access to the admin panel. – Tony Jun 18 '14 at 10:04
1

Just add these lines to autocomplete_light_env/test_project/requirements.txt

django

django-autocomplete-light

and run pip install -r requirements.txt again.

LX.Under.T
  • 56
  • 2
0

Are you running Django on a virtualenv you already created or straight from root?

I usually run everything inside a virtualenv for each website:

    django-admin.py startproject mysite
    cd mysite
    virtualenv env
    source env/bin/activate
    pip install django
    pip install django-autocomplete-light
    pip install ...

This way I can make have just the packages I need for each project.

From your last error, looks like django is not installed on the new autocomplete-light_env

EDIT:

Please read up more on what virtualenv does. From your comments it looks like you are installing python packages outside of the virtualenv, and getting ModuleMissing errors because of that.

Every time that you are working on a project whose folder as a virtualenv, you should activate it and only then install packages. activate it with "source env/bin/activate". Replace env with the folder you installed the virtualenv to. When you're done editing your project run "deactivate"

Bruno Amaral
  • 169
  • 1
  • 12
0

Just do pip install django to install Django in your env.

jpic
  • 32,891
  • 5
  • 112
  • 113