2010-12-05 3 views
2

J'ai les dernières versions de virtualenv, django-nonrel, djangotoolbox et django_mongodb_engine. Le virtualenv a été créé avec -no-site-packages.windows virtualenv utilisant des paquets globaux

J'ai essayé de suivre la quick start mais je vois les erreurs suivantes lorsque vous essayez de lancer syncdb

Traceback (most recent call last): 
    File "C:\www\environments\mongotest\djangomongo\manage.py", line 11, in < 
module> 
    execute_manager(settings) 
    File "C:\Python25\lib\site-packages\django-1.2.3-py2.5.egg\django\core\managem 
ent\__init__.py", line 438, in execute_manager 
    utility.execute() 
    File "C:\Python25\lib\site-packages\django-1.2.3-py2.5.egg\django\core\managem 
ent\__init__.py", line 379, in execute 
    self.fetch_command(subcommand).run_from_argv(self.argv) 
    File "C:\Python25\lib\site-packages\django-1.2.3-py2.5.egg\django\core\managem 
ent\__init__.py", line 261, in fetch_command 
    klass = load_command_class(app_name, subcommand) 
    File "C:\Python25\lib\site-packages\django-1.2.3-py2.5.egg\django\core\managem 
ent\__init__.py", line 67, in load_command_class 
    module = import_module('%s.management.commands.%s' % (app_name, name)) 
    File "C:\Python25\lib\site-packages\django-1.2.3-py2.5.egg\django\utils\import 
lib.py", line 35, in import_module 
    __import__(name) 
    File "C:\Python25\lib\site-packages\django-1.2.3-py2.5.egg\django\core\managem 
ent\commands\syncdb.py", line 7, in <module> 
    from django.core.management.sql import custom_sql_for_model, emit_post_sync_ 
signal 
    File "C:\Python25\lib\site-packages\django-1.2.3-py2.5.egg\django\core\managem 
ent\sql.py", line 5, in <module> 
    from django.contrib.contenttypes import generic 
    File "C:\Python25\lib\site-packages\django-1.2.3-py2.5.egg\django\contrib\cont 
enttypes\generic.py", line 6, in <module> 
    from django.db import connection 
    File "C:\Python25\lib\site-packages\django-1.2.3-py2.5.egg\django\db\__init__. 
py", line 77, in <module> 
    connection = connections[DEFAULT_DB_ALIAS] 
    File "C:\Python25\lib\site-packages\django-1.2.3-py2.5.egg\django\db\utils.py" 
, line 91, in __getitem__ 
    backend = load_backend(db['ENGINE']) 
    File "C:\Python25\lib\site-packages\django-1.2.3-py2.5.egg\django\db\utils.py" 
, line 49, in load_backend 
    raise ImproperlyConfigured(error_msg) 
django.core.exceptions.ImproperlyConfigured: 'django_mongodb_engine' isn't an av 
ailable database backend. 
Try using django.db.backends.XXX, where XXX is one of: 
    'dummy', 'mysql', 'oracle', 'postgresql', 'postgresql_psycopg2', 'sqlite3' 
Error was: No module named django_mongodb_engine.base 

Il semble essayer d'utiliser l'installation de django par défaut au lieu de mes environnements django-nonrel installation.

J'ai essayé d'ajouter set PYTHONPATH =% PYTHONPATH%; C: \ chemin \ à \ env \ Lib \ site-packages \ django mais pas de changement.

Des idées pour lesquelles l'installation par défaut de django est utilisée ici?

Répondre

2

Le problème était avec les associations de fichiers sous Windows. J'essayais de syncdb via "manage.py syncdb" qui utilisait l'installation par défaut de Windows python. L'utilisation de "python manage.py syncdb" utilisait le bon python et l'environnement.

1

Avez-vous essayé d'exécuter activate.bat?

Aussi, je pense que la mise en PYTHONPATH devrait fonctionner, mais vous devez d'insérer un nouveau chemin à beggining, et il devrait être chemin vers le répertoire contenant instalation django, ne pas se django:

set PYTHONPATH=C:\path\to\env\Lib\site-packages\;%PYTHONPATH% 
0

voici mes 2 cents à ce problème:

en utilisant PyDev comme plugin Eclipse, pointant juste nouvel interprète à utiliser avec le nouveau projet permet de résoudre ce problème.

Questions connexes