# chaos_django **Repository Path**: JackyCui666/chaos_django ## Basic Information - **Project Name**: chaos_django - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-05-21 - **Last Updated**: 2025-05-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README [快速开始](https://docs.djangoproject.com/zh-hans/5.1/) [详细](https://docs.djangoproject.com/zh-hans/5.1/topics/) [Django REST framework](https://q1mi.github.io/Django-REST-framework-documentation/) # django ## 安装 0,按照解释器 conda create --name py3.12.2-ibao-django --clone py3.12.2 1,安装Django pip install django -i https://pypi.tuna.tsinghua.edu.cn/simple pip install django python -m django --version 2,创建项目 django-admin startproject chaos_django 3,启动服务 python manage.py runserver http://127.0.0.1:8000/admin/login/ 5,按照依赖 pip install -r requirements.txt 6,初始化数据库 python manage.py migrate ## 创建模块 django-admin startapp auth_app python manage.py makemigrations auth_app python manage.py sqlmigrate auth_app 0001 python manage.py check python manage.py migrate ## shell python manage.py shell ### 增 q = Question(question_text="What's new?", pub_date=timezone.now()) q.save() q.id ### 删 q.delete() ### 改 q.question_text = "What's up?" q.save() ### 查 Question.objects.get(id=2) Question.objects.filter(id=1).all() ### 关联 q = Question.objects.get(pk=1) q.choice_set.all() q.choice_set.count() c = q.choice_set.create(choice_text="Just hacking again", votes=0) c.question cs = Choice.objects.filter(question__pub_date__year=current_year) cs = q.choice_set.filter(choice_text__startswith="Just hacking") c = q.choice_set.get(pk=request.POST["choice"]) ## django-admin python manage.py createsuperuser ## manage 管理相关 python manage.py migrate # 创建表结构 python manage.py makemigrations TestModel # 让 Django 知道我们在我们的模型有一些变更 python manage.py migrate TestModel ## 调试 python -m pip install django-debug-toolbar # drf