When I deploy the project on herokou server, while migrating, I encountered this error. While in my system, there was no such error and the project was working properly
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 "/app/.heroku/python/lib/python3.7/site-packages/django/core/management/__init__.py", line 401, i
n execute_from_command_line
utility.execute()
File "/app/.heroku/python/lib/python3.7/site-packages/django/core/management/__init__.py", line 395, i
n execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/app/.heroku/python/lib/python3.7/site-packages/django/core/management/base.py", line 328, in ru
n_from_argv
self.execute(*args, **cmd_options)
File "/app/.heroku/python/lib/python3.7/site-packages/django/core/management/base.py", line 369, in ex
ecute
output = self.handle(*args, **options)
File "/app/.heroku/python/lib/python3.7/site-packages/django/core/management/base.py", line 83, in wra
pped
res = handle_func(*args, **kwargs)
File "/app/.heroku/python/lib/python3.7/site-packages/django/core/management/commands/migrate.py", lin
e 86, in handle
executor = MigrationExecutor(connection, self.migration_progress_callback)
File "/app/.heroku/python/lib/python3.7/site-packages/django/db/migrations/executor.py", line 18, in _
_init__
self.loader = MigrationLoader(self.connection)
File "/app/.heroku/python/lib/python3.7/site-packages/django/db/migrations/loader.py", line 49, in __i
nit__
self.build_graph()
File "/app/.heroku/python/lib/python3.7/site-packages/django/db/migrations/loader.py", line 274, in bu
ild_graph
raise exc
File "/app/.heroku/python/lib/python3.7/site-packages/django/db/migrations/loader.py", line 248, in bu
ild_graph
self.graph.validate_consistency()
File "/app/.heroku/python/lib/python3.7/site-packages/django/db/migrations/graph.py", line 195, in val
idate_consistency
[n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
File "/app/.heroku/python/lib/python3.7/site-packages/django/db/migrations/graph.py", line 195, in <li
stcomp>
[n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
File "/app/.heroku/python/lib/python3.7/site-packages/django/db/migrations/graph.py", line 58, in rais
e_error
raise NodeNotFoundError(self.error_message, self.key, origin=self.origin)
django.db.migrations.exceptions.NodeNotFoundError: Migration account.0001_initial dependencies reference
nonexistent parent node ('auth', '0013_auto_20200828_2241')
Where is the problem?
It says what the error is. You have an app called "account" and the migrations for this app is looking for migration 0013_auto_20200828_2241 in 'auth" which is one of django's main migrations.
This probably means in your requirements you are using a different version of django to your local. So your local has the migration and the one you are installing on heroku does not?
Related
I seem to be getting an issue with serving running collectstatic when whitenoise is enabled. I keep getting an error about a missing file - not quite sure why.
Here is the fill traceback
Post-processing 'third/vendors/owl-carousel/assets/owl.carousel.css' failed!
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "/home/thegqvow/virtualenv/gradientboostmvp/3.7/lib/python3.7/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
utility.execute()
File "/home/thegqvow/virtualenv/gradientboostmvp/3.7/lib/python3.7/site-packages/django/core/management/__init__.py", line 365, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/thegqvow/virtualenv/gradientboostmvp/3.7/lib/python3.7/site-packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/thegqvow/virtualenv/gradientboostmvp/3.7/lib/python3.7/site-packages/django/core/management/base.py", line 335, in execute
output = self.handle(*args, **options)
File "/home/thegqvow/virtualenv/gradientboostmvp/3.7/lib/python3.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 189, in handle
collected = self.collect()
File "/home/thegqvow/virtualenv/gradientboostmvp/3.7/lib/python3.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 135, in collect
raise processed
File "/home/thegqvow/virtualenv/gradientboostmvp/3.7/lib/python3.7/site-packages/django/contrib/staticfiles/storage.py", line 296, in _post_process
content = pattern.sub(converter, content)
File "/home/thegqvow/virtualenv/gradientboostmvp/3.7/lib/python3.7/site-packages/django/contrib/staticfiles/storage.py", line 197, in converter
force=True, hashed_files=hashed_files,
File "/home/thegqvow/virtualenv/gradientboostmvp/3.7/lib/python3.7/site-packages/django/contrib/staticfiles/storage.py", line 134, in _url
hashed_name = hashed_name_func(*args)
File "/home/thegqvow/virtualenv/gradientboostmvp/3.7/lib/python3.7/site-packages/django/contrib/staticfiles/storage.py", line 345, in _stored_name
cache_name = self.clean_name(self.hashed_name(name))
File "/home/thegqvow/virtualenv/gradientboostmvp/3.7/lib/python3.7/site-packages/django/contrib/staticfiles/storage.py", line 94, in hashed_name
raise ValueError("The file '%s' could not be found with %r." % (filename, self))
ValueError: The file 'third/vendors/owl-carousel/assets/owl.video.play.png' could not be found with <django.contrib.staticfiles.storage.ManifestStaticFilesStorage object at 0x7f5018ab78d0>.
I can't find the solution for an exception when I start my tests which suddenly accured while coding. The website still works fine with runserver. Here is the full traceback:
Traceback (most recent call last):
File "manage.py", line 10, in <module
execute_from_command_line(sys.argv)
File "…/lib/python3.5/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
utility.execute()
File "…/lib/python3.5/site-packages/django/core/management/__init__.py", line 359, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "…/lib/python3.5/site-packages/django/core/management/commands/test.py", line 29, in run_from_argv
super(Command, self).run_from_argv(argv)
File "…/lib/python3.5/site-packages/django/core/management/base.py", line 294, in run_from_argv
self.execute(*args, **cmd_options)
File "…/lib/python3.5/site-packages/django/core/management/base.py", line 345, in execute
output = self.handle(*args, **options)
File "…/lib/python3.5/site-packages/django/core/management/commands/test.py", line 72, in handle
failures = test_runner.run_tests(test_labels)
File "…/lib/python3.5/site-packages/django/test/runner.py", line 549, in run_tests
old_config = self.setup_databases()
File "…/lib/python3.5/site-packages/django/test/runner.py", line 499, in setup_databases
self.parallel, **kwargs
File "…/lib/python3.5/site-packages/django/test/runner.py", line 743, in setup_databases
serialize=connection.settings_dict.get("TEST", {}).get("SERIALIZE", True),
File "…/lib/python3.5/site-packages/django/db/backends/base/creation.py", line 78, in create_test_db
self.connection._test_serialized_contents = self.serialize_db_to_string()
File "…/lib/python3.5/site-packages/django/db/backends/base/creation.py", line 122, in serialize_db_to_string
serializers.serialize("json", get_objects(), indent=None, stream=out)
File "…/lib/python3.5/site-packages/django/core/serializers/__init__.py", line 129, in serialize
s.serialize(queryset, **options)
File "…/lib/python3.5/site-packages/django/core/serializers/base.py", line 88, in serialize
self.handle_field(obj, field)
File "…/lib/python3.5/site-packages/django/core/serializers/python.py", line 55, in handle_field
self._current[field.name] = field.value_to_string(obj)
File "…/lib/python3.5/site-packages/markitup/fields.py", line 103, in value_to_string
return value.raw
AttributeError: 'str' object has no attribute 'raw'
Normally I try to narrow the issue down myself. But in this case I don't get anywhere.
I didn't update any packages. These are the packages in question:
Django (1.10.7)
django-markitup (3.0.0)
(The exception disappears when I replace my MarkupField with a standard TextField in models.py.)
Update: The error appears when I use --keepdb successively.
Seems you can fix it by
class MyMarkupField(MarkupField):
def value_to_string(self, obj):
value = self._get_val_from_obj(obj)
if hasattr(value, "raw"):
return value.raw
return value
Then
field = MyMarkupField()
Actually i dont know why this error is coming.
When trying to make migrations in Django I get the following error. Can any help me understand what the problem is and how it possibly can be solved?
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/john/env/lib/python3.5/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
utility.execute()
File "/home/john/env/lib/python3.5/site-packages/django/core/management/__init__.py", line 355, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/john/env/lib/python3.5/site-packages/django/core/management/base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/john/env/lib/python3.5/site-packages/django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
File "/home/john/env/lib/python3.5/site-packages/django/core/management/commands/makemigrations.py", line 150, in handle
loader.project_state(),
File "/home/john/env/lib/python3.5/site-packages/django/db/migrations/loader.py", line 323, in project_state
return self.graph.make_state(nodes=nodes, at_end=at_end, real_apps=list(self.unmigrated_apps))
File "/home/john/env/lib/python3.5/site-packages/django/db/migrations/graph.py", line 409, in make_state
project_state = self.nodes[node].mutate_state(project_state, preserve=False)
File "/home/john/env/lib/python3.5/site-packages/django/db/migrations/migration.py", line 92, in mutate_state
operation.state_forwards(self.app_label, new_state)
File "/home/john/env/lib/python3.5/site-packages/django/db/migrations/operations/fields.py", line 289, in state_forwards
delay = not field.is_relation
UnboundLocalError: local variable 'field' referenced before assignment
I'm using Django 1.11.1 and Python 3.5.
I was upgrading from Django 1.6 to 1.7. Python 2.7 is installed which is compatible with Django 1.7. While I did run the code python manage.py makemigrations, I got the following error message:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 338, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/m akemigrations.py", line 111, in handle
convert_apps=app_labels or None,
File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/autodetector.py", line 42, in changes
changes = self._detect_changes(convert_apps, graph)
File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/autodetector.py", line 109, in _detect_changes
self.old_apps = self.from_state.render(ignore_swappable=True)
File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/state.py", line 67, in render
model.render(self.apps)
File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/state.py", line 312, in render
body,
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 284, in __new__
new_class._prepare()
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 344, in _prepare
signals.class_prepared.send(sender=cls)
File "/usr/local/lib/python2.7/dist-packages/django/dispatch/dispatcher.py", line 198, in send
response = receiver(signal=self, sender=sender, **named)
File "/usr/local/lib/python2.7/dist-packages/model_utils/fields.py", line 57, in prepare_class
% sender.__name__
AssertionError: To use StatusField, the model 'ShellRequest' must have a STATUS choices class attribute.
Reading the blogpost here, I couldn't figure out where to start. If anyone can give me a guideline how to deal with this issue would be appreciated.
The choices class field attribute is probably what you're looking for.
If you are using django-model-utils, the choices section of the package doc might help too.
I teared down Django-oscar for practice and rebuild it not in capacity of a plugin app but as Django project. Now I am having this issue but couldn't figure out what it is related to exactly. Can someone help me to resolve this?
Following is the error I am getting:
When I run command "python manage.py shell" I get this error.
(supermarket) C:\Users\shazia\supermarket\market>python manage.py shell
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\_
_init__.py", line 354, in execute_from_command_line
utility.execute()
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\_
_init__.py", line 346, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\b
ase.py", line 394, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\b
ase.py", line 445, in execute
output = self.handle(*args, **options)
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\c
ommands\shell.py", line 69, in handle
self.run_shell(shell=options['interface'])
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\c
ommands\shell.py", line 58, in run_shell
return getattr(self, shell)()
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\c
ommands\shell.py", line 41, in ipython
ip()
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\c
ommands\shell.py", line 34, in _ipython
from IPython import start_ipython
File "C:\Users\shazia\supermarket\lib\site-packages\IPython\__init__.py", li
ne 47, in <module>
from .core.application import Application
File "C:\Users\shazia\supermarket\lib\site-packages\IPython\core\application
.py", line 22, in <module>
from traitlets.config.application import Application, catch_config_error
File "C:\Users\shazia\supermarket\lib\site-packages\traitlets\config\__init_
_.py", line 6, in <module>
from .application import *
File "C:\Users\shazia\supermarket\lib\site-packages\traitlets\config\applica
tion.py", line 120, in <module>
class Application(SingletonConfigurable):
File "C:\Users\shazia\supermarket\lib\site-packages\traitlets\config\applica
tion.py", line 291, in Application
def initialize(self, argv=None):
File "<decorator-gen-1>", line 2, in catch_config_error
File "C:\Users\shazia\supermarket\lib\site-packages\decorator.py", line 232,
in decorate
evaldict, __wrapped__=func)
File "C:\Users\shazia\supermarket\lib\site-packages\decorator.py", line 219,
in create
self = cls(func, name, signature, defaults, doc, module)
File "C:\Users\shazia\supermarket\lib\site-packages\decorator.py", line 109,
in __init__
setattr(self, a, getattr(argspec, a))
AttributeError: 'getfullargspec' object has no attribute 'default'
You are on Windows as per the error description. Use 'manage.py shell' instead of 'python manage.py shell'.