I was trying to get Selenium to work, and so followed the suggestion here to brew install geckodriver in the relevant virtual environment (pipenv). After having done that, my other virtual environments stopped working.
I was able to get most of them to work again by re-installing pipenv outside of any virtual environment (using pip3 install pipenv).
But all of my Django projects that rely on Postgres still don't work: I'm able to start their virtual environment (with pipenv shell), but python manage.py runserver gives me the following traceback:
Watching for file changes with StatReloader
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/local/opt/python#3.8/Frameworks/Python.framework/Versions/3.8/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/local/opt/python#3.8/Frameworks/Python.framework/Versions/3.8/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/utils/autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/utils/autoreload.py", line 77, in raise_last_exception
raise _exception[0](_exception[1]).with_traceback(_exception[2])
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/utils/autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/apps/registry.py", line 114, in populate
app_config.import_models()
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/apps/config.py", line 211, in import_models
self.models_module = import_module(models_module_name)
File "/usr/local/opt/python#3.8/Frameworks/Python.framework/Versions/3.8/lib/python3.8/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 "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/contrib/auth/models.py", line 2, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/contrib/auth/base_user.py", line 47, in <module>
class AbstractBaseUser(models.Model):
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/db/models/base.py", line 117, in __new__
new_class.add_to_class('_meta', Options(meta, app_label))
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/db/models/base.py", line 321, in add_to_class
value.contribute_to_class(cls, name)
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/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 "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/db/__init__.py", line 28, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/db/utils.py", line 201, in __getitem__
backend = load_backend(db['ENGINE'])
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/db/utils.py", line 110, in load_backend
return import_module('%s.base' % backend_name)
File "/usr/local/opt/python#3.8/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/db/backends/postgresql/base.py", line 24, in <module>
raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: dlopen(/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/psycopg2/_psycopg.cpython-38-darwin.so, 2): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
Referenced from: /usr/local/opt/postgresql/lib/libpq.5.dylib
Reason: image not found
Traceback (most recent call last):
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/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 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/core/management/base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 60, in execute
super().execute(*args, **options)
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/core/management/base.py", line 364, in execute
output = self.handle(*args, **options)
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 95, in handle
self.run(**options)
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 102, in run
autoreload.run_with_reloader(self.inner_run, **options)
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/utils/autoreload.py", line 579, in run_with_reloader
start_django(reloader, main_func, *args, **kwargs)
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/utils/autoreload.py", line 564, in start_django
reloader.run(django_main_thread)
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/utils/autoreload.py", line 272, in run
get_resolver().urlconf_module
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/utils/functional.py", line 80, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/urls/resolvers.py", line 564, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/local/opt/python#3.8/Frameworks/Python.framework/Versions/3.8/lib/python3.8/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 "/Users/my_last_name/Django/pred_market_pg_copy/pm_project/urls.py", line 7, in <module>
path('mp/', admin.site.urls),
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/utils/functional.py", line 256, in inner
self._setup()
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/contrib/admin/sites.py", line 529, in _setup
AdminSiteClass = import_string(apps.get_app_config('admin').default_site)
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/apps/registry.py", line 162, in get_app_config
raise LookupError(message)
LookupError: No installed app with label 'admin'.
I have 'django.contrib.admin' among my INSTALLED_APPS. And, again, everything was working just fine prior to my geckodriver adventure.
Re-installing psycopg2 with pipenv install psycopg2 doesn't solve it. I've also tried uninstalling psycopg2, but when I then try to install it again, I get Locking Failed.
Any advice here on what's going on would be appreciated.
Related
In my Windows10 ,
I have installed mysqlclient in my venv ( I checked the path venv\Lib\sitepackages found mysqlclient-1.4.6.dist-info\).
however, when I use command to runserver:
>python3 manage.py runserver
get Did you install mysqlclient? error,
details:
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "D:\Users\80361576\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\backends\mysql\base.py", line 15, in <module>
import MySQLdb as Database
ModuleNotFoundError: No module named 'MySQLdb'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "D:\Users\80361576\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 926, in _bootstrap_inner
self.run()
File "D:\Users\80361576\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "D:\Users\80361576\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\utils\autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "D:\Users\80361576\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\commands\runserver.py", line 109,
in inner_run
autoreload.raise_last_exception()
File "D:\Users\80361576\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\utils\autoreload.py", line 77, in raise_last_excep
tion
raise _exception[1]
File "D:\Users\80361576\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\__init__.py", line 337, in execute
autoreload.check_errors(django.setup)()
File "D:\Users\80361576\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\utils\autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "D:\Users\80361576\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "D:\Users\80361576\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\apps\registry.py", line 114, in populate
app_config.import_models()
File "D:\Users\80361576\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\apps\config.py", line 211, in import_models
self.models_module = import_module(models_module_name)
File "D:\Users\80361576\AppData\Local\Programs\Python\Python37-32\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:\Users\80361576\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\contrib\auth\models.py", line 2, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "D:\Users\80361576\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\contrib\auth\base_user.py", line 47, in <module>
class AbstractBaseUser(models.Model):
File "D:\Users\80361576\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\models\base.py", line 117, in __new__
new_class.add_to_class('_meta', Options(meta, app_label))
File "D:\Users\80361576\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\models\base.py", line 321, in add_to_class
value.contribute_to_class(cls, name)
File "D:\Users\80361576\AppData\Local\Programs\Python\Python37-32\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 "D:\Users\80361576\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\__init__.py", line 28, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "D:\Users\80361576\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\utils.py", line 201, in __getitem__
backend = load_backend(db['ENGINE'])
File "D:\Users\80361576\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\utils.py", line 110, in load_backend
return import_module('%s.base' % backend_name)
File "D:\Users\80361576\AppData\Local\Programs\Python\Python37-32\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "D:\Users\80361576\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\backends\mysql\base.py", line 20, in <module>
) from err
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
Did you install mysqlclient?
environment version:
Windows 10
Python 3.7.8
Django 2.2.12
mysqlclient 1.4.6
I have a Django app (with a postgres database) running in a virtual environment. Everything has been working on my localhost until a few days ago when I got an error saying my SSL certificate had expired (localhost:8000). Today, when I tried the python manage.py runserver command I got an error saying psycopg2 was not installed. I know it was because I have been using this app for the last nine months! Anyway, I reinstalled psycopg2 and tried the runserver command again. This time I got the following error message:
$ python manage.py runserver
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\threading.py", line 954, in _bootstrap_inner
self.run()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\threading.py", line 892, in run
self._target(*self._args, **self._kwargs)
File "E:\coding\registrations\lib\site-packages\django\utils\autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "E:\coding\registrations\lib\site-packages\django\core\management\commands\runserver.py", line 110, in inner_run
autoreload.raise_last_exception()
File "E:\coding\registrations\lib\site-packages\django\utils\autoreload.py", line 76, in raise_last_exception
raise _exception[1]
File "E:\coding\registrations\lib\site-packages\django\core\management\__init__.py", line 357, in execute
autoreload.check_errors(django.setup)()
File "E:\coding\registrations\lib\site-packages\django\utils\autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "E:\coding\registrations\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "E:\coding\registrations\lib\site-packages\django\apps\registry.py", line 114, in populate
app_config.import_models()
File "E:\coding\registrations\lib\site-packages\django\apps\config.py", line 211, in import_models
self.models_module = import_module(models_module_name)
File "C:\Users\Administrator\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 "E:\coding\registrations\lib\site-packages\django\contrib\auth\models.py", line 90, in <module>
class Group(models.Model):
File "E:\coding\registrations\lib\site-packages\django\db\models\base.py", line 161, in __new__
new_class.add_to_class(obj_name, obj)
File "E:\coding\registrations\lib\site-packages\django\db\models\base.py", line 326, in add_to_class
value.contribute_to_class(cls, name)
File "E:\coding\registrations\lib\site-packages\django\db\models\fields\related.py", line 1637, in contribute_to_class
self.remote_field.through = create_many_to_many_intermediary_model(self, cls)
File "E:\coding\registrations\lib\site-packages\django\db\models\fields\related.py", line 1099, in create_many_to_many_intermediary_model
'verbose_name': _('%(from)s-%(to)s relationship') % {'from': from_, 'to': to},
File "E:\coding\registrations\lib\site-packages\django\utils\functional.py", line 176, in __mod__
return str(self) % rhs
File "E:\coding\registrations\lib\site-packages\django\utils\functional.py", line 140, in __text_cast
return func(*self.__args, **self.__kw)
File "E:\coding\registrations\lib\site-packages\django\utils\translation\__init__.py", line 94, in gettext
return _trans.gettext(message)
File "E:\coding\registrations\lib\site-packages\django\utils\translation\trans_real.py", line 355, in gettext
_default = _default or translation(settings.LANGUAGE_CODE)
File "E:\coding\registrations\lib\site-packages\django\utils\translation\trans_real.py", line 268, in translation
_translations[language] = DjangoTranslation(language)
File "E:\coding\registrations\lib\site-packages\django\utils\translation\trans_real.py", line 160, in __init__
raise OSError('No translation files found for default language %s.' % settings.LANGUAGE_CODE)
OSError: No translation files found for default language en-gb.
Any ideas on what may be happening here? As I said, everything was working well until a few days ago, then the gremlins got in.
I am using the DJango framework. I created a project in school using Pycharm and I wanted to create another project. However, when trying to run my server, all of the sudden I start to get the following error in my command prompt:
Watching for file changes with StatReloader
Performing system checks...
Exception in thread django-main-thread:
Traceback (most recent call last):
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\utils\autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\management\commands\runserver.py", line 118, in inner_run
self.check(display_num_errors=True)
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\management\base.py", line 392, in check
all_issues = checks.run_checks(
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\checks\registry.py", line 70, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\checks\urls.py", line 40, in check_url_namespaces_unique
all_namespaces = _load_all_namespaces(resolver)
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\checks\urls.py", line 57, in _load_all_namespaces
url_patterns = getattr(resolver, 'url_patterns', [])
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\utils\functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\urls\resolvers.py", line 589, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\utils\functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\urls\resolvers.py", line 582, in urlconf_module
return import_module(self.urlconf_name)
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\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\Johnny\PycharmProjects\DJango Tutorial V2\mysite\mysite\urls.py", line 20, in <module>
path('polls/', include('polls.url')),
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\urls\conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\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 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'polls.url'
Traceback (most recent call last):
File "manage.py", line 22, in <module>
main()
File "manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
utility.execute()
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\management\__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\management\base.py", line 330, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\management\commands\runserver.py", line 61, in execute
super().execute(*args, **options)
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\management\base.py", line 371, in execute
output = self.handle(*args, **options)
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\management\commands\runserver.py", line 96, in handle
self.run(**options)
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\management\commands\runserver.py", line 103, in run
autoreload.run_with_reloader(self.inner_run, **options)
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\utils\autoreload.py", line 613, in run_with_reloader
start_django(reloader, main_func, *args, **kwargs)
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\utils\autoreload.py", line 598, in start_django
reloader.run(django_main_thread)
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\utils\autoreload.py", line 313, in run
self.run_loop()
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\utils\autoreload.py", line 319, in run_loop
next(ticker)
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\utils\autoreload.py", line 359, in tick
for filepath, mtime in self.snapshot_files():
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\utils\autoreload.py", line 375, in snapshot_files
for file in self.watched_files():
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\utils\autoreload.py", line 274, in watched_files
yield from iter_all_python_module_files()
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\utils\autoreload.py", line 105, in iter_all_python_module_files
return iter_modules_and_files(modules, frozenset(_error_files))
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\utils\autoreload.py", line 141, in iter_modules_and_files
resolved_path = path.resolve(strict=True).absolute()
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\pathlib.py", line 1177, in resolve
s = self._flavour.resolve(self, strict=strict)
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\pathlib.py", line 200, in resolve
return self._ext_to_normal(_getfinalpathname(s))
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: '<frozen importlib._bootstrap>'
In my past project, I did have bootstrap installed but now I am not using it. I am also using a different python project interpreter. Why is it not working?
EDIT: Here is the error printed out:
C:\Users\Johnny\PycharmProjects\DJango Tutorial V2\mysite>python manage.py makemigrations
Traceback (most recent call last):
File "manage.py", line 22, in <module>
main()
File "manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
utility.execute()
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\management\__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\management\base.py", line 330, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\management\base.py", line 368, in execute
self.check()
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\management\base.py", line 392, in check
all_issues = checks.run_checks(
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\checks\registry.py", line 70, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\checks\urls.py", line 40, in check_url_namespaces_unique
all_namespaces = _load_all_namespaces(resolver)
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\checks\urls.py", line 57, in _load_all_namespaces
url_patterns = getattr(resolver, 'url_patterns', [])
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\utils\functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\urls\resolvers.py", line 589, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\utils\functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\urls\resolvers.py", line 582, in urlconf_module
return import_module(self.urlconf_name)
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\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\Johnny\PycharmProjects\DJango Tutorial V2\mysite\mysite\urls.py", line 20, in <module>
path('polls/', include('polls.url')),
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\lib\site-packages\django\urls\conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "C:\Users\Johnny\AppData\Local\Programs\Python\Python38\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 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'polls.url'
First of all check if you have incorrect file names for apps in INSTALLED APPS in settings.py. Your app should be sthg like:
INSTALLED_APPS = [
'home.apps.HomeConfig' # or simply 'home' assuming all your app name,
......
]
Then, restart the server, if everything is good and still does not work.
In some cases the error is also shown because of migration. Try making migrations. Like:
python manage.py makemigrations
python manage.py migrate
You should be good to go by now.
Found it. Instead of polls.url, I wrote poll.url inside the url.py for the mysite package. Watch your spelling!
In my case, it was some corrupted migrations file. I deleted it and ran migrations afresh.
My folder in App was url.py
and in project setting i was writing path('', include('loginaccounts.urls')).
In path when I changed to url from urls it worked as it was not able to map the path.
So I'm trying to run my development server using the command "python manage.py runserver"
But whenever I try to run it, it gives me this error;
Watching for file changes with StatReloader
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\threading.py", line 916, in _bootstrap_inner
self.run()
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "C:\Users\Kasutaja\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\Kasutaja\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\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\apps\registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\apps\config.py", line 90, in create
module = import_module(entry)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py", line 125, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 948, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'django_countries'
Traceback (most recent call last):
File "C:\Users\Kasutaja\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\Kasutaja\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\Kasutaja\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\Kasutaja\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\Kasutaja\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\Kasutaja\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\Kasutaja\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\Kasutaja\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\Kasutaja\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\Kasutaja\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\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py", line 272, in run
get_resolver().urlconf_module
File "C:\Users\Kasutaja\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\Kasutaja\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\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py", line 125, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "F:\Users\Kasutaja\Documents\Veebipood v4\django-ecommerce\djecommerce\urls.py",
line 6, in <module>
path('admin/', admin.site.urls),
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py", line 256, in inner
self._setup()
File "C:\Users\Kasutaja\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\Kasutaja\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'.
I have tried searching for solutions to this problem but nothing seems to be working. There seems to also be a weird issue with django-countries. Whenever I try installing it, it says;
Collecting django-countries
Using cached django-countries-6.0.tar.gz (617 kB)
WARNING: Generating metadata for package django-countries produced metadata for project name unknown. Fix your #egg=django-countries fragments.
Requirement already satisfied (use --upgrade to upgrade): unknown from https://files.pythonhosted.org/packages/6d/7a/4046a82f6f0c7d00ad24b3a4fc30d10c562949bb6cd40ef7f3051ed7e2bc/django-countries-6.0.tar.gz#sha256=cca351f304d18187b6200e1aae381c2902045c33aea5f4da58fd74685b7cd4fc in c:\users\kasutaja\appdata\local\programs\python\python36-32\lib\site-packages
The weird thing with this is, that whenever I try to run "python manage.py makemigrations", it says;
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\Kasutaja\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\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\__init__.py", line 357, in execute
django.setup()
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\apps\registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\apps\config.py", line 90, in create
module = import_module(entry)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py", line 125, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 948, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'django_countries'
Does anyone know how to fix this?
Thanks in advance,
Nimetu.
Ok, figured it out. Just putting this out there just incase anyone has the same issue. If your project has a requirements.txt file (if it doesn't make one) and add (If you want to use django-countries)
django-countries==5.3.3
To it, you can also use the latest version but I chose to use version 5.3.3 in this case. After that run the command
pip install -r requirements.txt
I'm getting DLL load failed when I try to run python manage.py runserver. It hapeens when I cd haddygirl and then run the previous command.
C:\Users\Lazxy\haddygirl>python manage.py runserver
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "C:\Users\Lazxy\Anaconda3\lib\threading.py", line 917, in _bootstrap_inner
self.run()
File "C:\Users\Lazxy\Anaconda3\lib\threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\Lazxy\Anaconda3\lib\site-packages\django\utils\autoreload.py", line 54, in
wrapper
fn(*args, **kwargs)
File "C:\Users\Lazxy\Anaconda3\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\Lazxy\Anaconda3\lib\site-packages\django\apps\registry.py", line 114, in populate
app_config.import_models()
File "C:\Users\Lazxy\Anaconda3\lib\site-packages\django\apps\config.py", line 211, in
import_models
self.models_module = import_module(models_module_name)
File "C:\Users\Lazxy\Anaconda3\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\Lazxy\Anaconda3\lib\site-packages\django\contrib\auth\models.py", line 2, in
<module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "C:\Users\Lazxy\Anaconda3\lib\site-packages\django\contrib\auth\base_user.py", line 47, in
<module>
class AbstractBaseUser(models.Model):
File "C:\Users\Lazxy\Anaconda3\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\Lazxy\Anaconda3\lib\site-packages\django\db\models\base.py", line 321, in
add_to_class
value.contribute_to_class(cls, name)
File "C:\Users\Lazxy\Anaconda3\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\Lazxy\Anaconda3\lib\site-packages\django\db\__init__.py", line 28, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "C:\Users\Lazxy\Anaconda3\lib\site-packages\django\db\utils.py", line 201, in __getitem__
backend = load_backend(db['ENGINE'])
File "C:\Users\Lazxy\Anaconda3\lib\site-packages\django\db\utils.py", line 110, in load_backend
return import_module('%s.base' % backend_name)
File "C:\Users\Lazxy\Anaconda3\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "C:\Users\Lazxy\Anaconda3\lib\site-packages\django\db\backends\sqlite3\base.py", line 13,
in <module>
from sqlite3 import dbapi2 as Database
File "C:\Users\Lazxy\Anaconda3\lib\sqlite3\__init__.py", line 23, in <module>
from sqlite3.dbapi2 import *
File "C:\Users\Lazxy\Anaconda3\lib\sqlite3\dbapi2.py", line 27, in <module>
from _sqlite3 import *
The error:
ImportError: DLL load failed: The specified module could not be found.
please help.
Seems that the driver for connect to sqlite are not found by the python installation.
Please share your python version. After Python 2.7.5 sqlite3 is shipped as a builtin dependencies.
Have a try with:
Use the builtin sqlite3
Install for python2
pip install pysqlite
Install for python3
pip install pysqlite3