#29529: FilePathField path attribute gets resolved when running makemigrations.
-------------------------------------+-------------------------------------
Reporter: Sebastiaan Arendsen | Owner: nobody
Type: Uncategorized | Status: new
Component: Migrations | Version: 2.0
Severity: Normal | Resolution:
Keywords: migration, | Triage Stage:
filepathfield, makemigrations | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Sebastiaan Arendsen):
Replying to [comment:1 Hemanth V. Alluri]:
> So, to clarify, what exactly is the bug/feature proposal/issue here? The
way I see it, you're supposed to use os.path.join() and LOCAL_FILE_DIR to
define a relative path. It's sort of like how we use BASE_DIR to define
relative paths in a lot of other places. Could you please clarify a bit
more as to what the issue is so as to make it easier to test and patch?
LOCAL_FILE_DIR doesn't have to be the same on another machine, and in this
case it isn't the same on the production server. So the os.path.join()
will generate a different path on my local machine compared to the server.
When i ran ./manage.py makemigrations the Migration had the path resolved
"hardcoded" to my local path, which will not work when applying that path
on the production server. This will also happen when using the BASE_DIR
setting as the path of your FilePathField, seeing as that's based on the
location of your project folder, which will almost always be on a
different location.
My suggestion would be to let makemigrations not resolve the path and
instead keep the os.path.join(), which I have now done manually. More
importantly would be to retain the LOCAL_FILE_DIR setting in the
migration.
--
Ticket URL: <https://code.djangoproject.com/ticket/29529#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/067.5b4c9425163ae64baba036814bfed033%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.