Skip to content

Instantly share code, notes, and snippets.

@jacobh
Created September 3, 2014 06:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jacobh/f43f5137669b46ee6104 to your computer and use it in GitHub Desktop.
Save jacobh/f43f5137669b46ee6104 to your computer and use it in GitHub Desktop.
Traceback (most recent call last):
File "manage.py", line 18, in <module>
execute_from_command_line(sys.argv)
File "/Users/jacob/.virtualenvs/gizmag/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/Users/jacob/.virtualenvs/gizmag/lib/python2.7/site-packages/django/core/management/__init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/jacob/.virtualenvs/gizmag/lib/python2.7/site-packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Users/jacob/.virtualenvs/gizmag/lib/python2.7/site-packages/django/core/management/base.py", line 338, in execute
output = self.handle(*args, **options)
File "/Users/jacob/.virtualenvs/gizmag/lib/python2.7/site-packages/django/core/management/commands/makemigrations.py", line 124, in handle
self.write_migration_files(changes)
File "/Users/jacob/.virtualenvs/gizmag/lib/python2.7/site-packages/django/core/management/commands/makemigrations.py", line 152, in write_migration_files
migration_string = writer.as_string()
File "/Users/jacob/.virtualenvs/gizmag/lib/python2.7/site-packages/django/db/migrations/writer.py", line 129, in as_string
operation_string, operation_imports = OperationWriter(operation).serialize()
File "/Users/jacob/.virtualenvs/gizmag/lib/python2.7/site-packages/django/db/migrations/writer.py", line 80, in serialize
arg_string, arg_imports = MigrationWriter.serialize(item)
File "/Users/jacob/.virtualenvs/gizmag/lib/python2.7/site-packages/django/db/migrations/writer.py", line 245, in serialize
item_string, item_imports = cls.serialize(item)
File "/Users/jacob/.virtualenvs/gizmag/lib/python2.7/site-packages/django/db/migrations/writer.py", line 310, in serialize
return cls.serialize_deconstructed(path, args, kwargs)
File "/Users/jacob/.virtualenvs/gizmag/lib/python2.7/site-packages/django/db/migrations/writer.py", line 221, in serialize_deconstructed
arg_string, arg_imports = cls.serialize(arg)
File "/Users/jacob/.virtualenvs/gizmag/lib/python2.7/site-packages/django/db/migrations/writer.py", line 380, in serialize
raise ValueError("Cannot serialize: %r\nThere are some values Django cannot serialize into migration files.\nFor more, see https://docs.djangoproject.com/en/dev/topics/migrations/#migration-serializing" % value)
ValueError: Cannot serialize: <gizmag.file_storages.LazyStorage object at 0x10785c490>
There are some values Django cannot serialize into migration files.
For more, see https://docs.djangoproject.com/en/dev/topics/migrations/#migration-serializing
def get_media_upload_path(instance, filename):
return os.path.join(instance.get_type_slug(), filename)
class Media(models.Model):
file = models.FileField(storage=media_storage, upload_to=get_media_upload_path)
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment