Django目录结构?

我想实现一个特定于项目的简单排队服务。 代码应该在Django目录结构中进入哪里?

目前的结构是:

sound/ __init__.py models.py tests.py views.py static 

我在问上面的direcotry结构中创build的队列服务代码的位置。 我应该创build一个新的目录吗?

共同的结构

在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 

如果您需要使用数据库,则应将数据模型添加到models.py。 对于你的程序,我build议把它写在新的python文件(例如queuing.py)中,你可以在什么时候,什么地方使用它。 你也可以为此创build另一个Django应用程序。