Python + Django ImportError: ne peut pas importer des signaux de nom de python2.5 à python2.7

StackOverflow https://stackoverflow.com/questions/3893396

Question

J'ai django-enregistrement installé. Je viens de mettre à jour mon installation de Python 2,5 à 2,7.

Tout fonctionne bien mais quand je tente d'exécuter mon application Django, je reçois l'erreur ci-dessous.

C:\django\pley>python manage.py runserver
Validating models...
Unhandled exception in thread started by <function inner_run at 0x02FA6830>
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\django\core\management\commands\runserver.
py", line 48, in inner_run
    self.validate(display_num_errors=True)
  File "C:\Python27\lib\site-packages\django\core\management\base.py", line 249,
 in validate
    num_errors = get_validation_errors(s, app)
  File "C:\Python27\lib\site-packages\django\core\management\validation.py", lin
e 28, in get_validation_errors
    for (app_name, error) in get_app_errors().items():
  File "C:\Python27\lib\site-packages\django\db\models\loading.py", line 146, in
 get_app_errors
    self._populate()
  File "C:\Python27\lib\site-packages\django\db\models\loading.py", line 64, in
_populate
    self.load_app(app_name)
  File "C:\Python27\lib\site-packages\django\db\models\loading.py", line 78, in
load_app
    models = import_module('.models', app_name)
  File "C:\Python27\lib\site-packages\django\utils\importlib.py", line 35, in im
port_module
    __import__(name)
  File "C:\django\pley\..\pley\accounts\models.py", line 3, in <module>
    from registration import signals
ImportError: cannot import name signals

Si vous avez besoin de plus de détails, comme le code pour les autres fichiers, tout commentaire sur cette question afin que je puisse mettre à jour.

Était-ce utile?

La solution 2

D'accord, je vais répondre à moi-même. Merci à bahamas de #django freenode.

Tout d'abord aller à votre shell Python

>>> import registration
>>> print registration.__file__
/home/wenbert/.local/lib/python/registration/__init__.pyc

Faites un:

$ ls -la /home/wenbert/.local/lib/python/registration

Je ne trouve pas signals.py dans le répertoire.

Alors, téléchargez le fichier tar.gz de: https://bitbucket.org/ubernostrum/ django-enregistrement / src et réinstallent.

TL; DR J'avais cassé une installation (pas signals.py) de django-inscription. Télécharger de la source et de réinstaller manuellement.

Autres conseils

ok Semble à moi. Lorsque vous déballez django-inscription vous obtenez 2 dossiers doc et registration. Dans registration dossier que vous avez un fichier appelé signals.py. Ceci est précisément le fichier que votre application django tente d'importer.

Soit voir si vous avez ajouté django-registration comme INSTALLED_APPS dans votre settings.py du projet.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top