{"id":15433204,"url":"https://github.com/simonw/djng","last_synced_at":"2025-04-15T16:37:41.441Z","repository":{"id":560959,"uuid":"191893","full_name":"simonw/djng","owner":"simonw","description":"Turtles all the way down","archived":false,"fork":false,"pushed_at":"2011-09-07T07:02:47.000Z","size":100,"stargazers_count":133,"open_issues_count":2,"forks_count":10,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-18T07:54:25.363Z","etag":null,"topics":["django","microframework","turtles-all-the-way-down"],"latest_commit_sha":null,"homepage":"http://simonwillison.net/2009/May/19/djng/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simonw.png","metadata":{"files":{"readme":"readme.txt","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2009-05-04T03:27:36.000Z","updated_at":"2024-07-18T18:03:40.000Z","dependencies_parsed_at":"2022-07-04T23:31:25.463Z","dependency_job_id":null,"html_url":"https://github.com/simonw/djng","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/simonw%2Fdjng","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fdjng/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fdjng/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fdjng/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simonw","download_url":"https://codeload.github.com/simonw/djng/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249109584,"owners_count":21214174,"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":["django","microframework","turtles-all-the-way-down"],"created_at":"2024-10-01T18:32:33.974Z","updated_at":"2025-04-15T16:37:41.421Z","avatar_url":"https://github.com/simonw.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"djng\n====\n(pronounced \"djing\", with a mostly-silent \"d\")\n\nBlog entry: http://simonwillison.net/2009/May/19/djng/\nMailing list: http://groups.google.com/group/djng\n\ndjng is a micro-framework that depends on a macro-framework (Django).\n\nMy definition of a micro-framework: something that lets you create an entire\nPython web application in a single module:\n\n    import djng\n    \n    def index(request):\n        return djng.Response('Hello, world')\n    \n    if __name__ == '__main__':\n        djng.serve(index, '0.0.0.0', 8888)\n\nOr if you want hello and goodbye URLs, and a custom 404 page:\n\n    import djng\n\n    app = djng.ErrorWrapper(\n        djng.Router(\n            (r'^hello$', lambda request: djng.Response('Hello, world')),\n            (r'^goodbye$', lambda request: djng.Response('Goodbye, world')),\n        ),\n        custom_404 = lambda request: djng.Response('404 error', status=404),\n        custom_500 = lambda request: djng.Response('500 error', status=500)\n    )\n    \n    if __name__ == '__main__':\n        djng.serve(app, '0.0.0.0', 8888)\n\nUnder the hood, djng will re-use large amounts of functionality from Django,\nwhile re-imagining various aspects of the framework. A djng request object is\na Django HttpRequest object; a djng response object is a Django HttpResponse.\nDjango's template language and ORM will be available. Ideally, Django code\nwill run almost entirely unmodified under djng, and vice versa.\n\nServices, not Settings\n======================\n\nI dislike Django's settings.py file - I often find I want to reconfigure\nsettings at run-time, and I'm not comfortable with having arbitrary settings\nfor so many different aspects of the framework.\n\ndjng experiments with /services/ in place of settings. Services are bits of\nshared functionality that djng makes available to applications - for example,\ncaching, templating, ORM-ing and mail-sending.\n\nMost of the stuff that Django sets up in settings.py will in djng be set up by\nconfiguring services. These services will be designed to be reconfigured at\nrun-time, using a mechanism similar to Django middleware.\n\nSome things that live in settings.py that really don't belong there -\nmiddleware for example. These will generally be constructed by composing\ntogether a djng application in code.\n\nI'm still figuring out how the syntax for services should work.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonw%2Fdjng","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimonw%2Fdjng","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonw%2Fdjng/lists"}