How do you organize the code in your Django project?
26th September 2012
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
- Datasette Enrichments: a new plugin framework for augmenting your data - 1st December 2023
- llamafile is the new best way to run a LLM on your own computer - 29th November 2023
- Prompt injection explained, November 2023 edition - 27th November 2023
- I'm on the Newsroom Robots podcast, with thoughts on the OpenAI board - 25th November 2023
- Weeknotes: DevDay, GitHub Universe, OpenAI chaos - 22nd November 2023
- Deciphering clues in a news article to understand how it was reported - 22nd November 2023
- Exploring GPTs: ChatGPT in a trench coat? - 15th November 2023
- Financial sustainability for open source projects at GitHub Universe - 10th November 2023
- ospeak: a CLI tool for speaking text in the terminal via OpenAI - 7th November 2023
- DALL-E 3, GPT4All, PMTiles, sqlite-migrate, datasette-edit-schema - 30th October 2023