I am creating a Django website. I was recently using the management command runserver_plus provided by Django Extensions to run the development server. When I attempt to run the website through terminal I receive the error message:
C:\Users\Hp\anaconda3\DJANGO\website> python manage.py runserver_plus --cert-file
cert.crt
Traceback (most recent call last):
File "manage.py", line 22, in <module>
main()
File "manage.py", line 18, in main
File "C:\Users\Hp\anaconda3\lib\site-packages\django\core\management\__init__.py", line
446, in execute_from_command_line
utility.execute()
File "C:\Users\Hp\anaconda3\lib\site-packages\django\core\management\__init__.py", line
440, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\Hp\anaconda3\lib\site-packages\django\core\management\__init__.py", line
279, in fetch_command
klass = load_command_class(app_name, subcommand)
File "C:\Users\Hp\anaconda3\lib\site-packages\django\core\management\__init__.py", line
48, in load_command_class
module = import_module("%s.management.commands.%s" % (app_name, name))
File "C:\Users\Hp\anaconda3\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\Hp\anaconda3\lib\site-
packages\django_extensions\management\commands\runserver_plus.py", line 40, in <module>
from django_extensions.management.utils import RedirectHandler, has_ipdb, setup_logger,
signalcommand
File "C:\Users\Hp\anaconda3\lib\site-packages\django_extensions\management\utils.py",
line 6, in <module>
from django_extensions.management.signals import post_command, pre_command
File "C:\Users\Hp\anaconda3\lib\site-packages\django_extensions\management\signals.py",
line 13, in <module>
pre_command = Signal(providing_args=["args", "kwargs"])
TypeError: __init__() got an unexpected keyword argument 'providing_args'
As you can see on the PyPi page for django-extensions, the highest Django version it supports is 3.2. The providing_args argument for django.dispatch.Signal was removed in Django 4.0, and based on your error you seem to be using that version or later.
Related
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.
Every Django project that I'm trying from git is showing the same error. Although I install all the requirements it is still showing error while I try to run the server.
This is the command which I try to execute:
And this is the final error:
And here is the error.
G:\Study\Python\Django Project\Airline-reservation-django-master>py manage.py makemigration
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\vivek\Python\Python38-32\lib\site-packages\django\core\management\__init__.py", line 367, in execute_from_command_line
utility.execute()
File "C:\Users\vivek\Python\Python38-32\lib\site-packages\django\core\management\__init__.py", line 341, in execute
django.setup()
File "C:\Users\vivek\Python\Python38-32\lib\site-packages\django\__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\vivek\Python\Python38-32\lib\site-packages\django\apps\registry.py", line 108, in populate
app_config.import_models(all_models)
File "C:\Users\vivek\Python\Python38-32\lib\site-packages\django\apps\config.py", line 199, in import_models
self.models_module = import_module(models_module_name)
File "C:\Users\vivek\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 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 "G:\Study\Python\Django Project\Airline-reservation-django-master\Airline\models.py", line 2, in <module>
from django.contrib.auth.models import User
File "C:\Users\vivek\Python\Python38-32\lib\site-packages\django\contrib\auth\models.py", line 4, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "C:\Users\vivek\Python\Python38-32\lib\site-packages\django\contrib\auth\base_user.py", line 52, in <module>
class AbstractBaseUser(models.Model):
RuntimeError: __class__ not set defining 'AbstractBaseUser' as <class 'django.contrib.auth.base_user.AbstractBaseUser'>. Was __classcell__ propagat
ed to type.__new__?
it is because it provide its own virtual environment and in that environment not all the requirements install try to install all the requirements again to solve this problem from pycharm
the only thing you have to do is you have to specify your python interpreter and install your require software on that
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
I want to translate content of my models fields with django-modeltranslation.
When i run one of these:
python manage.py makemigrations
python manage.py runserver
I get ImportError: cannot import name 'Constraint'
Here is the traceback of the 'makemigrations'
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/mat/Desktop/python/pmm/venv/lib/python3.4/site-packages/django/core/management/__init__.py", line 350, in execute_from_command_line
utility.execute()
File "/home/mat/Desktop/python/pmm/venv/lib/python3.4/site-packages/django/core/management/__init__.py", line 324, in execute
django.setup()
File "/home/mat/Desktop/python/pmm/venv/lib/python3.4/site-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/mat/Desktop/python/pmm/venv/lib/python3.4/site-packages/django/apps/registry.py", line 115, in populate
app_config.ready()
File "/home/mat/Desktop/python/pmm/venv/lib/python3.4/site-packages/django/contrib/admin/apps.py", line 22, in ready
self.module.autodiscover()
File "/home/mat/Desktop/python/pmm/venv/lib/python3.4/site-packages/django/contrib/admin/__init__.py", line 26, in autodiscover
autodiscover_modules('admin', register_to=site)
File "/home/mat/Desktop/python/pmm/venv/lib/python3.4/site-packages/django/utils/module_loading.py", line 50, in autodiscover_modules
import_module('%s.%s' % (app_config.name, module_to_search))
File "/home/mat/Desktop/python/pmm/venv/lib/python3.4/importlib/__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "<frozen importlib._bootstrap>", line 1471, in exec_module
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "/home/mat/Desktop/python/pmm/venv/lib/python3.4/site-packages/modeltranslation/admin.py", line 20, in <module>
from modeltranslation.translator import translator
File "/home/mat/Desktop/python/pmm/venv/lib/python3.4/site-packages/modeltranslation/translator.py", line 12, in <module>
from modeltranslation.manager import (MultilingualManager, MultilingualQuerysetManager,
File "/home/mat/Desktop/python/pmm/venv/lib/python3.4/site-packages/modeltranslation/manager.py", line 19, in <module>
from django.db.models.sql.where import Constraint
ImportError: cannot import name 'Constraint'
I use django1.9 and the latest django-modeltranslation.
If you cant help me with error, please recommand any other model translation app.
I have came across some of them:
django-multilingual-ds9
django-dbgettext
django-transmeta
But they seem to be no longer supported. Do you know if any of these works , or do you know about any other working solution ?
If that matters i have to admit i use django-rosette
I found other app for model translation, django-hvad.
Works like a charm, have full django1.9 support, is easy to implement and is translator-friendly.
Are you sure you are using the latest django-modeltranslation? The issue was reported a while ago (https://github.com/deschler/django-modeltranslation/issues/349) and already fixed in version 0.11rc1 (https://pypi.python.org/pypi/django-modeltranslation/0.11rc1).
Okay, Im trying to use cryptoassets.django here. Iv got some help from Mikko about the python version being an issue(I was using 2.7.x, cryptoassets uses 3.4.x). I just solved by doing this
$virtualenv -p python3 venv
I also reinstalled Django because manage.py was pulling up error, probably because it was overwriting the bin/activate.. files.
With that out of the way. I installed the cryptoassets.django app
$pip3 install cryptoassets.django
Wonderfull. I set it up like the tutorial on bitbucket for the cryptoassets django intergration.
The problem comes in when i try to initialize the cryptoasset database with
$python manage.py cryptoassets_initialize_database
I get an Import error:
ImportError: No module named 'zope'
Here is the Traceback
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/caleb/Desktop/bitkoin/lib/python3.4/site- packages/django/core/management/__init__.py", line 351, in execute_from_command_line
utility.execute()
File "/home/caleb/Desktop/bitkoin/lib/python3.4/site-packages/django/core/management/__init__.py", line 343, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/caleb/Desktop/bitkoin/lib/python3.4/site-packages/django/core/management/__init__.py", line 190, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/home/caleb/Desktop/bitkoin/lib/python3.4/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/caleb/Desktop/bitkoin/lib/python3.4/importlib/__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "<frozen importlib._bootstrap>", line 1471, in exec_module
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "/home/caleb/Desktop/bitkoin/lib/python3.4/site-packages/cryptoassets/django/management/commands/cryptoassets_initialize_database.py", line 5, in <module>
from cryptoassets.core.service.main import Service
File "/home/caleb/Desktop/bitkoin/lib/python3.4/site-packages/cryptoassets/core/service/main.py", line 25, in <module>
from ..configure import Configurator
File "/home/caleb/Desktop/bitkoin/lib/python3.4/site-packages/cryptoassets/core/configure.py", line 13, in <module>
from zope.dottedname.resolve import resolve
ImportError: No module named 'zope'
What could be the issue now.
Cryptoassets is Python 3.4+ only and you are trying to run it on Python 2.