Sure my application depends on the site app, I'm importing Site in my models.py.
But manouche is already at the bottom of the list, so this does not work.

2011/9/22 J. Cliff Dyer <j...@sdf.lonestar.org>:
> Try putting manouche at the bottom of your installed apps list. It looks
> like it depends on the site app being installed, but when django loads the
> manouche.models file, it hasn't loaded sites yet.
> --
> Sent from my Android phone with K-9 Mail. Please excuse my brevity.
>
> Leonardo Giordani <giordani.leona...@gmail.com> wrote:
>>
>> Hi all,
>>
>> I developed a Django application (named "manouche") using south. Thus
>> I have some migrations which build my database.
>>
>> I want to setup a testing environment where I want to begin with a
>> clean db, create it with syncdb, migrate my application, load current
>> fixtures and run tests.
>>
>> My installed applications are
>>
>> INSTALLED_APPS = (
>>     'django.contrib.auth',
>>     'django.contrib.contenttypes',
>>     'django.contrib.sessions',
>>     'django.contrib.sites',
>>     'django.contrib.flatpages',
>>     'django.contrib.messages',
>>     'django.contrib.staticfiles',
>>     'django.contrib.admin',
>>     'accounts',
>>     'south',
>>     'manouche',
>> )
>>
>> But if I clean up the db and run "./manage.py syncdb" I get the following
>>
>> Traceback (most recent call last!
>>  ):
>>
>>  File "./manage.py", line 14, in <module>
>>     execute_manager(settings)
>>   File
>> "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py",
>> line 438, in execute_manager
>>     utility.execute()
>>   File
>> "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py",
>> line 379, in execute
>>     self.fetch_command(subcommand).run_from_argv(self.argv)
>>   File
>> "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py",
>> line 191, in run_from_argv
>>     self.execute(*args, **options.__dict__)
>>   File
>> "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py",
>> line 219, in execute
>>     self.validate()
>>   File
>> "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py",
>> line 249, in validate
>>     num_errors = get_validation_errors(!
>>  s,
>> app)
>>   File
>> "/usr/local/lib/python2.6/dist-packages/django/core/management/validation.py",
>> line 36, in get_validation_errors
>>     for (app_name, error) in get_app_errors().items():
>>   File
>> "/usr/local/lib/python2.6/dist-packages/django/db/models/loading.py",
>> line 146, in get_app_errors
>>     self._populate()
>>   File
>> "/usr/local/lib/python2.6/dist-packages/django/db/models/loading.py",
>> line 61, in _populate
>>     self.load_app(app_name, True)
>>   File
>> "/usr/local/lib/python2.6/dist-packages/django/db/models/loading.py",
>> line 78, in load_app
>>     models = import_module('.models', app_name)
>>   File "/usr/local/lib/python2.6/dist-packages/django/utils/importlib.py",
>> line 35, in import_module
>>     __import__(name)
>>   File
>> "/users/gleo/Devel/stargate/manouche/models.py", line 14, in <module>
>>     current_site = Site.objects.get_current()
>>   File
>> "/usr/local/lib/python2.6/dist-packages/django/contrib/sites/models.py",
>> line 25, in get_current
>>     current_site = self.get(pk=sid)
>>   File
>> "/usr/local/lib/python2.6/dist-packages/django/db/models/manager.py",
>> line 132, in get
>>     return self.get_query_set().get(*args, **kwargs)
>>   File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py",
>> line 344, in get
>>     num = len(clone)
>>   File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py",
>> line 82, in __len__
>>     self._result_cache = list(self.iterator())
>>   File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py",
>> line 273, in iterator
>>     for row in compiler.results_iter():
>>   File
>> "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/compiler.py",
>> line 680, in results_iter
>>     for rows in self.execute_sql(MULTI):
>>   File
>> "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/compiler.py",
>> line 735, in execute_sql
>>     cursor.execute(sql, params)
>>   File
>> "/usr/local/lib/python2.6/dist-packages/django/db/backends/util.py",
>> line 34, in execute
>>     return self.cursor.execute(sql, params)
>>   File
>> "/usr/local/lib/python2.6/dist-packages/django/db/backends/mysql/base.py",
>> line 86, in execute
>>     return self.cursor.execute(query, args)
>>   File "/usr/lib/pymodules/python2.6/MySQLdb/cursors.py", line 166, in
>> execute
>>     self.errorhandler(self, exc, value)
>> File "/usr/lib/pymodules/python2.6/MySQLdb/connections.py", line 35,
>> in defaulterrorhandler
>>     raise errorclass, errorvalue
>> django.db.utils.DatabaseError: (1146, "Table
>> 'stargate_devel.django_site' doesn't exist")
>>
>> Where "stargate" is the name of my project.
>> If I remove my "manouche" application everything works fine. Then I
>> put in my application, run "./manage.pty migrate manouche" and be
>> happy.
>>
>> However I do not understand why it is not working when all
>> applications are present in settings.py and how I can automatically
>> get a complete install, without having to manually remove my
>> application from the settings.
>>
>> Any help appreciated, thank you
>>
>> Leo
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to
>> django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to