我想实现一个特定于项目的简单排队服务。代码应该放在Django目录结构中的什么位置?
当前的结构是:
sound/ __init__.py models.py tests.py views.py static
[编辑]我要问我在上面的目录结构中放置我创建的队列服务代码的位置。我应该创建一个新目录吗?
共同的结构
在Django 1.4+中
project_root/ project_name/ media/ static/ some_app/css/app.css # overriding an app css file from project level css/ project.css static_root/ # in production using the collectstatic command templates/some_app/foo.html # overriding some_app at project level /admin/some_app/some_model/change_list.html # overriding admin changelist for some_app.models.some_model settings/ __init__.py base.py # settings common to all instances of the project dev.py staging.py test.py prod.py urls.py some_app/ static/ css/ app.css templates/some_app/foo.html urls.py views.py models.py manage.py
在Django 1.3及更低版本中
project_root/ some_app/ templates/some_app/foo.html static/ css/ app.css urls.py views.py models.py media/ static/ some_app/ css/ app.css # overriding an app css file from project level css/ project.css static_root/ (in production) templates/some_app/foo.html # overriding some_app at project level /admin/some_app/some_model/change_list.html # overriding admin changelist for some_app.models.some_model settings/ __init__.py base.py # settings common to all instances of the project dev.py staging.py test.py prod.py urls.py manage.py
替代方法
project_root/ .gitignore README.md docs/ venv/ src/ main/ media/ static/ some_app/css/app.css # overriding an app css file from project level css/ project.css static_root/ # in production using the collectstatic command templates/some_app/foo.html # overriding some_app at project level /admin/some_app/some_model/change_list.html # overriding admin changelist for some_app.models.some_model settings/ __init__.py base.py dev.py staging.py test.py prod.py urls.py some_app/ static/ css/ app.css templates/some_app/foo.html urls.py views.py models.py manage.py wsgi.py