etianen / django-watson

Full-text multi-table search application for Django. Easy to install and use, with good performance.
BSD 3-Clause "New" or "Revised" License
1.21k stars 129 forks source link

Django 1.8.5 - Application names aren't unique #138

Closed mrdave-dev closed 8 years ago

mrdave-dev commented 9 years ago

Hello,

I'm attempting to register models on Django 1.8.5. Here's the basics:

Project root: AdTracker/ App: AdTracker/WebInterface

AdTracker/WebInterface/apps.js:

from django.apps import AppConfig
import watson

class WebInterfaceWatsonConfig(AppConfig):
    name = 'WebInterface'
    label = 'wi.WebIntWat'
    def ready(self):
        AssignmentWatson = self.get_model("Assignment")
        BusinessWatson = self.get_model("Business")
        FileWatson = self.get_model("File")

        watson.register(AssignmentWatson)
        watson.register(BusinessWatson)
        watson.register(FileWatson)

Here's my output after I run python3 manage.py buildwatson:

ubuntu@[host]:~/AdTracker$ python3 manage.py buildwatson
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.4/dist-packages/django/core/management/__init__.py", line 351, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.4/dist-packages/django/core/management/__init__.py", line 325, in execute
    django.setup()
  File "/usr/local/lib/python3.4/dist-packages/django/__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/local/lib/python3.4/dist-packages/django/apps/registry.py", line 101, in populate
    "duplicates: %s" % ", ".join(duplicates))
django.core.exceptions.ImproperlyConfigured: Application names aren't unique, duplicates: WebInterface
ubuntu@[host]:~/AdTracker$

If this is something I can help fix, I'd love to contribute. I just need a little direction; I've never contributed to an open-source project before.

luzfcb commented 9 years ago

@dmart914

the error message says there is more than one "WebInterface" in your INSTALLED_APPS. remove duplicate items.

mrdave-dev commented 9 years ago

Hi, @luzfcb. Thanks for the help.

Here's what my INSTALLED_APPS looks like:

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'WebInterface',
    'crispy_forms',
    'crispy_forms_foundation',
    'watson',
    'WebInterface.apps.WebInterfaceWatsonConfig',
)

The Django documentation on Applications led me to believe that I had to add the Config class to my INSTALLED_APPS listings. Is this not accurate? When I comment the WebInterfaceWatsonConfig line out, I get the following output:

ubuntu@[host]:~/AdTracker$ python3 manage.py buildwatson
Deleted 0 stale search entry(s) in 'default' search engine.
Deleted 0 stale search entry(s) in 'admin' search engine.
Refreshed 0 search entry(s) in 'admin' search engine.

I figured there would be a 'WebInterface' entry in the output. Should I not expect that?

Thanks!

etianen commented 9 years ago

You either add the app package, or a dotted path to the app config, not both.

The output of buildwatson doesn't list the names of apps. Instead, those "search engines" represent standalone full text indices - one for the admin, one for the public site.

On Fri, 13 Nov 2015 at 19:05 Dave Martinez notifications@github.com wrote:

Hi, @luzfcb https://github.com/luzfcb. Thanks for the help.

Here's what my INSTALLED_APPS looks like:

INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'WebInterface', 'crispy_forms', 'crispy_forms_foundation', 'watson', 'WebInterface.apps.WebInterfaceWatsonConfig', )

The Django documentation on Applications led me to believe that I had to add the Config class to my INSTALLED_APPS listings. Is this not accurate? When I comment the WebInterfaceWatsonConfig line out, I get the following output:

ubuntu@[host]:~/AdTracker$ python3 manage.py buildwatson Deleted 0 stale search entry(s) in 'default' search engine. Deleted 0 stale search entry(s) in 'admin' search engine. Refreshed 0 search entry(s) in 'admin' search engine.

I figured there would be a 'WebInterface' entry in the output. Should I not expect that?

Thanks!

— Reply to this email directly or view it on GitHub https://github.com/etianen/django-watson/issues/138#issuecomment-156527291 .