tags:

views:

976

answers:

2

Problem: to find the Python module execute_manager in the class django.core.management.

The question is related to another question of mine.

I am trying to start my server by

python manage.py runserver

The command is dependent on manage.py. The file imports the module execute_manager from the class django.core.management as follows

from django.core.management import execute_manager

I have tried to find the source code of the module unsuccessfully in the django installation folder by

$find . | grep exe
./django/core/management/commands/sqlindexes.py

Similarly, I get the following results by ack.

django/conf/project_template/manage.py
2:from django.core.management import execute_manager
11:    execute_manager(settings)

django/core/management/__init__.py
333:def execute_manager(settings_mod, argv=None):

examples/manage.py
2:from django.core.management import execute_manager
11:    execute_manager(settings)

How can you find the source code of the module execute_manager in the class django.core.management?

+5  A: 

execute_manager is a function, not a module, defined in the __init__.py file in the django.core.management package. That is why your grep failed to find it.

Your ack found it with this result that you pasted:

django/core/management/__init__.py
333:def execute_manager(settings_mod, argv=None):
FogleBird
@FogleBird: Thank you!
Masi
+2  A: 

It's in the file $PYTHON_SITE_PACKAGES/django/core/management/__init__.py. execute_manager is a function, not a module, and the code for the django.core.management module is found in django/core/management/__init__.py, since django.core.management is also a package.

mipadi