Wednesday, October 22, 2014

Re: ImportError cannot import name

Hello Juan,

I think your settings file should look like this:
In settings.py I have:

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


but to be sure I would need to see you directory structure. Hope this helps. 
    with kind regards
         Sabine



Am Mittwoch, 22. Oktober 2014 13:38:24 UTC+2 schrieb Sabine Maennel:
Hello Juan, if your project is "exsite" and your app is "example" then you should probably just add "example" to the list of installed apps. Try it, hope it works.
        with kind regards
            Sabine

Am Mittwoch, 22. Oktober 2014 06:16:25 UTC+2 schrieb Juan Carlos:
Hi everyone,

When I execute the command:

python manage.py runserver &

The response is:

Traceback (most recent call last):
  File "../manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute
    django.setup()
  File "/usr/lib/python2.7/site-packages/django/__init__.py", line 21, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "/usr/lib/python2.7/site-packages/django/apps/config.py", line 120, in create
    "cannot import name '%s' from '%s'" % (cls_name, mod_path))
ImportError: cannot import name 'example' from 'exsite'


In settings.py I have:

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'exsite.example',
)


If I comment (#) the last line, the bug dissapears.  ¿What can I do?  I have Django 1.7 with Python 2.7.  Thanks for your attention.

Regards,
Juan

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/e49bec3e-d757-4335-aab0-78faeb316638%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment