{"id":21374832,"url":"https://github.com/banool/diary-django","last_synced_at":"2025-10-19T07:29:09.148Z","repository":{"id":56235591,"uuid":"126673321","full_name":"banool/diary-django","owner":"banool","description":"Django site for my diary","archived":false,"fork":false,"pushed_at":"2023-11-25T13:07:55.000Z","size":69,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-14T23:43:22.895Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/banool.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-25T07:10:26.000Z","updated_at":"2023-11-25T12:31:39.000Z","dependencies_parsed_at":"2024-11-22T09:15:19.929Z","dependency_job_id":null,"html_url":"https://github.com/banool/diary-django","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/banool%2Fdiary-django","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/banool%2Fdiary-django/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/banool%2Fdiary-django/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/banool%2Fdiary-django/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/banool","download_url":"https://codeload.github.com/banool/diary-django/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243848025,"owners_count":20357482,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-22T08:45:41.840Z","updated_at":"2025-10-19T07:29:09.041Z","avatar_url":"https://github.com/banool.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Django Diary\nThis is an exact replica of the diary from my ftp webspace using Django. The link format is the same, the markdown is rendered into HTML in the exact same way, and the index looks exactly the same.\n\nI don't intend for anyone else to use this, it's got too many weird little details specific to my set up.\n\n## How does this work?\nThis repo is a secretless django server that exists to serve the diary. It does not contain any diary data. The backing store for the data is the [original diary](https://github.com/banool/diary). In the original repo, I would run a script that converted the markdown into HTML and then copy it across to an FTP server.\n\nThis repo contains the old repo as a submodule. Instead of converting the markdown to HTML in advance, we load the markdown into a DB and then serve it up as HTML on demand. So in this version, the true backing store for each entry is still those markdown files. This means the DB is also sort of stateless, since the data can always be loaded back up from the original diary's repo.\n\n## Development\nUsing Poetry 1.7.1.\n\n```\npoetry install\npoetry run ./run.sh 6000\n```\n\n## Production\nYou need a `.env` file that contains the following keys:\n\n- ALLOWED_HOSTS\n- DB_NAME\n- DB_USER\n- DB_PASSWORD\n- DB_HOST\n- DB_PORT\n- SECRET_KEY\n- UI_EMAIL\n- UI_USERNAME\n- UI_PASSWORD\n\nRemember when you're running this on Mac, you have to use `host.docker.internal` to refer to the host machine.\n\n```\ndocker build . -t diary-django\ndocker run -p 11112:11112 -p 11111:11111 --env-file .env -v /Users/dport/.ssh:/root/.ssh -it diary-django\n```\n\n## Real production\nGo use the ansible setup in [server-setup](https://github.com/banool/server-setup).\n\n## How to setup (old)\n1. Clone this repo and the [original diary](https://github.com/banool/diary).\n2. `cd` into the directory for this repo and run `ln -s ~/diary/scripts/prefilter.py \u0026\u0026 ln -s ~/diary/scripts/filter.py`.\n3. Make a virtualenv from the requirements file. In `bin/activate`, add a line like `export DJANGO_SETTINGS_MODULE=\"diary.settings.settings_prod\"` to tell Django which settings file to use.\n\nThis will work fine in dev, but in prod you're going to struggle. Luckily I've figured it all out more or less, check `diary.sh` in `https://github.com/banool/server-setup` for how to set it all up properly in production.\n\nIn the original diary (probably `~/diary`) make a file called `.git/hooks/post-merge`:\n\n```\n#!/bin/bash\n\ncd /var/www/diary-django\nsource myvenv/bin/activate\npython manage.py shell -c \"from viewer import util; util.load_new_entries()\"\ndeactivate\n```\n\nThis will get the Django diary to pull new entries in following a `git pull` in the original diary that changes something. So make sure to also put `cd ~/diary \u0026\u0026 git pull` in the crontab. This of course means that you need to push entries to the original diary repo for it to be updated on to the website.\n\n## To do\n- Tests, my previous diary was sorely lacking this.\n    - Make sure that the HTML renders properly.\n    - Make sure that the secret tags are respected (**important**).\n    - More Django'y tests.\n- Put the old diary and the new diary together. This will remove the need for symlinks into the other diary and hopefully reduce the cruft around having a hardcoded absolute path to the entry directory.\n- ~Productionise the code.~\n- ~Consider password protecting some / all of the diary.~\n- ~Consider where to store the entries and how to let Django know of their location. Where is the best place to store this piece of config information? What about in production?~ Currently it still needs to refer to the old diary scripts.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbanool%2Fdiary-django","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbanool%2Fdiary-django","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbanool%2Fdiary-django/lists"}