From d9892785e086b6d8edca35226cc2dac1e8d1c948 Mon Sep 17 00:00:00 2001 From: wyb <1708535614@qq.com> Date: Tue, 15 Oct 2024 17:18:44 +0800 Subject: [PATCH] add project --- django_instance/.gitignore | 1 + django_instance/.idea/.gitignore | 8 ++ django_instance/.idea/django_instance.iml | 27 ++++ .../inspectionProfiles/Project_Default.xml | 6 + .../inspectionProfiles/profiles_settings.xml | 6 + django_instance/.idea/misc.xml | 7 + django_instance/.idea/modules.xml | 8 ++ django_instance/db.sqlite3 | 0 django_instance/django_instance/__init__.py | 0 .../__pycache__/__init__.cpython-312.pyc | Bin 0 -> 171 bytes .../__pycache__/settings.cpython-312.pyc | Bin 0 -> 2543 bytes .../__pycache__/urls.cpython-312.pyc | Bin 0 -> 1032 bytes .../__pycache__/wsgi.cpython-312.pyc | Bin 0 -> 675 bytes django_instance/django_instance/asgi.py | 16 +++ django_instance/django_instance/settings.py | 126 ++++++++++++++++++ django_instance/django_instance/urls.py | 22 +++ django_instance/django_instance/wsgi.py | 16 +++ django_instance/function1/__init__.py | 0 django_instance/function1/admin.py | 3 + django_instance/function1/apps.py | 6 + .../function1/migrations/__init__.py | 0 django_instance/function1/models.py | 3 + django_instance/function1/tests.py | 3 + django_instance/function1/views.py | 3 + django_instance/manage.py | 22 +++ 25 files changed, 283 insertions(+) create mode 100644 django_instance/.gitignore create mode 100644 django_instance/.idea/.gitignore create mode 100644 django_instance/.idea/django_instance.iml create mode 100644 django_instance/.idea/inspectionProfiles/Project_Default.xml create mode 100644 django_instance/.idea/inspectionProfiles/profiles_settings.xml create mode 100644 django_instance/.idea/misc.xml create mode 100644 django_instance/.idea/modules.xml create mode 100644 django_instance/db.sqlite3 create mode 100644 django_instance/django_instance/__init__.py create mode 100644 django_instance/django_instance/__pycache__/__init__.cpython-312.pyc create mode 100644 django_instance/django_instance/__pycache__/settings.cpython-312.pyc create mode 100644 django_instance/django_instance/__pycache__/urls.cpython-312.pyc create mode 100644 django_instance/django_instance/__pycache__/wsgi.cpython-312.pyc create mode 100644 django_instance/django_instance/asgi.py create mode 100644 django_instance/django_instance/settings.py create mode 100644 django_instance/django_instance/urls.py create mode 100644 django_instance/django_instance/wsgi.py create mode 100644 django_instance/function1/__init__.py create mode 100644 django_instance/function1/admin.py create mode 100644 django_instance/function1/apps.py create mode 100644 django_instance/function1/migrations/__init__.py create mode 100644 django_instance/function1/models.py create mode 100644 django_instance/function1/tests.py create mode 100644 django_instance/function1/views.py create mode 100644 django_instance/manage.py diff --git a/django_instance/.gitignore b/django_instance/.gitignore new file mode 100644 index 0000000..3adba3d --- /dev/null +++ b/django_instance/.gitignore @@ -0,0 +1 @@ +*.xml text eol=lf \ No newline at end of file diff --git a/django_instance/.idea/.gitignore b/django_instance/.idea/.gitignore new file mode 100644 index 0000000..35410ca --- /dev/null +++ b/django_instance/.idea/.gitignore @@ -0,0 +1,8 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/django_instance/.idea/django_instance.iml b/django_instance/.idea/django_instance.iml new file mode 100644 index 0000000..3617309 --- /dev/null +++ b/django_instance/.idea/django_instance.iml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/django_instance/.idea/inspectionProfiles/Project_Default.xml b/django_instance/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..03d9549 --- /dev/null +++ b/django_instance/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/django_instance/.idea/inspectionProfiles/profiles_settings.xml b/django_instance/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/django_instance/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/django_instance/.idea/misc.xml b/django_instance/.idea/misc.xml new file mode 100644 index 0000000..db8786c --- /dev/null +++ b/django_instance/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/django_instance/.idea/modules.xml b/django_instance/.idea/modules.xml new file mode 100644 index 0000000..a986059 --- /dev/null +++ b/django_instance/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/django_instance/db.sqlite3 b/django_instance/db.sqlite3 new file mode 100644 index 0000000..e69de29 diff --git a/django_instance/django_instance/__init__.py b/django_instance/django_instance/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/django_instance/django_instance/__pycache__/__init__.cpython-312.pyc b/django_instance/django_instance/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..57feacca4d07b73b26ab00c6b85c3fc3cc29942f GIT binary patch literal 171 zcmX@j%ge<81Qo|Q(?RrO5P=Rpvj9b=GgLBYGWxA#C}INgK7-W!@^Z0?DX1*T$j>V% z%FjwoE`jm_puCi<#Ju$U_{_ZGlEl2^)EIPrJWwjLBtBlRpz;@oO>TZlX-=wL5i8JW SMj$Q*F+MUgGBOr116cs`?=7SN literal 0 HcmV?d00001 diff --git a/django_instance/django_instance/__pycache__/settings.cpython-312.pyc b/django_instance/django_instance/__pycache__/settings.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..707b2b053a3019e0e05046e490b813ac8c5f0e79 GIT binary patch literal 2543 zcmb7G&2!U66qo${9VZwtl!GXgU?_6)0i_J3D7FYLj_pPcX*EnWvUcNakR>C@Nu!fH z(_1gSwFgezI^6qD^g`MLsZN>csW%6v7p8|k*>d7>GSgIJt@eHW-rKkD?fTbbGDgAk z%Wu)<%@jrb=@P>y0J_`G=|0O-p+K3L#4!W-H#}h+<8OEU@CQTu~7(oFs+N8u-lS084v>1nP2)+pv7LzCfQ~-e-#a_^aM)Bu? zCM~8=LYzQJl)@o2VaF*7rJwr* zyk}5WJiC1^cV3={WyXpdvewiY6I&M1nkKWR8w~36B%+y?tSOjj8~O%TEH)Nf#2Pka z3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vh8%xkqSf$L}L~tR7gZa3|~BZ4EGtGC2`J?Oc=H8=W`4XbDm~MO3bM^glQrq48Bb8E8)Ts>oL!uPz0g~F{EWSlKh{6)SJ<4gQ*;Qpr&|Meak0OXDOi0GK^dX#aMj%-R zD9h^LTK>&Czie4Gu-2jaRW&;w^!vlQuQ?-l2q_}?ZeQDd$KFqo5Ia-VShR-vKNd{R zG1o-gQmBT`BZXD6zaSf(?;;Uskb(0TqXQbId6dvtiBQ(lt%d3`8+{H+VW6U-u1DwM zfdgl?lzt^wbser2ydhcV4oguk%yycx*i!;FmHIkR;`SZK{-I~lF^V>dNJ5oiX~kc6 zO4obhY!(|qpyne8ie61gbs~8((Ou)o_0klUNF**SO}yx?UFLgmrfZ##9{7`N zDd&vVvsQagtI3;GfWJ54A72Bz+46kz4q;KA;(NTOU=8(%9rZeC8HRCc_6+OiHDFx- j2CklVKzr-$m3OyS{;|K>JKp<1g literal 0 HcmV?d00001 diff --git a/django_instance/django_instance/__pycache__/wsgi.cpython-312.pyc b/django_instance/django_instance/__pycache__/wsgi.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6c639c709d989093bdcf5181dfc515a1ef6d288d GIT binary patch literal 675 zcmZWnL2DC16rS0QP2JcaVvEN?yaaT&rMDu2kT#@hDx@NW!e+YjvY9YDv+PXMrnjE_ z3H}6;{typdDhk40RK$ZfCAXfO?IyI;cbNCRdGp@)y~li9TJn&!qYpRZcNn3cMKHI@ z3{3Yec#9b7A%>YFa1UGW3MX-UE=GVyi}R98KdN2gIbs!dQl&u?GXzo=QX%NR075mP zBvI@@z#{=;5M)d_Lnx=wB)Nm#HecNx#vLz}5!lflnE)qmZ+nj4M-~t{J z4d4xpN%ck$FcoRPR5#ZYsU!dytov)hP#qc-Fi3@(Bp^+2sAC>@zl(7@4V>SN!Gy(K zctu9O(%gR9Y3+pF&E4I0r_~K#>@;6J-#or|Z415zW4MfUqncO4&`Jrz+)+BeT|V?9 zJBMGi&sreyBfLIwkRAWUAn!u%dh3uWh9&5gZuVuni2W|~DW%dPKS)A3(i zQ2OcQeDQI)`zKl5wzdBX=~a9DaWTe!ohq(O?;z~`LTlfV^Ts>zzM|z%X!&f#KU>}Y Sf}Z`T-~U{Ha8k=|*`j|grppij literal 0 HcmV?d00001 diff --git a/django_instance/django_instance/asgi.py b/django_instance/django_instance/asgi.py new file mode 100644 index 0000000..777c78a --- /dev/null +++ b/django_instance/django_instance/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for django_instance project. + +It exposes the ASGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_instance.settings') + +application = get_asgi_application() diff --git a/django_instance/django_instance/settings.py b/django_instance/django_instance/settings.py new file mode 100644 index 0000000..bcd445e --- /dev/null +++ b/django_instance/django_instance/settings.py @@ -0,0 +1,126 @@ +""" +Django settings for django_instance project. + +Generated by 'django-admin startproject' using Django 3.1.4. + +For more information on this file, see +https://docs.djangoproject.com/en/3.1/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/3.1/ref/settings/ +""" + +from pathlib import Path + +# Build paths inside the project like this: BASE_DIR / 'subdir'. +BASE_DIR = Path(__file__).resolve().parent.parent +print(BASE_DIR) +# Django项目的绝对路径 D:\pythonproject\pythonProject\django_instance + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'f2c=wg+_8(^vc(pb22$g45jinq_z6jgva@93b$de5_a&ly32@+' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] +# 设置运行访问本项目的地址列表,如果为空,则只有本机访问,设置为*,表示任何客户端都允许访问 + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', +] +# 已安装的应用,如有自定义应用的话,需要在此注册,如果不注册,则无法使用 + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] +# 注册中间件 + +ROOT_URLCONF = 'django_instance.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] +# 指定模板信息 + +WSGI_APPLICATION = 'django_instance.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/3.1/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': BASE_DIR / 'db.sqlite3', + } +} +# 数据库引擎配置,默认为 db.sqlite3 + + +# Password validation +# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/3.1/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/3.1/howto/static-files/ + +STATIC_URL = '/static/' diff --git a/django_instance/django_instance/urls.py b/django_instance/django_instance/urls.py new file mode 100644 index 0000000..b813ee5 --- /dev/null +++ b/django_instance/django_instance/urls.py @@ -0,0 +1,22 @@ +"""django_instance URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/3.1/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: path('', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.urls import include, path + 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) +""" +from django.contrib import admin +from django.urls import path + +urlpatterns = [ + path('admin/', admin.site.urls),# 初始路由 + # 在浏览器中输入127.0.0.1:8000/admin时,先经过urls文件,找到对应路由(admin),再执行该路由对应的视图(admin.site.urls) +] diff --git a/django_instance/django_instance/wsgi.py b/django_instance/django_instance/wsgi.py new file mode 100644 index 0000000..0324dcc --- /dev/null +++ b/django_instance/django_instance/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for django_instance project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_instance.settings') + +application = get_wsgi_application() diff --git a/django_instance/function1/__init__.py b/django_instance/function1/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/django_instance/function1/admin.py b/django_instance/function1/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/django_instance/function1/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/django_instance/function1/apps.py b/django_instance/function1/apps.py new file mode 100644 index 0000000..4d0e682 --- /dev/null +++ b/django_instance/function1/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class Function1Config(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'function1' diff --git a/django_instance/function1/migrations/__init__.py b/django_instance/function1/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/django_instance/function1/models.py b/django_instance/function1/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/django_instance/function1/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/django_instance/function1/tests.py b/django_instance/function1/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/django_instance/function1/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/django_instance/function1/views.py b/django_instance/function1/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/django_instance/function1/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/django_instance/manage.py b/django_instance/manage.py new file mode 100644 index 0000000..8b69e76 --- /dev/null +++ b/django_instance/manage.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +"""Django's command-line utility for administrative tasks.""" +import os +import sys + + +def main(): + """Run administrative tasks.""" + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_instance.settings') + try: + from django.core.management import execute_from_command_line + except ImportError as exc: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) from exc + execute_from_command_line(sys.argv) + + +if __name__ == '__main__': + main()