Py学习  »  Django

为什么从django导入*不能导入所有子模块?

scrapy • 6 年前 • 2455 次点击  

from modue_name import * ,表示导入模块名中的所有子模块。

ls /usr/local/lib/python3.5/dist-packages/django
apps  contrib  dispatch  __init__.py  __pycache__   templatetags  utils
bin   core     forms     __main__.py  shortcuts.py  test          views
conf  db       http      middleware   template      urls

子模块 apps 位于 django

import django
from django import *
print(django.apps)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'django' has no attribute 'apps'

为什么是子模块 应用程序 from django import * ?

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/54417
文章 [ 5 ]  |  最新文章 6 年前