Cannot import name 'update_contenttypes - python

manage.py runserver_plus 0.0.0.0.80
Traceback (most recent call last):
File "manage.py", line 60, in <module>
execute_from_command_line(sys.argv)
File "/home/ubuntu/.local/lib/python3.6/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
utility.execute()
File "/home/ubuntu/.local/lib/python3.6/site-packages/django/core/management/__init__.py", line 341, in execute
django.setup()
File "/home/ubuntu/.local/lib/python3.6/site-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/ubuntu/.local/lib/python3.6/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/home/ubuntu/.local/lib/python3.6/site-packages/django/apps/config.py", line 116, in create
mod = import_module(mod_path)
File "/usr/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/ubuntu/.local/lib/python3.6/site-packages/django/contrib/contenttypes/apps.py", line 7, in <module>
from .management import (
ImportError: cannot import name 'update_contenttypes'

Related

Django throwing a ValueError: source code string cannot contain null bytes

The whole error is quite huge :
Traceback (most recent call last):
File "C:\Users\FiercePC\IdeaProjects\RadioShazam\server\ServerDjango\manage.py", line 22, in <module>
main()
File "C:\Users\FiercePC\IdeaProjects\RadioShazam\server\ServerDjango\manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\FiercePC\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\__init__.py", line 419, in execute_from_command_line
utility.execute()
File "C:\Users\FiercePC\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\__init__.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\FiercePC\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\__init__.py", line 257, in fetch_command
klass = load_command_class(app_name, subcommand)
File "C:\Users\FiercePC\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\__init__.py", line 39, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "C:\Users\FiercePC\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 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "C:\Users\FiercePC\AppData\Local\Programs\Python\Python39\lib\site-packages\django\contrib\staticfiles\management\commands\runserver.py", line 3, in <module>
from django.core.management.commands.runserver import (
File "C:\Users\FiercePC\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\commands\runserver.py", line 10, in <module>
from django.core.servers.basehttp import (
File "C:\Users\FiercePC\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\servers\basehttp.py", line 14, in <module>
from wsgiref import simple_server
ValueError: source code string cannot contain null bytes`
I just generated the project and didn't do almost anything. The program works on my computer but not on my friend's. We have the same versions of python/django etc.

Django - After installing "Bootstrap4" with pip, got syntax error on settings.py

After installing "Bootstrap4" using pip, add tags in html files, and adding it in requirements.txt and settings.py, do migrate but it shows this:
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\Mehrab\menv\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
utility.execute()
File "C:\Users\Mehrab\menv\lib\site-packages\django\core\management\__init__.py", line 345, in execute
settings.INSTALLED_APPS
File "C:\Users\Mehrab\menv\lib\site-packages\django\conf\__init__.py", line 83, in __getattr__
self._setup(name)
File "C:\Users\Mehrab\menv\lib\site-packages\django\conf\__init__.py", line 70, in _setup
self._wrapped = Settings(settings_module)
File "C:\Users\Mehrab\menv\lib\site-packages\django\conf\__init__.py", line 177, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1776.0_x64__qbz5n2kfra8p0\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 779, in exec_module
File "<frozen importlib._bootstrap_external>", line 916, in get_code
File "<frozen importlib._bootstrap_external>", line 846, in source_to_code
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "D:\~\socialize\settings.py", line 72
WSGI_APPLICATION = 'socialize.wsgi.application'
^
SyntaxError: invalid syntax
I didn't find any broblem in settings.py

Django --> python manage.py runserver

I had previous django project named 'bike_project'. And i had two settings module for development and production inside settings folder of bike_project.
During that project i had
set DJANGO_SETTINGS_MODULE = bike_project.settings.development in command prompt.
But now when i create new django project (seller bike), the project is created. But when i run python manage.py "command", I get following error.
D:\seller_bike>python manage.py runserver
Traceback (most recent call last):
File "C:\Users\offic\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\base.py", line 328, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\offic\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\commands\runserver.py", line 60, in execute
super().execute(*args, **options)
File "C:\Users\offic\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\base.py", line 369, in execute
output = self.handle(*args, **options)
File "C:\Users\offic\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\commands\runserver.py", line 67, in handle
if not settings.DEBUG and not settings.ALLOWED_HOSTS:
File "C:\Users\offic\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\conf\__init__.py", line 76, in __getattr__
self._setup(name)
File "C:\Users\offic\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\conf\__init__.py", line 63, in _setup
self._wrapped = Settings(settings_module)
File "C:\Users\offic\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\conf\__init__.py", line 142, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Users\offic\AppData\Local\Programs\Python\Python38-32\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 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
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 'bike_project'
During handling of the above exception, another exception occurred:
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\offic\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
utility.execute()
File "C:\Users\offic\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\offic\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\base.py", line 341, in run_from_argv
connections.close_all()
File "C:\Users\offic\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\db\utils.py", line 225, in close_all
for alias in self:
File "C:\Users\offic\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\db\utils.py", line 219, in __iter__
return iter(self.databases)
File "C:\Users\offic\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\utils\functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\offic\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\db\utils.py", line 153, in databases
self._databases = settings.DATABASES
File "C:\Users\offic\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\conf\__init__.py", line 76, in __getattr__
self._setup(name)
File "C:\Users\offic\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\conf\__init__.py", line 63, in _setup
self._wrapped = Settings(settings_module)
File "C:\Users\offic\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\conf\__init__.py", line 142, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Users\offic\AppData\Local\Programs\Python\Python38-32\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 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
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 'bike_project'

Django Attribute Error: "AttributeError: module 'django.db.models' has no attribute 'ManytoManyField' "

I am executing this line of code in my terminal:
python manage.py makemigrations
I get this as output:
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\Bryan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
utility.execute()
File "C:\Users\Bryan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\__init__.py", line 357, in execute
django.setup()
File "C:\Users\Bryan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\Bryan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\apps\registry.py", line 112, in populate
app_config.import_models()
File "C:\Users\Bryan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\apps\config.py", line 198, in import_models
self.models_module = import_module(models_module_name)
File "C:\Users\Bryan\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 "C:\Users\Bryan\Desktop\wisdompets\adoptions\models.py", line 3, in <module>
class Pet(models.Model):
File "C:\Users\Bryan\Desktop\wisdompets\adoptions\models.py", line 13, in Pet
vaccinations = models.ManytoManyField('Vaccine', blank=True)
**AttributeError: module 'django.db.models' has no attribute 'ManytoManyField'**
Can anyone let me know what I am doing wrong?
The t needs to be capitalized in the ManyToManyField portion, Also Vaccine should reference a model
if it's in a different models.py.
from [Appname].models import Vaccine
vaccinations = models.ManyToManyField(Vaccine, blank=True).

Error importing airport names using django-airport

I have installed and configured both django-cities and django-airport. But i am getting error while importing airport data via this command -
./manage.py airports
The error is -
Traceback (most recent call last):
File "./manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/home/itsd/venv/mnq_v2/lib/python3.5/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
utility.execute()
File "/home/itsd/venv/mnq_v2/lib/python3.5/site-packages/django/core/management/__init__.py", line 359, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/itsd/venv/mnq_v2/lib/python3.5/site-packages/django/core/management/__init__.py", line 208, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/home/itsd/venv/mnq_v2/lib/python3.5/site-packages/django/core/management/__init__.py", line 40, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/home/itsd/venv/mnq_v2/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 665, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/home/itsd/venv/mnq_v2/lib/python3.5/site-packages/airports/management/commands/airports.py", line 29, in <module>
class Command(BaseCommand):
File "/home/itsd/venv/mnq_v2/lib/python3.5/site-packages/airports/management/commands/airports.py", line 35, in Command
option_list = BaseCommand.option_list + (
AttributeError: type object 'BaseCommand' has no attribute 'option_list'
How can i solve this problem ?
My Django version is - 1.10.4

Categories

Resources