{"id":21478908,"url":"https://github.com/timokluser-dev/django-workshop","last_synced_at":"2026-05-07T13:33:01.732Z","repository":{"id":104812340,"uuid":"440473133","full_name":"timokluser-dev/django-workshop","owner":"timokluser-dev","description":"getting started with django","archived":false,"fork":false,"pushed_at":"2022-01-21T06:52:01.000Z","size":82,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-19T18:09:16.596Z","etag":null,"topics":["backend","django","graphql","python","wagtail"],"latest_commit_sha":null,"homepage":"","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/timokluser-dev.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,"zenodo":null}},"created_at":"2021-12-21T10:12:56.000Z","updated_at":"2024-05-29T08:59:02.000Z","dependencies_parsed_at":"2023-05-30T05:45:38.325Z","dependency_job_id":null,"html_url":"https://github.com/timokluser-dev/django-workshop","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/timokluser-dev/django-workshop","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timokluser-dev%2Fdjango-workshop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timokluser-dev%2Fdjango-workshop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timokluser-dev%2Fdjango-workshop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timokluser-dev%2Fdjango-workshop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timokluser-dev","download_url":"https://codeload.github.com/timokluser-dev/django-workshop/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timokluser-dev%2Fdjango-workshop/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260985197,"owners_count":23092888,"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":["backend","django","graphql","python","wagtail"],"created_at":"2024-11-23T11:20:06.002Z","updated_at":"2026-05-07T13:33:01.698Z","avatar_url":"https://github.com/timokluser-dev.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# django-workshop\n\n:arrow_right: Frontend: [timokluser-dev/django-workshop-frontend](https://github.com/timokluser-dev/django-workshop-frontend)\n\n\u003ca href=\"https://www.djangoproject.com/\"\u003e\n    \u003cimg style=\"width: 150px;\" src=\"https://static.djangoproject.com/img/logos/django-logo-negative.png\" alt=\"django logo\" /\u003e\n\u003c/a\u003e\n\n- [PyCharm](https://www.jetbrains.com/pycharm/)\n- [Django](https://www.djangoproject.com/)\n- [Django Docs v4.0](https://docs.djangoproject.com/en/4.0/)\n\n## setup\n\n- Django v4 Backend\n- Django Debug Toolbar\n- Wagtail CMS\n- GraphQL API\n\n## create project\n\n- `make init` (will set hosts \u0026 create .env)\n- `docker-compose run django bash`\n- `pip freeze` (show dependencies)\n- `pip install django`\n- `pip freeze` (show dependencies)\n- `pip freeze \u003e requirements.txt`\n- `django-admin startproject app .`\n- `exit`\n- .docker/Dockerfile (remove comment on line 38)\n- `docker-compose up --build`\n\n## debugging with PyCharm\n\n:\narrow_right: [engineering-playbook/python/django_debug/debug.md](https://gitlab.liip.ch/eastside-customs/engineering-playbook/-/blob/master/python/django_debug/debug.md)\n\n## creating new models\n\nfile: `db/models.py`\n\n- build models\n- add `__str__(self)` method\n- (add Meta class)\n\n```bash\n# after model created / changed:\n./manage.py  makemigrations\n\n# apply the newly created migration [for app db]\n./manage.py  migrate [db]\n```\n\n→ Make small migrations for better maintainability\n\n\u003cbr\u003e\n\nfile: `db/admin.py`\n\n- register model for django admin\n    - `admin.site.register(Model)`\n\n## updating models\n\nwhen doing changed to the models, pay attention to the following:\n\n- set default or null values for existing entries:\n    - `models.TextField(null=True, ...)`\n    - _or_\n    - `models.TextField(default=\"some defaults\", ...)`\n- when renaming attributes, do one migration only for renaming\n\n## Wagtail CMS\n\n:information_source: wagtail is currently not compatible with Django 4. It will perform a downgrade of Django to version\n3 during install.\n\nLogin: [http://django.what-ever.lo/cms/](http://django.what-ever.lo/cms/)\n\n```bash\npip install wagtail\npip install wagtailmedia\npip freeze \u003e requirements.txt\n```\n\n:arrow_right: https://docs.wagtail.io/en/stable/getting_started/integrating_into_django.html\n\n→ add `'wagtailmedia'` to `INSTALLED_APPS` in settings.py\n\n## Django Debug Toolbar\n\n```bash\npip install django-debug-toolbar\npip install django-graphiql-debug-toolbar\n```\n\n:arrow_right: https://django-debug-toolbar.readthedocs.io/en/latest/installation.html\n:arrow_right: https://pypi.org/project/django-graphiql-debug-toolbar/\n\n\u003cbr\u003e\n\nwhen using docker:\n\nfile: `app/settings.py`\n\n```python\n# ...\n\nif DEBUG:\n    hostname, _, ips = socket.gethostbyname_ex(socket.gethostname())\n    INTERNAL_IPS = [ip[:-1] + '1' for ip in ips] + ['127.0.0.1', '10.0.2.2']\n\n\ndef show_debug_toolbar(request):\n    return DEBUG\n\n\nDEBUG_TOOLBAR_CONFIG = {\n    'SHOW_TOOLBAR_CALLBACK': show_debug_toolbar,\n}\n```\n\n## Graphene\n\nLibrary for [GraphQL](https://graphql.org/)\n\n```bash\npip install graphene-django\n```\n\n:arrow_right: https://docs.graphene-python.org/projects/django/en/latest/installation/\n\nNotes regarding GraphQL:\n\n- API Requests are always **POST**\n- API status code is always **200** (no 404)\n    - check for `response.data \u0026\u0026 !response.errors`\n\n## JWT Authorization\n\n:arrow_right: https://django-graphql-jwt.domake.io/index.html\n\nDefault Permissions: https://docs.djangoproject.com/en/4.0/topics/auth/default/#default-permissions\n\n---\n\n# Django template\n\n## Add Hosts file\n\nAdd the following to your `/etc/hosts` file.\n\n    127.0.0.1       django.what-ever.lo\n\n## Setup environment variables\n\n    make init\n\n## Docker shortcuts\n\n    make up\n    make down\n    make bash\n\n## Django Admin GUI\n\nYou can access the Admin Gui through [http://django.what-ever.lo/admin/](http://django.what-ever.lo/admin/).\n\n    Username: admin\n    Password: admin\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimokluser-dev%2Fdjango-workshop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimokluser-dev%2Fdjango-workshop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimokluser-dev%2Fdjango-workshop/lists"}