Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model class address.models.Country doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS #135

Open
nimame opened this issue Oct 9, 2020 · 1 comment
Assignees
Labels
Question Questions about django-address

Comments

@nimame
Copy link

nimame commented Oct 9, 2020

I am using django-address 0.2.5 in my django 3.1 app. I am trying to run some parts of the app from the command line using:

from django.conf import settings
import os

settings.configure(DEBUG=True)
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'web.settings')
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

When I try to import my models, I get the following error:

>>> import app.models
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/django/app/models.py", line 18, in <module>
    from address.models import AddressField
  File "/usr/local/lib/python3.8/site-packages/address/models.py", line 168, in <module>
    class Country(models.Model):
  File "/usr/local/lib/python3.8/site-packages/django/db/models/base.py", line 113, in __new__
    raise RuntimeError(
RuntimeError: Model class address.models.Country doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.

Another curious observation: My IDE (PyCharm) shows the following warning when importing address: "Package containing module 'address' is not listed in project requirements", even if it is listed in the requirements.txt.

Can anyone help?

@banagale banagale self-assigned this Oct 17, 2020
@banagale banagale added the Question Questions about django-address label Oct 17, 2020
@banagale
Copy link
Collaborator

Hello! @nimame, thanks for trying django-address.

Sorry to hear about the trouble getting the library to work.

One quick thing that comes to mind is, have you added 'address' under the INSTALLED_APPS section of your settings.py?

Regarding PyCharm, (I also use PyCharm for django and like it a lot), I wonder if this error could again have something to do with your settings. 

Have you tried opening the sample example_site that comes with the library?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question Questions about django-address
Projects
None yet
Development

No branches or pull requests

2 participants