{"id":23876766,"url":"https://github.com/vikasutf8/django-crafting","last_synced_at":"2026-06-15T16:30:17.210Z","repository":{"id":270309950,"uuid":"909954208","full_name":"vikasutf8/Django-Crafting","owner":"vikasutf8","description":"Learning Django with latest UV ","archived":false,"fork":false,"pushed_at":"2025-01-08T09:57:04.000Z","size":850,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-08T10:38:58.087Z","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/vikasutf8.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":"2024-12-30T06:24:58.000Z","updated_at":"2025-01-08T09:57:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"a969bb48-0977-4014-8071-49282f56efb1","html_url":"https://github.com/vikasutf8/Django-Crafting","commit_stats":null,"previous_names":["vikasutf8/django-crafting"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vikasutf8%2FDjango-Crafting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vikasutf8%2FDjango-Crafting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vikasutf8%2FDjango-Crafting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vikasutf8%2FDjango-Crafting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vikasutf8","download_url":"https://codeload.github.com/vikasutf8/Django-Crafting/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240239011,"owners_count":19770053,"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":"2025-01-03T19:32:06.702Z","updated_at":"2026-06-15T16:30:15.135Z","avatar_url":"https://github.com/vikasutf8.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Django Framework\n\nwe create virtual evn. `﻿py3 -m venv .venv` \n\n`pip3 i uv. ` \n\n`﻿uv venv`  its create .venv folder\n\nTo activate env. --`﻿source .venv/bin/activaate`   for decativte `﻿deactivate` \n\n--backend part or dynamic website work on python django.\n\n--MVC. -model view controllers\n\n--MVT -model view template (controlller with view, view with templates)\n\nwhy i choose. -- fast,components,Security,Scalability\n\n-- install django uv pip install Django \n\n `﻿django-admin startproject \"projectname\"`  iths create folder of projectname --\u003efolder projectname \u0026 manag.py\n\n`cd projectname --\u003e python manage.py runserver 8000  bydefualt` \n\nas init -- manage.py is first file that render on deployment\n\nBy default its connect ot sqlite database..in folder setting.py define all env variables \n\nurl.py --\u003eroutes define\nview.py --\u003econtroller define \nmodel.py also \n--- \n### Flow of django always same\nstory of templates ::\n\nroot follder me --manage.py ke paralle me\n\n- folder templates. --all html\n- folder static -- allcss\n- template engine --meant kahi par bhi enjact kar sakte ha code ko\n- adding template as html and css file must config then setting.py as differenct path and load static\n\n\n### Jinja2 -- defualt templating engine\nvaribale. {{---}}\n\ncref toke. {%--- %}\n\n-- app created by manage.py and server start also..\n\n`﻿python manage.py startapp \"appname\"` \n\nnow main project/root must have to know that new app present their.\n\n\n\n### How to use tailwind in django..\n`﻿uv pip install django-tailwind` \n\n-- If you want to use automatic page reloads during development  use the `[reload]` extras, which installs the `django-browser-reload` package in addition:  `python -m pip install 'django-tailwind[reload]'` \n\n\n\n**we have to face use so download pip as cmd given**\n\n`﻿python -m ensurepip --upgrade` \n\n`﻿python -m pip install -- upgrade pip`  any one is validate\n\n--Adding app 'tailwind'  in setting.py\n\n--`python manage.py tailwind init` \n\n--by defualt theme app created so we have to add it in setting.py\n\n```\nTAILWIND_APP_NAME='theme'\nINTERNAL_IPS =['127.0.0.1']\n\n//later\nNPM_BIN_PATH='' //how to find new terminal 'where npm'\n```\n[﻿chaicode.com/blogs/how-to-add-tailwind-to-your-django-project-and-django-admin](https://chaicode.com/blogs/how-to-add-tailwind-to-your-django-project-and-django-admin) \n\n[﻿django-tailwind.readthedocs.io/en/latest/installation.html](https://django-tailwind.readthedocs.io/en/latest/installation.html)   it is good \n\n### Admin panel :\nhigly configuer and old school like.. customizable and directly talk to model with CRUD functionlaity access..\n\n_You have 18 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.\nRun 'python manage.py migrate' to apply them.\nJanuary 02, 2025 - 09:14:07_\n\nmigration ::we can direcly connect to db , on behave of own djangoORM is used for that cmd for access of admin panel\n\n`python manage.py migrate` \n\ncreateing superuser\n\n`python manage.py createsuperuser` \n\nif reset admin password ::`python manage.py changepassord` \n\n### Django Modeling :::\ndjango --image handling --db perfomance issues little bit\n\n-- model.py always created in apps not in project.. like as microservice apps\n\n--we can write model directly in model.py in chais app -- how and why \n\n-- database also changes as engine/ else  setting.py ,we cant change code .. **django ORM layer** is major interaction\n\n```\n# https://docs.djangoproject.com/en/5.1/ref/settings/#databases\n\nDATABASES = {\n    'default': {\n        'ENGINE': 'django.db.backends.sqlite3', \n        #all changes here form converting sqlite to postgreSQL\n        'NAME': BASE_DIR / 'db.sqlite3',\n    }\n}\n```\nHow models written in Django\n\nHandling Pillow herer -- uv pip install Pillow\n\n-- we want to put image in project at any app.. so  setting .py me fixed:\n\n```\nMEDIA_URL ='/media/'\nMEDIA_ROOT =os.path.join(BASE_DIR,'media')\n```\nEnd of the days urls.py sureve hoga so urls  ko pata hona chaiye ki images storge hogi or setting me change huao ha .. **main project me urls.py**\n\n`from django.conf import settings\nfrom django.conf.urls.static import static` \n\njo ye static method ha use batana hota ha ki setting.py me se media_url load karna ha\n\nurlpattern[] static(settings.MEDIA_URL,document_root =settings.MEDIA_ROOT) \n\n-- Still django project doesn't know about we wrote a model so we have to till manage.py\n\n**Migrations :: loading changes:**\n\n`﻿python manage.py makemigration appnamethatwork(chais)`  -- its create new folder in that it wrote SQL Queries of table that we created... **Important we dont write query ..it automatically created by Django.**\n\n`﻿python manage.py migrate`  it aviable as table\n\n**AB kisi bhi Model ko admin se attach kar sakte ha ..view their ..**\n\nadmin.py in chais ..and theri app :;\n\n`﻿from django.contrib import admin\nfrom .models import ChaiVarity\n# Register your models here.\nadmin.site.register(ChaiVarity)` \n\nBy defualt User table is already present in Django:so how to utilize it ?\n\n\n\n### Relationships:\n- one to one\n- one to many --Forigen Key\nwhat is CASCADE in DB ??\n- many to many \n\n### Form:\n- adding a form templates.\n- for adding forms using views  define a functions -\u003ethen adding urls also with name,\n- Goal -- on going form getting a dropdown ,getting all chai veritys ,after selection it relative all store got that specific chai available..\nusing  Chai varitys ,Stores model interactions.\n1. create **form.py** -- documations\n- always create a  class\n- existing model ke aander query karna. --`﻿forms.ModelChoiceField(queryset =ChaiVaritys.object.all()`\nit give a dropdown bydefulat .. CharField--char deta bydefualt\n2. views \n- form having 3 field -always check\n    - form shows\n    - user filled  form and submit it then how to handling  if condition handling with Method --put ws templeta rendering **csrf-token** used here --it django middleware querys\n        - form having 3 field -always check\n            - form shows\n            - user filled form and submit it then how to handling if condition handling with Method --put querys\n            - just create a form that user that fill that else case ` form =chaiVarityform()`  \n    - just create a form that user that fill that   else case  `﻿form =chaiVarityform()` \n3. templeta rendering **csrf-token** used here --it django middleware \n \n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvikasutf8%2Fdjango-crafting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvikasutf8%2Fdjango-crafting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvikasutf8%2Fdjango-crafting/lists"}