{"id":27072783,"url":"https://github.com/hong539/local_library_website","last_synced_at":"2025-04-05T23:33:47.715Z","repository":{"id":176830933,"uuid":"656353284","full_name":"hong539/local_library_website","owner":"hong539","description":"For Doing Django Tutorial: The Local Library website steps by steps","archived":false,"fork":false,"pushed_at":"2023-12-23T18:53:29.000Z","size":282,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-12-23T20:54:11.334Z","etag":null,"topics":["architecture","backend","developer","django","django-project","frontend","linux","mozilla","postgresql","python","serverside","serverside-development","web","webapp","webdevelopment"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hong539.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-06-20T19:22:42.000Z","updated_at":"2023-10-26T04:29:44.000Z","dependencies_parsed_at":"2023-12-23T20:50:10.913Z","dependency_job_id":null,"html_url":"https://github.com/hong539/local_library_website","commit_stats":null,"previous_names":["hong539/local_library_website"],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hong539%2Flocal_library_website","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hong539%2Flocal_library_website/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hong539%2Flocal_library_website/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hong539%2Flocal_library_website/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hong539","download_url":"https://codeload.github.com/hong539/local_library_website/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247415824,"owners_count":20935384,"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":["architecture","backend","developer","django","django-project","frontend","linux","mozilla","postgresql","python","serverside","serverside-development","web","webapp","webdevelopment"],"created_at":"2025-04-05T23:33:47.105Z","updated_at":"2025-04-05T23:33:47.708Z","avatar_url":"https://github.com/hong539.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# local_library_website\n\n## To-do-list\n\n* ~~Try RDBMS(Relational Database Management System):　SQLite, PostgreSQL~~\n* ~~For Doing [Django Tutorial: The Local Library website](https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django) steps by steps.~~\n    * [source codes](https://github.com/mdn/django-locallibrary-tutorial/tree/main)\n* ~~Extend and prepare My skills to find some good web-backend/devops/architecture jobs.~~\n* Practice system architecture design.\n    * Update architecture with diagram\n* Deploy methods survey\n    * natively run on Linux host after activate virtual environment via \"poetry shell\"\n        * run with [django develeopment server](https://docs.djangoproject.com/en/4.2/intro/tutorial01/#the-development-server)\n        * run with [gunicorn](https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/gunicorn/)\n        * run with [puff-rs](https://docs.rs/puff-rs/0.1.8/puff_rs/#puff--django)            \n    * podmand run\n    * k8s deploy\n* Frontend    \n    * CSS work with [Tailwind CSS](https://tailwindcss.com/docs/installation)\n* Monitor and alert\n    * [Sentry](https://github.com/getsentry)\n        * [Rust Development at Sentry](https://develop.sentry.dev/rust/)\n        * [self-hosted](https://develop.sentry.dev/self-hosted/)\n        * [Python Error and Performance Monitoring for Django web apps](https://sentry.io/for/python/?original_referrer=https%3A%2F%2Fgithub.com%2F\u0026platform=sentry.python.django)\n        * Real-time crash reporting for your web apps, mobile apps, and games.\n* Benchmark\n    * [Extreme HTTP Performance Tuning: 1.2M API req/s on a 4 vCPU EC2 Instance](https://talawah.io/blog/extreme-http-performance-tuning-one-point-two-million/)\n    * [Flame Graphs](https://www.brendangregg.com/flamegraphs.html)\n    * [wrk - a HTTP benchmarking tool](https://github.com/wg/wrk)\n\n## Prerequisites\n\n* Linux host such as Arch Linux, Debian, Ubuntu, RHEL ...etc\n* Python == 3.8.16\n* [pyenv+poetry](https://github.com/hong539/setup_dev_environment/blob/main/programming_languages/python/python.md#usage-with-pyenvpoetry)\n    * pyenv for Python versions control\n    * poetry for Project dependency control\n    * Project dependcy detialls will be in pyproject.toml/poetry.lock\n* PostgreSQL == 15.3 or Django builtin SQLite\n    * [PostgreSQL 15.4 Documentation](https://www.postgresql.org/docs/15/index.html)\n    * [PostgreSQL with docker](https://hub.docker.com/_/postgres)\n    * [pacman directly install PostgreSQL on Arch Linux](https://wiki.archlinux.org/title/PostgreSQL)\n* tree\n    * a CLI tools to list contents of directories in a tree-like format.\n* docker/podman (just pickup one to do conatiner image building and running)\n* kind for create local Kubernetes clusters via docker/podman\n\n## Quick Start\n\n```shell\n#check out prerequisites to prepare your environment\n\n#setting up for start postgresql on every bootup\nsudo systemctl enable postgresql.service\n\n#running postgresql server with this commands\n#if everything is setting up!\nsudo systemctl status postgresql.service\n\n#spawns a virtual environment\npoetry shell\n\n#add packages\n#src: https://python-poetry.org/docs/cli/#add\npoetry add django\npoetry add gunicorn\npoetry add diagrams -G dev\npoetry add django-environ==0.10.0\n\n#remove packages\npoetry remove diagrams\npoetry remove django-environ\n\n#for help\npython3 manage.py help\n\n#Creating a superuser for Django CMS system\npython3 manage.py createsuperuser\n\n#run devserver\npython3 manage.py runserver\n\n\n#check gunicorn\ngunicorn --version\n#run with gunicorn\n#some test codes in misc\ngunicorn --workers=2 test_gunicorn01:app\n#run with django project\n#src: https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/gunicorn/\ngunicorn locallibrary.wsgi\n\n\n#Warning: You'll need to run these commands every time your models change in a way that will affect the structure of the data that needs to be stored (including both addition and removal of whole models and individual fields).\npython3 manage.py makemigrations\npython3 manage.py migrate\n\n#run test\npython3 manage.py test\n#Showing more test information\npython3 manage.py test --verbosity 2\n#Speeding things up\npython3 manage.py test --parallel auto\n#Running specific tests\npython3 manage.py test catalog.tests.test_models\npython3 manage.py test catalog.tests.test_views\npython3 manage.py test catalog.tests.test_forms\n\n#deploy check\npython3 manage.py check --deploy\n\n#Starts the Python interactive interpreter\npython3 manage.py shell\n\n#src: https://docs.python.org/3.8/library/sys.html#sys.path\n#A list of strings that specifies the search path for modules. \n#Initialized from the environment variable PYTHONPATH, plus an installation-dependent default.\npython -c \"import sys; print(sys.path)\"\n\n#add env PYTHONPATH\nexport PYTHONPATH=/path/to/your/module:$PYTHONPATH\n\n#add packages by poetry\npoetry add \"psycopg[binary,pool]\"\npoetry add django-environ\n\n#add packages by poetry to extras section\npoetry add diagrams --optional --extras diagrams\n\n#export requirements.txt if needed\npoetry export -f requirements.txt --output requirements.txt\npoetry export -f requirements.txt --output requirements.txt --without-hashes\n\n#podman comon operations\n#login container registry such docker hub\npodman login docker.io\npodman images\npodman container list --all\npodman container rm local_library\npodman rmi localhost/dev-test:latest\n\n#docker/podman build container image\n#docker build -t dev-test -f Dockerfile.dev\npodman build --no-cache -t local_library_website/dev-test -f Dockerfile.dev\npodman build -t docker.io/focal1119/local_library_website:dev -f Dockerfile.dev\n\n#prod build\npodman build -t docker.io/focal1119/local_library_website:prod -f Dockerfile.prod\npodman build --no-cache -t docker.io/focal1119/local_library_website:prod -f Dockerfile.prod\n\n#test docekr/podman container image in localhost when PostgreSQL is online\npodman run -d --env-file=.env --name local_library -p 8000:8000 localhost/dev-test\n\n#run with Dockerfile.dev\npodman run -d --env-file=.env --name local_library -p 8000:8000 docker.io/focal1119/local_library_website:dev\n\n#run with Dockerfile.prod\npodman run -d --env-file=.env --name local_library -p 8000:8000 docker.io/focal1119/local_library_website:prod\n\n#check logs\npodman logs --follow local_library\n\n#push\n# docker push docker.io/focal1119/local_library_website:tagname\ndocker push docker.io/focal1119/local_library_website:dev\npodman push docker.io/focal1119/local_library_website:dev\npodman push docker.io/focal1119/local_library_website:prod\n\n#pull\ndocker pull focal1119/local_library_website:dev\n\n#.env.example for using and doing modification for your usecase\nvim .env.example\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhong539%2Flocal_library_website","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhong539%2Flocal_library_website","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhong539%2Flocal_library_website/lists"}