After a minor migration I keep receiving the following error from Django's runserver command:
RuntimeError: Model class captcha.models.CaptchaStore doesn't declare an explicit app_label and isn't in an application in INSTALLED
_APPS.
This is caused by django-simple-captcha
which has been working for quite a while (a month). I haven't changed something in this exact app.
I have uninstalled it and now Django can't find ADMIN app, so that it has something to do with integrity.
My settings are like this:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
# custom
"boats.apps.BoatsConfig",
"articles.apps.ArticlesConfig",
#3rd party
"captcha",
"bootstrap4",
"django_cleanup",
"easy_thumbnails",
"social_django",
"crispy_forms",
"extra_views",
"debug_toolbar",
"reversion",
"dynamic_validator",
"django.forms", # new for a custom widgets
How I can fix this problem? It seems weird… Or alternativelly how to roll back the last migration?
full trace-back is below:
(myproject) C:\Users\hardcase1\PycharmProjects\myproject>python manage.py runserver
Watching for file changes with StatReloader
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\python\Lib\threading.py", line 917, in _bootstrap_inner
self.run()
File "C:\python\Lib\threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\hardcase1\.virtualenvs\myproject-N1oU6R8w\lib\site-packages\django\utils\autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "C:\Users\hardcase1\.virtualenvs\myproject-N1oU6R8w\lib\site-packages\django\core\management\commands\runserver.py", line 109
, in inner_run
autoreload.raise_last_exception()
File "C:\Users\hardcase1\.virtualenvs\myproject-N1oU6R8w\lib\site-packages\django\utils\autoreload.py", line 77, in raise_last_exc
eption
raise _exception[0](_exception[1]).with_traceback(_exception[2])
File "C:\Users\hardcase1\.virtualenvs\myproject-N1oU6R8w\lib\site-packages\django\utils\autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "C:\Users\hardcase1\.virtualenvs\myproject-N1oU6R8w\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\hardcase1\.virtualenvs\myproject-N1oU6R8w\lib\site-packages\django\apps\registry.py", line 114, in populate
app_config.import_models()
File "C:\Users\hardcase1\.virtualenvs\myproject-N1oU6R8w\lib\site-packages\django\apps\config.py", line 211, in import_models
self.models_module = import_module(models_module_name)
File "C:\Users\hardcase1\.virtualenvs\myproject-N1oU6R8w\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\hardcase1\PycharmProjects\myproject\boats\models.py", line 9, in <module>
from articles.models import SubHeading
File "C:\Users\hardcase1\PycharmProjects\myproject\articles\models.py", line 4, in <module>
from boats.models import ExtraUser
ImportError: cannot import name 'ExtraUser' from 'boats.models' (C:\Users\hardcase1\PycharmProjects\myproject\boats\models.py)
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\hardcase1\.virtualenvs\myproject-N1oU6R8w\lib\site-packages\django\core\management\__init__.py", line 381, in execu
te_from_command_line
utility.execute()
File "C:\Users\hardcase1\.virtualenvs\myproject-N1oU6R8w\lib\site-packages\django\core\management\__init__.py", line 375, in execu
te
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\hardcase1\.virtualenvs\myproject-N1oU6R8w\lib\site-packages\django\core\management\base.py", line 323, in run_from_
argv
self.execute(*args, **cmd_options)
File "C:\Users\hardcase1\.virtualenvs\myproject-N1oU6R8w\lib\site-packages\django\core\management\commands\runserver.py", line 60,
in execute
super().execute(*args, **options)
File "C:\Users\hardcase1\.virtualenvs\myproject-N1oU6R8w\lib\site-packages\django\core\management\base.py", line 364, in execute
output = self.handle(*args, **options)
File "C:\Users\hardcase1\.virtualenvs\myproject-N1oU6R8w\lib\site-packages\django\core\management\commands\runserver.py", line 95,
in handle
self.run(**options)
File "C:\Users\hardcase1\.virtualenvs\myproject-N1oU6R8w\lib\site-packages\django\core\management\commands\runserver.py", line 102
, in run
autoreload.run_with_reloader(self.inner_run, **options)
File "C:\Users\hardcase1\.virtualenvs\myproject-N1oU6R8w\lib\site-packages\django\utils\autoreload.py", line 579, in run_with_relo
ader
start_django(reloader, main_func, *args, **kwargs)
File "C:\Users\hardcase1\.virtualenvs\myproject-N1oU6R8w\lib\site-packages\django\utils\autoreload.py", line 564, in start_django
reloader.run(django_main_thread)
File "C:\Users\hardcase1\.virtualenvs\myproject-N1oU6R8w\lib\site-packages\django\utils\autoreload.py", line 272, in run
get_resolver().urlconf_module
File "C:\Users\hardcase1\.virtualenvs\myproject-N1oU6R8w\lib\site-packages\django\utils\functional.py", line 80, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\hardcase1\.virtualenvs\myproject-N1oU6R8w\lib\site-packages\django\urls\resolvers.py", line 564, in urlconf_module
return import_module(self.urlconf_name)
File "C:\Users\hardcase1\.virtualenvs\myproject-N1oU6R8w\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\hardcase1\PycharmProjects\myproject\myproject\urls.py", line 14, in <module>
path("captcha/", include("captcha.urls")),
File "C:\Users\hardcase1\.virtualenvs\myproject-N1oU6R8w\lib\site-packages\django\urls\conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "C:\Users\hardcase1\.virtualenvs\myproject-N1oU6R8w\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\hardcase1\.virtualenvs\myproject-N1oU6R8w\lib\site-packages\captcha\urls.py", line 2, in <module>
from captcha import views
File "C:\Users\hardcase1\.virtualenvs\myproject-N1oU6R8w\lib\site-packages\captcha\views.py", line 3, in <module>
from captcha.models import CaptchaStore
File "C:\Users\hardcase1\.virtualenvs\myproject-N1oU6R8w\lib\site-packages\captcha\models.py", line 25, in <module>
class CaptchaStore(models.Model):
File "C:\Users\hardcase1\.virtualenvs\myproject-N1oU6R8w\lib\site-packages\django\db\models\base.py", line 111, in __new__
"INSTALLED_APPS." % (module, name)
RuntimeError: Model class captcha.models.CaptchaStore doesn't declare an explicit app_label and isn't in an application in INSTALLED
_APPS.
Final migration
class Migration(migrations.Migration):
dependencies = [
('boats', '0014_auto_20190419_1429'),
]
operations = [
migrations.AlterField(
model_name='boatimage',
name='boat_photo',
field=models.ImageField(blank=True, upload_to=boats.utilities.get_timestamp_path, verbose_name='Boat photo'),
), # i removed help_text here
migrations.AlterField(
model_name='boatmodel',
name='boat_mast_type',
field=models.CharField(choices=[(None, 'Please choose rigging type'), ('SL', 'Sloop'), ('KE', 'Ketch'), ('YA', 'Yawl'), ('CK', 'Cat Ketch')], help_text='Please input boat rigging type', max_length=10, verbose_name='Boat rigging type'), # i added (None, 'Please choose rigging type') here
),
]
I presume you just uninstalled django-simple-captcha? Remove "captcha" from INSTALLED_APPS as well, or Django will still look for the app.
And of course delete all CaptchaFields from your models.
It was a circular import. Solution has been found, thanks to Alasdair.
I hid 2 imports inside the method...
def save(self, force_insert=False, force_update=False, using=None,
update_fields=None):
from articles.models import SubHeading, UpperHeading
SubHeading.objects.update_or_create(name=self.boat_name, order=0,
foreignkey_id=93)
models.Model.save(self, force_insert=False, force_update=False, using=None,
update_fields=None)
Related
I was experimenting with my database and made some errors and messed up the whole database. I deleted the database and created a new blank db. When I go to makemigrations i get the error
ModuleNotFoundError: No module named 'blog.models' refering to the line in my views.py where i import my models. I tried creating a a new project and moving the files over same error. Everything was working fine before I messed up the DB. Sorry for not a ton of information I dont know what the issue really is
error
Exception in thread django-main-thread:
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\threading.py", line 954, in _bootstrap_inner
self.run()
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\threading.py", line 892, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\commands\runserver.py", line 118, in inner_run
self.check(display_num_errors=True)
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\base.py", line 419, in check
all_issues = checks.run_checks(
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\checks\registry.py", line 76, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\checks\urls.py", line 13, in check_url_config
return check_resolver(resolver)
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\checks\urls.py", line 23, in check_resolver
return check_method()
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\django\urls\resolvers.py", line 412, in check
for pattern in self.url_patterns:
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\django\urls\resolvers.py", line 598, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\django\urls\resolvers.py", line 591, in urlconf_module
return import_module(self.urlconf_name)
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 790, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "C:\Users\usera\djangoproject\django_coreyYT\urls.py", line 37, in <module>
path('', include('blog.urls')),
File "C:\Users\usera\AppData\Local\Programs\Python\Python39\lib\site-packages\django\urls\conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "C:\Users\usera\AppData\Local\Programs\Python\Python39\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 790, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "C:\Users\usera\djangoproject\blog\urls.py", line 3, in <module>
from .views import PostDeleteView, ....... (all the models)
File "C:\Users\usera\djangoproject\blog\views.py", line 5, in <module>
from .forms import PostForm, .... (all the models)
File "C:\Users\usera\djangoproject\blog\forms.py", line 3, in <module>
from blog.models import Post ... (all the models)
ModuleNotFoundError: No module named 'blog.models'
update
I tried switching to my production DB and i am still getting the same error
I have a model when I want to field_name to be the name of any field from another model.
I wrote this code:
from providers.models import Organisation
FIELD_CHOICES = [(x.name,x.verbose_name) for x in Organisation._meta.get_fields() ]
class Score (models.Model):
field_name = models.CharField(max_length=101, choices=FIELD_CHOICES)
When I run makemigrations I get django.core.exceptions.AppRegistryNotReady: Models aren't loaded yet.
This is the complete traceback:
Traceback (most recent call last):
File "./src/manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/henry/Documents/Sites/Development/autumna-dev/env/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/home/henry/Documents/Sites/Development/autumna-dev/env/lib/python3.6/site-packages/django/core/management/__init__.py", line 357, in execute
django.setup()
File "/home/henry/Documents/Sites/Development/autumna-dev/env/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/henry/Documents/Sites/Development/autumna-dev/env/lib/python3.6/site-packages/django/apps/registry.py", line 112, in populate
app_config.import_models()
File "/home/henry/Documents/Sites/Development/autumna-dev/env/lib/python3.6/site-packages/django/apps/config.py", line 198, in import_models
self.models_module = import_module(models_module_name)
File "/home/henry/Documents/Sites/Development/autumna-dev/env/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/henry/Documents/Sites/Development/autumna-dev/autumna/src/scoring/models.py", line 7, in <module>
FIELD_CHOICES = [(x.name,x.verbose_name) for x in Organisation._meta.get_fields() ]
File "/home/henry/Documents/Sites/Development/autumna-dev/env/lib/python3.6/site-packages/django/db/models/options.py", line 733, in get_fields
return self._get_fields(include_parents=include_parents, include_hidden=include_hidden)
File "/home/henry/Documents/Sites/Development/autumna-dev/env/lib/python3.6/site-packages/django/db/models/options.py", line 793, in _get_fields
all_fields = self._relation_tree
File "/home/henry/Documents/Sites/Development/autumna-dev/env/lib/python3.6/site-packages/django/utils/functional.py", line 37, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/henry/Documents/Sites/Development/autumna-dev/env/lib/python3.6/site-packages/django/db/models/options.py", line 706, in _relation_tree
return self._populate_directed_relation_graph()
File "/home/henry/Documents/Sites/Development/autumna-dev/env/lib/python3.6/site-packages/django/db/models/options.py", line 677, in _populate_directed_relation_graph
all_models = self.apps.get_models(include_auto_created=True)
File "/home/henry/Documents/Sites/Development/autumna-dev/env/lib/python3.6/site-packages/django/apps/registry.py", line 175, in get_models
self.check_models_ready()
File "/home/henry/Documents/Sites/Development/autumna-dev/env/lib/python3.6/site-packages/django/apps/registry.py", line 137, in check_models_ready
raise AppRegistryNotReady("Models aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Models aren't loaded yet.
i pull my friend code in github , and when i want to run it with django
*path*>workon test
(test)*path*>py manage.py runserver
Here is the error I got
Traceback (most recent call last):
File "C:\Users\u532246\Envs\test\lib\site-packages\django\db\backends\oracle\base.py", line 47, in <module>
import cx_Oracle as Database
ModuleNotFoundError: No module named 'cx_Oracle'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\users\u532246\appdata\local\programs\python\python38-32\Lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "c:\users\u532246\appdata\local\programs\python\python38-32\Lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\u532246\Envs\test\lib\site-packages\django\utils\autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "C:\Users\u532246\Envs\test\lib\site-packages\django\core\management\commands\runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "C:\Users\u532246\Envs\test\lib\site-packages\django\utils\autoreload.py", line 77, in raise_last_exception
raise _exception[1]
File "C:\Users\u532246\Envs\test\lib\site-packages\django\core\management\__init__.py", line 337, in execute
autoreload.check_errors(django.setup)()
File "C:\Users\u532246\Envs\test\lib\site-packages\django\utils\autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "C:\Users\u532246\Envs\test\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\u532246\Envs\test\lib\site-packages\django\apps\registry.py", line 114, in populate
app_config.import_models()
File "C:\Users\u532246\Envs\test\lib\site-packages\django\apps\config.py", line 211, in import_models
self.models_module = import_module(models_module_name)
File "C:\Users\u532246\Envs\test\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\u532246\Desktop\skripsi\Django-master\polls\models.py", line 6, in <module>
class Question(models.Model):
File "C:\Users\u532246\Envs\test\lib\site-packages\django\db\models\base.py", line 117, in __new__
new_class.add_to_class('_meta', Options(meta, app_label))
File "C:\Users\u532246\Envs\test\lib\site-packages\django\db\models\base.py", line 321, in add_to_class
value.contribute_to_class(cls, name)
File "C:\Users\u532246\Envs\test\lib\site-packages\django\db\models\options.py", line 204, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "C:\Users\u532246\Envs\test\lib\site-packages\django\db\__init__.py", line 28, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "C:\Users\u532246\Envs\test\lib\site-packages\django\db\utils.py", line 201, in __getitem__
backend = load_backend(db['ENGINE'])
File "C:\Users\u532246\Envs\test\lib\site-packages\django\db\utils.py", line 110, in load_backend
return import_module('%s.base' % backend_name)
File "C:\Users\u532246\Envs\test\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\u532246\Envs\test\lib\site-packages\django\db\backends\oracle\base.py", line 49, in <module>
raise ImproperlyConfigured("Error loading cx_Oracle module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading cx_Oracle module: No module named 'cx_Oracle'
I already put the oracle modulein advance system setting , but its still not working , i wonder if i put the wrong file or not there is something i havent set to make it work
Already find the solution :
Check if your python has the same bit with cx_oracle , perhaps cx_oracle will be installed the same bit like your OS has .
if it didnt have the same bit , you must download the python the same bit like your OS does , if it is 64 bit then your python must 64 bit
I noticed that my Django-server crashes when I update pytz==2018.7 to pytz==2019.1. The Pytz library is in charge for all Timezone calculations. I ask myself if something changed and where I can find a changelog?
I did not change anything time related in my Django project and when I go back to pytz==2018.7 everything works fine.
I am using Django 2.2 with virtualenv, here is my list
Python==3.7.2
Django 2.2
Virtualenv==16.5.0
Django==2.2
django-widget-tweaks==1.4.3
djangorestframework==3.9.2
Pillow==6.0.0
Pygments==2.3.1
pytz==2018.7
sqlparse==0.3.0
Settings.py
# Internationalization
# https://docs.djangoproject.com/en/2.2/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
<…>
latest crash with pytz==2019.1 update
(env2) D:\coding\Webprojects\phone>python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "D:\coding\virtual_env\env2\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
utility.execute()
File "D:\coding\virtual_env\env2\lib\site-packages\django\core\management\__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "D:\coding\virtual_env\env2\lib\site-packages\django\core\management\base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "D:\coding\virtual_env\env2\lib\site-packages\django\core\management\commands\runserver.py", line 60, in execute
super().execute(*args, **options)
File "D:\coding\virtual_env\env2\lib\site-packages\django\core\management\base.py", line 364, in execute
output = self.handle(*args, **options)
File "D:\coding\virtual_env\env2\lib\site-packages\django\core\management\commands\runserver.py", line 95, in handle
self.run(**options)
File "D:\coding\virtual_env\env2\lib\site-packages\django\core\management\commands\runserver.py", line 102, in run
autoreload.run_with_reloader(self.inner_run, **options)
File "D:\coding\virtual_env\env2\lib\site-packages\django\utils\autoreload.py", line 579, in run_with_reloader
start_django(reloader, main_func, *args, **kwargs)
File "D:\coding\virtual_env\env2\lib\site-packages\django\utils\autoreload.py", line 564, in start_django
reloader.run(django_main_thread)
File "D:\coding\virtual_env\env2\lib\site-packages\django\utils\autoreload.py", line 272, in run
get_resolver().urlconf_module
File "D:\coding\virtual_env\env2\lib\site-packages\django\utils\functional.py", line 80, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "D:\coding\virtual_env\env2\lib\site-packages\django\urls\resolvers.py", line 564, in urlconf_module
return import_module(self.urlconf_name)
File "D:\coding\virtual_env\env2\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
Exception in thread Thread-1:
Traceback (most recent call last):
File "D:\coding\virtual_env\env2\lib\site-packages\django\template\utils.py", line 66, in __getitem__
return self._engines[alias]
KeyError: 'django'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "d:\coding\appz\python 3_7_2_64bit\Lib\threading.py", line 917, in _bootstrap_inner
self.run()
File "d:\coding\appz\python 3_7_2_64bit\Lib\threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "D:\coding\virtual_env\env2\lib\site-packages\django\utils\autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "D:\coding\virtual_env\env2\lib\site-packages\django\core\management\commands\runserver.py", line 117, in inner_run
self.check(display_num_errors=True)
File "D:\coding\virtual_env\env2\lib\site-packages\django\core\management\base.py", line 390, in check
include_deployment_checks=include_deployment_checks,
File "D:\coding\virtual_env\env2\lib\site-packages\django\core\management\base.py", line 377, in _run_checks
return checks.run_checks(**kwargs)
File "D:\coding\virtual_env\env2\lib\site-packages\django\core\checks\registry.py", line 72, in run_checks
new_errors = check(app_configs=app_configs)
File "D:\coding\virtual_env\env2\lib\site-packages\django\contrib\admin\checks.py", line 80, in check_dependencies
for engine in engines.all():
File "D:\coding\virtual_env\env2\lib\site-packages\django\template\utils.py", line 90, in all
return [self[alias] for alias in self]
File "D:\coding\virtual_env\env2\lib\site-packages\django\template\utils.py", line 90, in <listcomp>
return [self[alias] for alias in self]
File "D:\coding\virtual_env\env2\lib\site-packages\django\template\utils.py", line 81, in __getitem__
engine = engine_cls(params)
File "D:\coding\virtual_env\env2\lib\site-packages\django\template\backends\django.py", line 25, in __init__
options['libraries'] = self.get_templatetag_libraries(libraries)
File "D:\coding\virtual_env\env2\lib\site-packages\django\template\backends\django.py", line 43, in get_templatetag_libraries
libraries = get_installed_libraries()
File "D:\coding\virtual_env\env2\lib\site-packages\django\template\backends\django.py", line 108, in get_installed_libraries
for name in get_package_libraries(pkg):
File "D:\coding\virtual_env\env2\lib\site-packages\django\template\backends\django.py", line 121, in get_package_libraries
module = import_module(entry[1])
File "D:\coding\virtual_env\env2\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "D:\coding\virtual_env\env2\lib\site-packages\rest_framework\templatetags\rest_framework.py", line 15, in <module>
from rest_framework.renderers import HTMLFormRenderer
File "D:\coding\virtual_env\env2\lib\site-packages\rest_framework\renderers.py", line 20, in <module>
from django.test.client import encode_multipart
File "D:\coding\virtual_env\env2\lib\site-packages\django\test\client.py", line 23, in <module>
from django.test import signals
File "<frozen importlib._bootstrap>", line 980, in _find_and_load
File "<frozen importlib._bootstrap>", line 149, in __enter__
File "<frozen importlib._bootstrap>", line 94, in acquire
_frozen_importlib._DeadlockError: deadlock detected by _ModuleLock('django.test.signals') at 2019111034216
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "D:\coding\Webprojects\phone\phone\urls.py", line 27, in <module>
path('data/', include('dataout.urls', namespace='data_home')),
File "D:\coding\virtual_env\env2\lib\site-packages\django\urls\conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "D:\coding\virtual_env\env2\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "D:\coding\Webprojects\phone\dataout\urls.py", line 2, in <module>
from rest_framework.urlpatterns import format_suffix_patterns
File "D:\coding\virtual_env\env2\lib\site-packages\rest_framework\urlpatterns.py", line 8, in <module>
from rest_framework.settings import api_settings
File "D:\coding\virtual_env\env2\lib\site-packages\rest_framework\settings.py", line 26, in <module>
from django.test.signals import setting_changed
File "D:\coding\virtual_env\env2\lib\site-packages\django\test\__init__.py", line 3, in <module>
from django.test.client import Client, RequestFactory
ImportError: cannot import name 'Client' from 'django.test.client' (D:\coding\virtual_env\env2\lib\site-packages\django\test\client.py)
I am using postgres with Django and one of the fields in the model should be an Array. When I was trying to use it I was recommended that I use "django_postgres_extensions" so I ran "pip install django_postgres_extensions" and even added 'django_postgres_extensions' to INSTALLED_APPS to settings.py.
from django_postgres_extensions.models.fields import ArrayField
from django.conf import settings
from django.db import models
class Wanted(models.Model):
firstName = models.CharField(max_length=255, null=False, blank=False, default="default")
lastName = models.CharField(max_length=255, null=False, blank=False, default="default")
encodings = ArrayField(models.IntegerField(), default=[], form_size=10, blank=True)
photo = models.ImageField(upload_to="wanted/", null=True, blank=True)
Each time I run "python manage.py runserver", I get the following error:
Watching for file changes with StatReloader
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Users\Kyoko\AppData\Local\Programs\Python\Python36-32\lib\threading.py", line 916, in _bootstrap_inner
self.run()
File "C:\Users\Kyoko\AppData\Local\Programs\Python\Python36-32\lib\threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\Kyoko\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "C:\Users\Kyoko\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\commands\runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "C:\Users\Kyoko\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py", line 77, in raise_last_exception
raise _exception[0](_exception[1]).with_traceback(_exception[2])
File "C:\Users\Kyoko\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "C:\Users\Kyoko\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\Kyoko\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\apps\registry.py", line 114, in populate
app_config.import_models()
File "C:\Users\Kyoko\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\apps\config.py", line 211, in import_models
self.models_module = import_module(models_module_name)
File "C:\Users\Kyoko\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\Kyoko\Desktop\KYOKO\Work\Talan\GitProject\IBCS\server\src\models\models.py", line 80, in <module>
class Wanted(models.Model):
File "C:\Users\Kyoko\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\models\base.py", line 156, in __new__
new_class.add_to_class(obj_name, obj)
File "C:\Users\Kyoko\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\models\base.py", line 321, in add_to_class
value.contribute_to_class(cls, name)
File "C:\Users\Kyoko\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\models\fields\__init__.py", line 733, in contribute_to_class
self.set_attributes_from_name(name)
File "C:\Users\Kyoko\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\contrib\postgres\fields\array.py", line 76, in set_attributes_from_name
self.base_field.set_attributes_from_name(name)
TypeError: set_attributes_from_name() missing 1 required positional argument: 'name'
Traceback (most recent call last):
File "C:\Users\Kyoko\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\apps\registry.py", line 155, in get_app_config
return self.app_configs[app_label]
KeyError: 'admin'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\Kyoko\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
utility.execute()
File "C:\Users\Kyoko\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\Kyoko\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\Kyoko\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\commands\runserver.py", line 60, in execute
super().execute(*args, **options)
File "C:\Users\Kyoko\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py", line 364, in execute
output = self.handle(*args, **options)
File "C:\Users\Kyoko\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\commands\runserver.py", line 95, in handle
self.run(**options)
File "C:\Users\Kyoko\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\commands\runserver.py", line 102, in run
autoreload.run_with_reloader(self.inner_run, **options)
File "C:\Users\Kyoko\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py", line 579, in run_with_reloader
start_django(reloader, main_func, *args, **kwargs)
File "C:\Users\Kyoko\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py", line 564, in start_django
reloader.run(django_main_thread)
File "C:\Users\Kyoko\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py", line 272, in run
get_resolver().urlconf_module
File "C:\Users\Kyoko\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py", line 80, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\Kyoko\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py", line 564, in urlconf_module
return import_module(self.urlconf_name)
File "C:\Users\Kyoko\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\Kyoko\Desktop\KYOKO\Work\Talan\GitProject\IBCS\server\src\IBCS\urls.py", line 7, in <module>
path('admin/', admin.site.urls),
File "C:\Users\Kyoko\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py", line 256, in inner
self._setup()
File "C:\Users\Kyoko\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\contrib\admin\sites.py", line 529, in _setup
AdminSiteClass = import_string(apps.get_app_config('admin').default_site)
File "C:\Users\Kyoko\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\apps\registry.py", line 162, in get_app_config
raise LookupError(message)
LookupError: No installed app with label 'admin'.
Edit: INSTALLED_APPS:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.postgres',
'django_postgres_extensions',
'rest_framework',
'corsheaders',
'models',
'identity',
'agents',
'admincp',
]