Seems I'm following the instructions, but somehow Django doesn't see django_countries as an app.
Error:
System check identified no issues (0 silenced).
February 18, 2021 - 23:56:01
Django version 3.1.4, using settings 'django_project.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/run/media/fv/hdd-1/PROJECTS/django-receipes/django_template/venv/lib/python3.9/site-packages/django/utils/module_loading.py", line 13, in import_string
module_path, class_name = dotted_path.rsplit('.', 1)
ValueError: not enough values to unpack (expected 2, got 1)
The above exception was the direct cause of the following exception:
(WSGI stuff...)
settings.py:
INSTALLED_APPS = [
'django_countries',
'registration.apps.RegistrationConfig',
.....
Project tree:
.
├── db.sqlite3
├── django_project
│ ├── asgi.py
│ ├── __init__.py
│ ├── __pycache__
│ ├── settings.py
│ ├── urls.py
│ └── wsgi.py
├── manage.py
├── myapp
│ ├── admin.py
│ ├── apps.py
│ ├── forms.py
│ ├── __init__.py
│ ├── migrations
│ ├── models.py
│ ├── __pycache__
│ ├── static
│ ├── templates
│ ├── tests.py
│ ├── urls.py
│ └── views.py
├── readme.rst
├── registration
│ ├── admin.py
│ ├── apps.py
│ ├── __init__.py
│ ├── migrations
│ ├── models.py
│ ├── __pycache__
│ ├── static
│ ├── templates
│ ├── tests.py
│ ├── urls.py
│ └── views.py
├── requirements.txt
├── static
│ └── project
├── templates
│ └── project.html
└── venv
├── bin
├── include
├── lib
├── lib64 -> lib
└── pyvenv.cfg
I installed it with pip, using virtualenv. My virtual is active, I can check it with pip list, as well a import django-countries with the same interpreter I use to run django (python manage.py runserver
). And at any rate, within django Models I can clearly import & use django-countries (pycharm).
What's up?
I think what I really should do is delete this question. But then one has to own up to one's idiocy, so....
Apparently I had initially did this, and never noticed:
I got the error, so thinking it was a venv issue & re-installed my virtual environement for this project. Then I, correctly, added it to the installed apps, not the middleware section:
But since Django's process to import middleware was still trying to import something that definitely wasn't a middleware and had the wrong syntax for that import, it failed with this full stack trace upon start: