{"id":27374520,"url":"https://github.com/prathicashettym/chaistore","last_synced_at":"2026-04-11T02:55:33.232Z","repository":{"id":267060849,"uuid":"802719294","full_name":"PrathicaShettyM/ChaiStore","owner":"PrathicaShettyM","description":"This is a simple Chai Store for learning Django","archived":false,"fork":false,"pushed_at":"2024-12-09T10:27:36.000Z","size":784,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-13T11:58:17.754Z","etag":null,"topics":["django","html","sqlite","tailwindcss"],"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/PrathicaShettyM.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":"2024-05-19T04:33:30.000Z","updated_at":"2025-02-28T01:13:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"68d8e665-9581-4c7d-8ab7-3eeaf6f844de","html_url":"https://github.com/PrathicaShettyM/ChaiStore","commit_stats":null,"previous_names":["prathicashettym/django-backend","prathicashettym/chaistore"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PrathicaShettyM%2FChaiStore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PrathicaShettyM%2FChaiStore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PrathicaShettyM%2FChaiStore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PrathicaShettyM%2FChaiStore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PrathicaShettyM","download_url":"https://codeload.github.com/PrathicaShettyM/ChaiStore/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248710436,"owners_count":21149188,"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","html","sqlite","tailwindcss"],"created_at":"2025-04-13T11:58:18.606Z","updated_at":"2026-04-11T02:55:33.203Z","avatar_url":"https://github.com/PrathicaShettyM.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Django-Backend\nThis is a popular python web framework for rapidly building web applications\n\n## Table of Contents\n- [First time Installation](#first-time-installation)\n- [Subsequent running](#to-run-subsequent-timesafter-restarting-the-system)\n- [Django architecture](#django-architecture)\n- [Setting up Static and Template folders](#setting-up-static-and-template-folders-for-use)\n- [Tailwind CSS with Django](#tailwindcss-with-django)\n- [Django Templates]()\n\n\n## First-time Installation\nWe need `uv` package manager\n1. Set a virtual environment for the django project with the command(open bash)\n```\nuv venv\n```\n2. Activate the virtual environment\n```\nsource .venv/Scripts/activate\n```\n3. If you face any error in Windows OS, open the `windows-powershell` as an `administrator` and type the following command\n```\nset-exectionpolicy remotesigned\n```\n4. Install Django with the command\n```\nuv pip install Django\n```\n5. Create a new Django project\n```\ndjango-admin startproject MyApp\n```\n6. Come inside the project folder\n```\ncd MyApp\n```\n7. Run the Django server\n```\npython manage.py runserver \n```\n- Use the above command whenever you want to restart the server(Dont forget to navigate to the manage.py's directory)\n\n- If some the port is blocked for some reason then use a port number\n```\npython manage.py runserver 8001\n```\n\n\n## To run subsequent times(After restarting the system)\nYou will need to use the following commands \n```\nsource .venv/Scripts/activate\n\ncd MyApp\n\npython manage.py runserver\n```\n- Note: If you are not restarting the system, then use `py manage.py runserver` command\n\n# Django Architecture\n\n1. A project with the desired name is created, along a subfolder with the same name which contains - \n`views.py`: contains the core functionalities of the application(contains logic)\n`urls.py`: contains all routes\n`settings.py`: contains all settings\n\n2. `db.sqlite3` is a default database for django which can also be migrated to `postgres` and `mysql`\n\n3. `manage.py` is the starting point of the application. It is the server\n\n4. `static folder` contains `css` and `js` files\n\n5. `templates folder` contains `html` files \n\n\n## Setting up static and template folders for use\n\n1. change this in `settings.py` to load `css` and `js` files\n```\nSTATIC_URL = 'static/'\nSTATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]\n```\n\n2. In `index.html` do the following changes\n```\n{% load static %}\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n    \u003cmeta charset=\"UTF-8\"\u003e\n    \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"\u003e\n    \u003ctitle\u003eMyApp | Django project\u003c/title\u003e\n    \u003clink rel=\"stylesheet\" href=\"{% static 'style.css' %}\"\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n    \u003ch1\u003eThis is a Django project\u003c/h1\u003e\n    \n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n3. In `views.py` do the following to render the html file on the browser\n```\ndef home(request):\n    return render(request, 'website/index.html')\n```\n\n## TailwindCSS with Django\n1. Install `pip` and then `tailwind css`\n- Whichever the below command works use it\n- command 1\n```\npy -m ensurepip --upgrade\n```\n- command 2\n```\npy -m pip install --upgrade pip\n```\n\n```\npip install django-tailwind\n```\nNote: use both when needed\n\n2. Install `tailwind css` with the following command\n```\npip install 'django-tailwind[reload]'\n```\n3. Go to `settings.py` and in apps object, add 'tailwind'\n\n4. Use this command to initiate tailwind in the server. Some packages will be installed along with a folder named `theme` if you keep the default settings\n- Go to `settings.py` and in apps object, add 'theme'\n```\npy manage.py tailwind init\n```\n5. Go to `settings.py` and add 'theme' in the app section\n6. Next below it give the name of the tailwind app and `InternalIP`\n```\nTAILWIND_APP_NAME = 'theme'\nINTERNAL_IPS = ['127.0.0.1']\nNPM_BIN_PATH = 'C:/Program Files/nodejs/npm.cmd'\n```\n7. Use the command \n```\npython manage.py tailwind install\n```\n8. Inject the tailwind commands from the base.hmtl of `theme` folder into layout.html file in MyApp\n```\n{% load static tailwind_tags %}\n\n{% tailwind_css %}\n```\n9. Open one more terminal(it also has to be bash) and name it `tailwind` and run this command\n```\n python manage.py tailwind start\n```\n10. In the normal terminal where the django app is running, restart the server over there. Now tailwind starts generating css\n\n11. Do the following in `settings.py` to enable hot reloading\n```\nMIDDLEWARE = [\n    \"django_browser_reload.middleware.BrowserReloadMiddleware\"\n]\n\nINSTALLED_APPS = [\n    \"chai\",\n    \"tailwind\",\n    \"theme\",\n    \"django_browser_reload\"\n]\n```\n\n12. Do this in `views.py` of MyApp\n```\nurlpatterns = [\n\n    path(\"__reload__/\", include(\"django_browser_reload.urls\")), \n]\n\n```\n\n## Superuser and admin\n1. Due migrations get migrated. After this command we wont get the inital erros\n```\npython manage.py migrate\n```\n2. Inorder to change password\n```\n python manage.py changepassword username\n```\n3. Enter the new password\n\n## Jinja2 and Django apps\n\n1. Create a new project in the folder\n```\npython manage.py startapp chai\n```\n\n2. Go to settings add emmet for django-html\n\n3. Create layouts and inject code\n```\n{% extends \"layout.html\" %}\n\n{% block title %}\n    all chai page | index.html title\n{% endblock %}\n\n{% block content %}\n    \u003ch1\u003eWhich chai would u like to have ? \u003c/h1\u003e\n{% endblock %}\n```\n\n## Database Modelling\n1. To handle image upload install\n```\npython -m pip install Pillow\n```\n2. Add the following in `settings.py` of MyApp\n```\nMEDIA_URL = '/media/'\nMEDIA_ROOT = os.path.join(BASE_DIR, 'media')\n```\n3. Add these lines in `urls.py` in MyApp\n```\nfrom django.conf import settings\nfrom django.conf.urls.static import static\n\nurlpatterns = [\n    ...\n] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)\n```\n4. Migrate the model\n```\npython manage.py makemigrations chai\n```\n- Make sure you run this command after every change to schema and then the other command\n```\npython manage.py makemigrations chai\n```\n```\npython manage.py migrate\n```\n\n\n- Note: we are writing models in the chai folder\n\n5. Register model\n```admin.py\u003echai\nfrom django.contrib import admin\nfrom .models import ChaiVariety\n\n# Register the models to database\nadmin.site.register(ChaiVariety)\n```\n\n6. Register the users in admin route","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprathicashettym%2Fchaistore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprathicashettym%2Fchaistore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprathicashettym%2Fchaistore/lists"}