Hey Nico, if you want to dynamically determin the upload / storage path you should use the "upload_to" parameter with a callable: https://docs.djangoproject.com/en/1.7/ref/models/fields/#django.db.models.FileField.upload_to inside the callable you can safely access the settings without influencing the migrations. Excluding the parameter from the migrations isn't possible by design.
/Markus On Thursday, November 13, 2014 1:22:20 AM UTC+1, Nico Benitez wrote: > > I have a question about storage objects in a migration enabled project. > > I have a project that uses a file system storage backend for storing > certain model FileFields, but the location is dependent on the deployment > and stored in the settings module. For example, for testing locally I have > the storage root pointed at a directory under my home folder. Whenever I > run makemigration, it tries to alter all the FileFields to reflect whatever > the current setting is, even though this does not affect the database. > > Is there a way to prevent the storage parameter from getting serialized in > the migration? If not, what is a good way to handle storing files in > different locations depending on a configuration, without a bunch of > unnecessary migrations? > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/9da1110a-f174-44c7-8391-a89ce3cf4517%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.