Django项目:CRM(客户关系管理系统)--10--04PerfectCRM实现King_admin注册功能02
from django import conf #配置文件
print("dj conf:",conf) #配置文件
print("dj conf:",conf.settings)#配置文件.设置
for app in conf.settings.INSTALLED_APPS:#配置文件.设置.安装应用程序#.Perfectcustomer\settings里的INSTALLED_APPS列表
print("import",__import__(app))#循环打印 动态加载类和函数
1 #app_config.py 2 from django import conf #配置文件 3 # print("dj conf:",conf) #配置文件 4 # print("dj conf:",conf.settings)#配置文件.设置 5 6 # for app in conf.settings.INSTALLED_APPS:#配置文件.设置.安装应用程序#.Perfectcustomer\settings里的INSTALLED_APPS列表 7 # print("import",__import__(app))#循环打印 动态加载类和函数 8 9 10 for app in conf.settings.INSTALLED_APPS: 11 try: 12 print("import ",__import__("%s.kingadmin" % app)) 13 except ImportError as e: 14 print("app has no module kingadmin 不存在")
1 from django.shortcuts import render 2 3 # from django import conf #配置文件 4 # print("dj conf:",conf) #配置文件 5 # print("dj conf:",conf.settings)#配置文件.设置 6 7 from king_admin import app_config #自动调用 动态加载类和函数 8 9 def app_index(request): 10 # for app in conf.settings.INSTALLED_APPS: 11 # print(app)#循环打印 配置文件.设置.安装应用程序#.Perfectcustomer\settings里的INSTALLED_APPS列表 12 return render(request, 'king_admin/app_index.html')
1 """ 2 Django settings for PerfectCRM project. 3 4 Generated by 'django-admin startproject' using Django 2.0.3. 5 6 For more information on this file, see 7 https://docs.djangoproject.com/en/2.0/topics/settings/ 8 9 For the full list of settings and their values, see 10 https://docs.djangoproject.com/en/2.0/ref/settings/ 11 """ 12 13 import os 14 15 # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 16 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17 18 19 # Quick-start development settings - unsuitable for production 20 # See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/ 21 22 # SECURITY WARNING: keep the secret key used in production secret! 23 SECRET_KEY = 'atkhzsd7emv4_okn@ynhji)p)qbpuvhq+a7@yx5=chaa0$l_br' 24 25 # SECURITY WARNING: don't run with debug turned on in production! 26 DEBUG = True 27 28 ALLOWED_HOSTS = [] 29 30 31 # Application definition 32 33 INSTALLED_APPS = [ 34 'django.contrib.admin', 35 'django.contrib.auth', 36 'django.contrib.contenttypes', 37 'django.contrib.sessions', 38 'django.contrib.messages', 39 'django.contrib.staticfiles', 40 'crm', 41 'king_admin', 42 ] 43 44 MIDDLEWARE = [ 45 'django.middleware.security.SecurityMiddleware', 46 'django.contrib.sessions.middleware.SessionMiddleware', 47 'django.middleware.common.CommonMiddleware', 48 'django.middleware.csrf.CsrfViewMiddleware', 49 'django.contrib.auth.middleware.AuthenticationMiddleware', 50 'django.contrib.messages.middleware.MessageMiddleware', 51 'django.middleware.clickjacking.XFrameOptionsMiddleware', 52 ] 53 54 ROOT_URLCONF = 'PerfectCRM.urls' 55 56 TEMPLATES = [ 57 { 58 'BACKEND': 'django.template.backends.django.DjangoTemplates', 59 60 # 'DIRS': [os.path.join(BASE_DIR, 'templates')] 61 # , 62 63 'DIRS': [os.path.join(BASE_DIR, 'templates'), 64 os.path.join(BASE_DIR, 'king_admin/king_templates'), 65 os.path.join(BASE_DIR, 'DBadd/DBadd_templates'), ] 66 67 , 68 69 'APP_DIRS': True, 70 'OPTIONS': { 71 'context_processors': [ 72 'django.template.context_processors.debug', 73 'django.template.context_processors.request', 74 'django.contrib.auth.context_processors.auth', 75 'django.contrib.messages.context_processors.messages', 76 ], 77 }, 78 }, 79 ] 80 81 WSGI_APPLICATION = 'PerfectCRM.wsgi.application' 82 83 84 # Database 85 # https://docs.djangoproject.com/en/2.0/ref/settings/#databases 86 87 DATABASES = { 88 'default': { 89 'ENGINE': 'django.db.backends.sqlite3', 90 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 91 } 92 } 93 94 95 # Password validation 96 # https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators 97 98 AUTH_PASSWORD_VALIDATORS = [ 99 { 100 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 101 }, 102 { 103 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 104 }, 105 { 106 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 107 }, 108 { 109 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 110 }, 111 ] 112 113 114 # Internationalization 115 # https://docs.djangoproject.com/en/2.0/topics/i18n/ 116 117 #LANGUAGE_CODE = 'en-us' 118 119 #英文转中文方法 120 LANGUAGE_CODE = 'zh-Hans' 121 122 TIME_ZONE = 'UTC' 123 124 USE_I18N = True 125 126 USE_L10N = True 127 128 USE_TZ = True 129 130 131 # Static files (CSS, JavaScript, Images) 132 # https://docs.djangoproject.com/en/2.0/howto/static-files/ 133 134 STATIC_URL = '/static/' 135 136 STATICFILES_DIRS = [os.path.join(BASE_DIR,'king_admin/static'),]
您的资助是我最大的动力!
金额随意,欢迎来赏!
如果,您希望更容易地发现我的新博客,不妨点击一下绿色通道的
因为,我的写作热情也离不开您的肯定支持,感谢您的阅读,我是【颜言】!