I already installed Django Countries using pip install django_countries and still I'm getting an error of ImportError: cannot import name CountryField:
(simpli)Allens-MacBook-Air:~/Sites/augmify/simpli [master]$ python manage.py syncdb
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/allenchun/.virtualenvs/simpli/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/Users/allenchun/.virtualenvs/simpli/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/allenchun/.virtualenvs/simpli/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Users/allenchun/.virtualenvs/simpli/lib/python2.7/site-packages/django/core/management/base.py", line 284, in execute
self.validate()
File "/Users/allenchun/.virtualenvs/simpli/lib/python2.7/site-packages/django/core/management/base.py", line 310, in validate
num_errors = get_validation_errors(s, app)
File "/Users/allenchun/.virtualenvs/simpli/lib/python2.7/site-packages/django/core/management/validation.py", line 34, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "/Users/allenchun/.virtualenvs/simpli/lib/python2.7/site-packages/django/db/models/loading.py", line 196, in get_app_errors
self._populate()
File "/Users/allenchun/.virtualenvs/simpli/lib/python2.7/site-packages/django/db/models/loading.py", line 78, in _populate
self.load_app(app_name)
File "/Users/allenchun/.virtualenvs/simpli/lib/python2.7/site-packages/django/db/models/loading.py", line 99, in load_app
models = import_module('%s.models' % app_name)
File "/Users/allenchun/.virtualenvs/simpli/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
__import__(name)
File "/Users/allenchun/Sites/augmify/simpli/members/models/__init__.py", line 2, in <module>
from members.models.checkin import CheckIn
File "/Users/allenchun/Sites/augmify/simpli/members/models/checkin.py", line 6, in <module>
from merchants.models import MerchantLocation
File "/Users/allenchun/Sites/augmify/simpli/merchants/models/__init__.py", line 3, in <module>
from merchants.models.beacon import Beacon
File "/Users/allenchun/Sites/augmify/simpli/merchants/models/beacon.py", line 5, in <module>
from merchants.models.merchant_location import MerchantLocation
File "/Users/allenchun/Sites/augmify/simpli/merchants/models/merchant_location.py", line 4, in <module>
from django_countries import CountryField
ImportError: cannot import name CountryField
from django_countries.fields import CountryField
Example usage the the pypi documentation.
from django.db import models
from django_countries.fields import CountryField
class Person(models.Model):
name = models.CharField(max_length=100)
country = CountryField()
>>> person = Person(name='Chris', country='NZ')
>>> person.country
Country(code='NZ')
>>> person.country.name
'New Zealand'
>>> person.country.flag
'/static/flags/nz.gif'
Related
I'm using google app engine dev server for python running on mac os.
The project I'm running is an appengine django project using djangae and django rest framework.
Everything in the project works fine, however as soon as a declare an import relating to the rest_framework I get an error regarding django.test.client eventhough I'm not running any tests at the moment.
The import I try to do is 'from rest_framework.decoraters import api_view', as soon as I make this import or any other import relating to the rest framework.
This is the error I get with every import I make that involves the rest framework.
ERROR 2017-02-27 10:19:08,019 base.py:256] Internal Server Error: /_ah/warmup
Traceback (most recent call last):
File "/Users/MyUser/git/project-name/src/lib/django/core/handlers/base.py", line 223, in get_response
response = middleware_method(request, response)
File "/Users/MyUser/git/project-name/src/core/middleware/url_definition.py", line 32, in process_response
response = redirect('%s/' % request.path)
File "/Users/MyUser/git/project-name/src/lib/django/shortcuts.py", line 116, in redirect
return redirect_class(resolve_url(to, *args, **kwargs))
File "/Users/MyUser/git/project-name/src/lib/django/shortcuts.py", line 205, in resolve_url
return urlresolvers.reverse(to, args=args, kwargs=kwargs)
File "/Users/MyUser/git/project-name/src/lib/django/core/urlresolvers.py", line 578, in reverse
return force_text(iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs)))
File "/Users/MyUser/git/project-name/src/lib/django/core/urlresolvers.py", line 432, in _reverse_with_prefix
self._populate()
File "/Users/MyUser/git/project-name/src/lib/django/core/urlresolvers.py", line 284, in _populate
for pattern in reversed(self.url_patterns):
File "/Users/MyUser/git/project-name/src/lib/django/core/urlresolvers.py", line 401, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/Users/MyUser/git/project-name/src/lib/django/core/urlresolvers.py", line 395, in urlconf_module
self._urlconf_module = import_module(self.urlconf_name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/Users/MyUser/git/project-name/src/core/urls.py", line 34, in <module>
url(r'^', include('pages.urls'), name='pages.urls')
File "/Users/MyUser/git/project-name/src/lib/django/conf/urls/__init__.py", line 33, in include
urlconf_module = import_module(urlconf_module)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/Users/MyUser/git/project-name/src/pages/urls.py", line 31, in <module>
url(r'^myapp/', include('pages.myapp.urls', namespace='rest_framework'), name="pages.myapp"),
File "/Users/MyUser/git/project-name/src/lib/django/conf/urls/__init__.py", line 33, in include
urlconf_module = import_module(urlconf_module)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/Users/MyUser/git/project-name/src/pages/myapp/urls.py", line 4, in <module>
url(r'^finance/', include('pages.myapp.finance.urls'), name='pages.myapp.finance'),
File "/Users/MyUser/git/project-name/src/lib/django/conf/urls/__init__.py", line 33, in include
urlconf_module = import_module(urlconf_module)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/Users/MyUser/git/project-name/src/pages/myapp/finance/urls.py", line 4, in <module>
url(r'^api/', include('pages.myapp.finance.api.urls'), name='pages.myapp.finance.api.urls'),
File "/Users/MyUser/git/project-name/src/lib/django/conf/urls/__init__.py", line 33, in include
urlconf_module = import_module(urlconf_module)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/Users/MyUser/git/project-name/src/pages/myapp/finance/api/urls.py", line 4, in <module>
url(r'^service/', include('pages.myapp.finance.api.service.urls'), name='pages.myapp.finance.api.service'),
File "/Users/MyUser/git/project-name/src/lib/django/conf/urls/__init__.py", line 33, in include
urlconf_module = import_module(urlconf_module)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/Users/MyUser/git/project-name/src/pages/myapp/finance/api/service/urls.py", line 8, in <module>
url(r'^user/', include('pages.myapp.finance.api.service.user.urls'),
File "/Users/MyUser/git/project-name/src/lib/django/conf/urls/__init__.py", line 33, in include
urlconf_module = import_module(urlconf_module)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/Users/MyUser/git/project-name/src/pages/myapp/finance/api/service/user/urls.py", line 3, in <module>
from pages.myapp.finance.api.service.user import functions
File "/Users/MyUser/git/project-name/src/pages/myapp/finance/api/service/user/functions.py", line 5, in <module>
from rest_framework.decorators import api_view
File "/Users/MyUser/git/project-name/src/lib/rest_framework/decorators.py", line 15, in <module>
from rest_framework.views import APIView
File "/Users/MyUser/git/project-name/src/lib/rest_framework/views.py", line 19, in <module>
from rest_framework.request import Request
File "/Users/MyUser/git/project-name/src/lib/rest_framework/request.py", line 23, in <module>
from rest_framework.settings import api_settings
File "/Users/MyUser/git/project-name/src/lib/rest_framework/settings.py", line 24, in <module>
from django.test.signals import setting_changed
File "/Users/MyUser/git/project-name/src/lib/django/test/__init__.py", line 5, in <module>
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/python/sandbox.py", line 999, in load_module
raise ImportError('No module named %s' % fullname)
ImportError: No module named django.test.client
If you run into import errors like this on app engine be sure to check your skip_files in app.yaml.
For example:
skip_files:
- ^(.*/)?.*/test/.*$
Makes the 'django/test' folder not importable in your dev environment and the folder will not be deployed to app engine.
I started learning a Django tutorial , and when I want to run
python manage.py runserver
Here is the error message:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/sarfraz/.local/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
utility.execute()
File "/home/sarfraz/.local/lib/python2.7/site-packages/django/core/management/__init__.py", line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/sarfraz/.local/lib/python2.7/site-packages/django/core/management/__init__.py", line 190, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/home/sarfraz/.local/lib/python2.7/site-packages/django/core/management/__init__.py", line 40, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/sarfraz/.local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 14, in <module>
from django.db.migrations.executor import MigrationExecutor
File "/home/sarfraz/.local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 6, in <module>
from .loader import MigrationLoader
File "/home/sarfraz/.local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 10, in <module>
from django.db.migrations.recorder import MigrationRecorder
File "/home/sarfraz/.local/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 9, in <module>
class MigrationRecorder(object):
File "/home/sarfraz/.local/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 23, in MigrationRecorder
class Migration(models.Model):
File "/home/sarfraz/.local/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 24, in Migration
app = models.CharField(max_length=255)
File "/home/sarfraz/.local/lib/python2.7/site-packages/django/db/models/fields/__init__.py", line 1081, in __init__
super(CharField, self).__init__(*args, **kwargs)
File "/home/sarfraz/.local/lib/python2.7/site-packages/django/db/models/fields/__init__.py", line 161, in __init__
self.db_tablespace = db_tablespace or settings.DEFAULT_INDEX_TABLESPACE
File "/home/sarfraz/.local/lib/python2.7/site-packages/django/conf/__init__.py", line 48, in __getattr__
self._setup(name)
File "/home/sarfraz/.local/lib/python2.7/site-packages/django/conf/__init__.py", line 44, in _setup
self._wrapped = Settings(settings_module)
File "/home/sarfraz/.local/lib/python2.7/site-packages/django/conf/__init__.py", line 108, in __init__
"Please fix your settings." % setting)
django.core.exceptions.ImproperlyConfigured: The TEMPLATE_DIRS setting must be a tuple. Please fix your settings.
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/sarfraz/.local/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
utility.execute()
File "/home/sarfraz/.local/lib/python2.7/site-packages/django/core/management/__init__.py", line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/sarfraz/.local/lib/python2.7/site-packages/django/core/management/__init__.py", line 190, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/home/sarfraz/.local/lib/python2.7/site-packages/django/core/management/__init__.py", line 40, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/sarfraz/.local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 14, in <module>
from django.db.migrations.executor import MigrationExecutor
File "/home/sarfraz/.local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 6, in <module>
from .loader import MigrationLoader
File "/home/sarfraz/.local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 10, in <module>
from django.db.migrations.recorder import MigrationRecorder
File "/home/sarfraz/.local/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 9, in <module>
class MigrationRecorder(object):
File "/home/sarfraz/.local/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 23, in MigrationRecorder
class Migration(models.Model):
File "/home/sarfraz/.local/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 24, in Migration
app = models.CharField(max_length=255)
File "/home/sarfraz/.local/lib/python2.7/site-packages/django/db/models/fields/__init__.py", line 1081, in __init__
super(CharField, self).__init__(*args, **kwargs)
File "/home/sarfraz/.local/lib/python2.7/site-packages/django/db/models/fields/__init__.py", line 161, in __init__
self.db_tablespace = db_tablespace or settings.DEFAULT_INDEX_TABLESPACE
File "/home/sarfraz/.local/lib/python2.7/site-packages/django/conf/__init__.py", line 48, in __getattr__
self._setup(name)
File "/home/sarfraz/.local/lib/python2.7/site-packages/django/conf/__init__.py", line 44, in _setup
self._wrapped = Settings(settings_module)
File "/home/sarfraz/.local/lib/python2.7/site-packages/django/conf/__init__.py", line 108, in __init__
"Please fix your settings." % setting)
django.core.exceptions.ImproperlyConfigured: The TEMPLATE_DIRS setting must be a tuple. Please fix your settings.
And there is the ligne in my project/settings.py
TEMPLATE_DIRS = (
"/home/sarfraz/django/crepes_bretonnes/templates/"
)
Hope it was clear.
Add a comma to the end of the value closed between parenthesis otherwise it is not a tuple:
TEMPLATE_DIRS = ( "/home/sarfraz/django/crepes_bretonnes/templates/", )
it should solve the issue. Hope that it helps.
I'm trying to run single test using django-nose:
./manage.py test lead.tests:LeadStatTests.basic_stat_test
And following ImportError occurs:
======================================================================
ERROR: Failure: ImportError (cannot import name LeadSource)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/kolen/.virtualenvs/someenv/lib/python2.7/site-packages/nose/loader.py", line 420, in loadTestsFromName
addr.filename, addr.module)
File "/Users/kolen/.virtualenvs/someenv/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/Users/kolen/.virtualenvs/someenv/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/Users/kolen/items/someproject/lead/tests.py", line 16, in <module>
from lead.models import Lead, Action, LeadSource, LeadType, events_by_month, EventSummary
File "/Users/kolen/items/someproject/lead/models.py", line 38, in <module>
User = get_user_model()
File "/Users/kolen/.virtualenvs/someenv/lib/python2.7/site-packages/django/contrib/auth/__init__.py", line 127, in get_user_model
user_model = get_model(app_label, model_name)
File "/Users/kolen/.virtualenvs/someenv/lib/python2.7/site-packages/django/db/models/loading.py", line 271, in get_model
self._populate()
File "/Users/kolen/.virtualenvs/someenv/lib/python2.7/site-packages/django/db/models/loading.py", line 78, in _populate
self.load_app(app_name)
File "/Users/kolen/.virtualenvs/someenv/lib/python2.7/site-packages/django/db/models/loading.py", line 99, in load_app
models = import_module('%s.models' % app_name)
File "/Users/kolen/.virtualenvs/someenv/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
__import__(name)
File "/Users/kolen/.virtualenvs/someenv/lib/python2.7/site-packages/debug_toolbar/models.py", line 63, in <module>
patch_root_urlconf()
File "/Users/kolen/.virtualenvs/someenv/lib/python2.7/site-packages/debug_toolbar/models.py", line 51, in patch_root_urlconf
reverse('djdt:render_panel')
File "/Users/kolen/.virtualenvs/someenv/lib/python2.7/site-packages/django/core/urlresolvers.py", line 507, in reverse
app_list = resolver.app_dict[ns]
File "/Users/kolen/.virtualenvs/someenv/lib/python2.7/site-packages/django/core/urlresolvers.py", line 329, in app_dict
self._populate()
File "/Users/kolen/.virtualenvs/someenv/lib/python2.7/site-packages/django/core/urlresolvers.py", line 267, in _populate
for pattern in reversed(self.url_patterns):
File "/Users/kolen/.virtualenvs/someenv/lib/python2.7/site-packages/django/core/urlresolvers.py", line 365, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/Users/kolen/.virtualenvs/someenv/lib/python2.7/site-packages/django/core/urlresolvers.py", line 360, in urlconf_module
self._urlconf_module = import_module(self.urlconf_name)
File "/Users/kolen/.virtualenvs/someenv/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
__import__(name)
File "/Users/kolen/items/someproject/system/urls.py", line 8, in <module>
admin.autodiscover()
File "/Users/kolen/.virtualenvs/someenv/lib/python2.7/site-packages/django/contrib/admin/__init__.py", line 29, in autodiscover
import_module('%s.admin' % app)
File "/Users/kolen/.virtualenvs/someenv/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
__import__(name)
File "/Users/kolen/items/someproject/lead/admin.py", line 5, in <module>
from lead.models import LeadSource, LeadType, Lead, ........, \
ImportError: cannot import name LeadSource
Running all tests with ./manage.py test works. This exception occurs only when trying to run single test or test class. However running all tests takes too much time so I want a way to run single test.
Application and django admin works too. There's no __init__.py in root directory of the project.
Suddenly discovered that problem is caused by django-debug-toolbar. Removing it from the project solved this issue.
There is possibly duplicate of this question with similar problem also caused by django-debug-toolbar.
I am trying to deploy django that now runs locally on ec2 ubuntu server. I got this while trying to run python mange.py runserver
i searched nothing seems to solve this
Traceback (most recent call last):
File "manage.py", line 14, in <module>
execute_manager(settings)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 459, in execute_manager
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 261, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 69, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/management/commands/runserver.py", line 4, in <module>
from django.core.management.commands.runserver import BaseRunserverCommand
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 8, in <module>
from django.core.servers.basehttp import AdminMediaHandler, run, WSGIServerException, get_internal_wsgi_application
File "/usr/local/lib/python2.7/dist-packages/django/core/servers/basehttp.py", line 28, in <module>
from django.contrib.staticfiles import handlers
File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/handlers.py", line 8, in <module>
from django.contrib.staticfiles.views import serve
File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/views.py", line 15, in <module>
from django.contrib.staticfiles import finders
File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/finders.py", line 11, in <module>
from django.contrib.staticfiles.storage import AppStaticStorage
File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/storage.py", line 10, in <module>
from django.core.cache import (get_cache, InvalidCacheBackendError,
File "/usr/local/lib/python2.7/dist-packages/django/core/cache/__init__.py", line 187, in <module>
cache = get_cache(DEFAULT_CACHE_ALIAS)
File "/usr/local/lib/python2.7/dist-packages/django/core/cache/__init__.py", line 172, in get_cache
backend, location, params = parse_backend_conf(backend, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/core/cache/__init__.py", line 125, in parse_backend_conf
backend = args.pop('BACKEND')
KeyError: 'BACKEND'
Set the backend in your Settings.py
What I was trying to do was to override the save method of one of my models called Shastra
class Shastra(models.Model):
something = models.IntegerField()
def save(self, *args, **kwargs):
post_content(app='shastra', content=self)
super(Shastra, self).save(*args, **kwargs)
# The function being called in the override function
def post_content(*args, **kwargs):
FbApiContent(content = kwargs['content']).save()
# The model being used by the override function
from shastra.models import Shastra
class FbApiContent(models.Model):
content = models.ForeignKey(Shastra)
The Traceback
Traceback (most recent call last):
File "C:\Documents and Settings\EC.32-SAMUEL\workspace\kiosk\manage.py", line 14, in <module>
execute_manager(settings)
File "C:\Python26\lib\site-packages\django\core\management\__init__.py", line 438, in execute_manager
utility.execute()
File "C:\Python26\lib\site-packages\django\core\management\__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python26\lib\site-packages\django\core\management\base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "C:\Python26\lib\site-packages\django\core\management\base.py", line 220, in execute
output = self.handle(*args, **options)
File "C:\Python26\lib\site-packages\django\core\management\commands\runserver.py", line 67, in handle
self.run(*args, **options)
File "C:\Python26\lib\site-packages\django\core\management\commands\runserver.py", line 78, in run
self.inner_run(*args, **options)
File "C:\Python26\lib\site-packages\django\core\management\commands\runserver.py", line 88, in inner_run
self.validate(display_num_errors=True)
File "C:\Python26\lib\site-packages\django\core\management\base.py", line 249, in validate
num_errors = get_validation_errors(s, app)
File "C:\Python26\lib\site-packages\django\core\management\validation.py", line 36, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "C:\Python26\lib\site-packages\django\db\models\loading.py", line 146, in get_app_errors
self._populate()
File "C:\Python26\lib\site-packages\django\db\models\loading.py", line 64, in _populate
self.load_app(app_name)
File "C:\Python26\lib\site-packages\django\db\models\loading.py", line 78, in load_app
models = import_module('.models', app_name)
File "C:\Python26\lib\site-packages\django\utils\importlib.py", line 35, in import_module
__import__(name)
File "C:\Documents and Settings\EC.32-SAMUEL\workspace\kiosk\..\kiosk\shastra\models.py", line 10, in <module>
from fb_api.api import *
File "C:\Documents and Settings\EC.32-SAMUEL\workspace\kiosk\..\kiosk\fb_api\api.py", line 7, in <module>
from fb_api.models import FbApiUser
File "C:\Documents and Settings\EC.32-SAMUEL\workspace\kiosk\..\kiosk\fb_api\models.py", line 41, in <module>
from shastra.models import Shastra
ImportError: cannot import name Shastra
I have no idea what's going on : |, any insights I would be grateful
Circular import. Either resolve it, or use string as FK argument (models.ForeignKey('app.Shastra')).
It looks like you have a circular import.
shastra\models.py is doing from fb_api.api import *
fb_api\api.py is doing from fb_api.models import FbApiUser
fb_api\models.py is doing from shastra.models import Shastra
Even if you just import one class from a module, the whole module gets executed to fill in it's namespace.