您好,我有一个 django 应用程序名称“celery_tasks”,其目录结构如下:
.
├── apps.py
├── emitter
├── __init__.py
├── kse
├── mongo
我添加了一个新的模块名称 kse ,其中包含两个文件:
├── __init__.py
├── lol.py
__init__.py
kse 模块中的from .lol import lol
lol.py 文件包含以下类:
class lol:
@staticmethod
def x():
return True
def __init__(self):
pass
问题是我无法kse
通过 django shell 访问模块:
>>> import celery_tasks
>>> celery_tasks.kse
Traceback (most recent call last):
File "<console>", line 1, in <module>
AttributeError: module 'celery_tasks' has no attribute 'kse'
但是 mongo 和 emmiter 模块是可以访问的:
>>> celery_tasks.mongo
<module 'celery_tasks.mongo' from '/Users/kheshav/Linux_projects/rockynode.io/App/rockynode/celery_tasks/mongo/__init__.py'>
>>> celery_tasks.emitter
<module 'celery_tasks.emitter' from '/Users/kheshav/Linux_projects/rockynode.io/App/rockynode/celery_tasks/emitter/__init__.py'>
我kse
以与 mongo 和发射器模块相同的方式创建模块,但无法访问 kse 模块。
我错过了什么吗?谢谢
更新 1
这里要求的是ls -la
目录:
drwxr-xr-x 11 root root 374 Oct 13 19:28 .
drwxr-xr-x 14 root root 476 Oct 12 22:51 ..
-rw-r--r-- 1 root root 98 Dec 11 2016 apps.py
drwxr-xr-x 5 root root 170 Oct 12 19:56 emitter
-rw-r--r-- 1 root root 0 Oct 13 20:51 __init__.py
drwxr-xr-x 5 root root 170 Oct 13 19:53 kse
drwxr-xr-x 6 root root 204 Oct 12 19:56 mongo
drwxr-xr-x 3 root root 102 Oct 13 20:50 __pycache__
drwxr-xr-x 5 root root 170 Oct 12 22:51 zabbix