Add a "addtopath" command to django-admin.py
|Reported by:||Moof <moof@…>||Owned by:||adrian|
|Component:||Core (Management commands)||Version:|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
django-admin startproject is a great way to start a project, but it doesn't add the project to the python path.
As a convenience, there should either be an addtopath command, or installinpython command, or something along those lines, or maybe an option to startproject. This would create a .pth file in site-packages which would have the project's parent directory in it, so that python would pick it up as part of its path. See the documentation for the site package for more information on how .pth files work.
This has the advantage of being cross-platform, so windows people who have never used a command line don't freak out about having to work out how to set the python path, something that isn't at all obvious, and difficult to do permanently. Plus, it works for python consoles started outside of command lines, which many windows users use.
Also, setuptools has a bunch of code showing how to do this, as it's how easy_install goes about installing eggs. You may wish to copy their example of having one "django_sites.pth" file with all the paths to all the sites.
As a corollary, maybe a removefrompath command might be a good idea too.