How do you organize the code in your Django project?
My answer to How do you organize the code in your Django project? on Quora
For http://lanyrd.com/ our layout looks something like this:
lanyrd/—parent directory, this is our root git repository
requirements.txt—our pip requirements file
app1/
app2/
app3/
management/
commands/—commands related to a specific app live inside that app
homepage/—one of our apps is responsible for our homepage
common/—some common code for the whole site, e.g. custom middleware
configs/
urls.py—our main URLs module
common_settings.py—settings common between dev and production
dev/
settings.py—our dev settings
manage.py—the manage.py script we use in dev
static/—our static assets
css/
js/
img/
templates/
base.html
homepage.html
app1/—templates relating to individual apps
app2/
app3/
We have a separate repository called “deploy” which contains our puppet recipes, our production settings and .tar.gz files for each of our pip requirements (since we don’t like our deploys to depend on files on the internet that might 404 some day).
I hope that’s helpful—let me know if you have any questions.
More recent articles
- Lawyer cites fake cases invented by ChatGPT, judge is not amused - 27th May 2023
- llm, ttok and strip-tags - CLI tools for working with ChatGPT and other LLMs - 18th May 2023
- Delimiters won't save you from prompt injection - 11th May 2023
- Weeknotes: sqlite-utils 3.31, download-esm, Python in a sandbox - 10th May 2023
- Leaked Google document: "We Have No Moat, And Neither Does OpenAI" - 4th May 2023
- Midjourney 5.1 - 4th May 2023
- Prompt injection explained, with video, slides, and a transcript - 2nd May 2023
- download-esm: a tool for downloading ECMAScript modules - 2nd May 2023
- Let's be bear or bunny - 1st May 2023
- Weeknotes: Miscellaneous research into Rye, ChatGPT Code Interpreter and openai-to-sqlite - 1st May 2023