liuyang1520 / django-command-extensions

Automatically exported from code.google.com/p/django-command-extensions
MIT License
0 stars 0 forks source link

management.utils.get_project_root assumes settings file is settings.py #55

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The get_project_root utility function (used in clean_pyc and compile_pyc)
assumes the project settings file must be named "settings.py".  This is a
common convention, but it is not a valid assumption; Django allows the
settings file to be given any name.

Original issue reported on code.google.com by carl.j.meyer on 20 Sep 2008 at 10:24

GoogleCodeExporter commented 8 years ago
Right, what about using 'manage.py' for checking a valid project root is found ?

Maybe the entire (double) check could even be dropped. As the first code file 
on the
stack should be in the project root. If that's not the case anything (unless 
given by
a convention DJANGO_PROJECT_ROOT anyone ? :) could be the project root.

Original comment by v.oostv...@gmail.com on 22 Sep 2008 at 11:28

GoogleCodeExporter commented 8 years ago
I would just look at settings.SETTINGS_MODULE, and avoid the frame-hacking
altogether.  Here's a patch.

Original comment by carl.j.meyer on 22 Sep 2008 at 2:22

Attachments:

GoogleCodeExporter commented 8 years ago
absolutely right, i didn't know settings.SETTINGS_MODULE existed.

Original comment by v.oostv...@gmail.com on 26 Sep 2008 at 8:27

GoogleCodeExporter commented 8 years ago
note-to-self; also add:

 * -p,--path optionally specificy a path instead of PROJECT_ROOT
 * -a,--all  optionally walk all the INSTALLED_APPS and clean/compile those which are
not in the PROJECT ROOT

Original comment by v.oostv...@gmail.com on 26 Sep 2008 at 8:32

GoogleCodeExporter commented 8 years ago
fixed in svn
(also implemented -p)

Original comment by v.oostv...@gmail.com on 2 Oct 2008 at 12:42