01-11-2020, 01:44
Bon j'ai beau retourner le problème je ne comprends pas pourquoi le module n'est pas trouvé !!
Une autre question se pose :
si j'utilise la commande "django-admin startapp" le dossier créé contient models.py et non un dossier "models" comme indiquer dans l'exemple de création (castors / beavers). Pourquoi ?
Code :
(pjt_creme2) v:\Python\creme2>python v:\Python\creme2\manage.py makemigrations editors
Traceback (most recent call last):
File "v:\Python\creme2\manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "V:\Python\pjt_creme2\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
utility.execute()
File "V:\Python\pjt_creme2\lib\site-packages\django\core\management\__init__.py", line 357, in execute
django.setup()
File "V:\Python\pjt_creme2\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "v:\Python\creme2\creme\__init__.py", line 23, in _hooked_populate
_original_populate(self, installed_apps)
File "V:\Python\pjt_creme2\lib\site-packages\django\apps\registry.py", line 114, in populate
app_config.import_models()
File "V:\Python\pjt_creme2\lib\site-packages\django\apps\config.py", line 211, in import_models
self.models_module = import_module(models_module_name)
File "V:\Python\pjt_creme2\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "v:\Python\creme2\creme\editors\models\__init__.py", line 3, in <module>
from editor import Editor
ModuleNotFoundError: No module named 'editor'
Une autre question se pose :
si j'utilise la commande "django-admin startapp" le dossier créé contient models.py et non un dossier "models" comme indiquer dans l'exemple de création (castors / beavers). Pourquoi ?