I would like to implement a simple queueing service specific to a project. Where should the code go into in the Django directory structure?
Currently the structure is:
sound/ __init__.py models.py tests.py views.py static
[edit] I am asking where to place the queue service code I created within the direcotry structure above. Should I create a new directory?
The way I like to organize my Django Project is – Keeps all Django apps in apps folder, static files (scripts, js, CSS) in the static folder, HTML files in templates folder and images and media content in the media folder.
apps.py is a configuration file common to all Django apps. models.py is the module containing the models for your app basically ORM modelling. tests.py contains test procedures which run when testing your app. views.py is the module containing the views for your app or where we write our business logic.
Any Django project consists of multiple applications.
The difference between a project and app is, a project is a collection of configuration files and apps whereas the app is a web application which is written to perform business logic.
Common structures
In 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
In Django 1.3 and prior
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
Alternative approach
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With