-
Website
http://rob.cogit8.org/ -
Original page
http://rob.cogit8.org/blog/2009/May/05/django-and-relativity-updated/ -
Subscribe
All Comments -
Community
-
Top Commenters
-
arthurk
1 comment · 1 points
-
Rob Hudson
23 comments · 3 points
-
davedash
1 comment · 3 points
-
xktybot
1 comment · 1 points
-
sro
1 comment · 1 points
-
-
Popular Threads
PROJECT_ROOT = os.path.realpath('.')
On the flip side, removing the symlink from any reported paths does help demystify why "../" is referring to an entirely different location to what you were expecting at times. However, using ".." in files that are going to be symlinked into random locations is probably indicative of a larger problem in the code.
In short, I'm not convinced about your best option being best. I think your "good" is actually closer to "bad" for the primary reason that it doesn't give an absolute path.
I agree that "Best" here is debatable. Maybe I should have thrown in a "in my opinion" for good measure. For me personally, I'd rather see the true path to the Django directory than however it might be symlinked. I can see arguments other ways. Listing them as good, better, and best was a last minute change that I probably shouldn't have done. I think I'll update it to remove that and other biases and just point out the differences. Always good to have your feedback.
-Rob
As it's stated in the post, this is just my personal preference. My intention with the blog post was to explain the differences and you can choose the best option for you. I like realpath myself. You can pick the best option for your use cases.