• Django项目:CRM(客户关系管理系统)--03--02PerfectCRM创建ADMIN页面01


    八.CRM项目创建king_admin

    python.exe manage.py startapp king_admin

     

     

    'king_admin',

     

    九.CRM项目分发URL

     1 """PerfectCRM URL Configuration
     2 
     3 The `urlpatterns` list routes URLs to views. For more information please see:
     4     https://docs.djangoproject.com/en/2.0/topics/http/urls/
     5 Examples:
     6 Function views
     7     1. Add an import:  from my_app import views
     8     2. Add a URL to urlpatterns:  path('', views.home, name='home')
     9 Class-based views
    10     1. Add an import:  from other_app.views import Home
    11     2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
    12 Including another URLconf
    13     1. Import the include() function: from django.urls import include, path
    14     2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
    15 """
    16 from django.contrib import admin
    17 from django.urls import path
    18 
    19 from django.conf.urls import url  # URL
    20 from django.conf.urls import include # 分发URL
    21 
    22 urlpatterns = [
    23     path('admin/', admin.site.urls),
    24     url(r'^king_admin/', include("king_admin.king_urls")),#自定义admin
    25 ]
    URLs

    1 from django.conf.urls import url
    2 from king_admin import views
    3 
    4 urlpatterns = [
    5     url(r'^$', views.app_index),
    6 ]
    king_urls

      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.apps.CrmConfig',
     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         ,
     66 
     67         'APP_DIRS': True,
     68         'OPTIONS': {
     69             'context_processors': [
     70                 'django.template.context_processors.debug',
     71                 'django.template.context_processors.request',
     72                 'django.contrib.auth.context_processors.auth',
     73                 'django.contrib.messages.context_processors.messages',
     74             ],
     75         },
     76     },
     77 ]
     78 
     79 WSGI_APPLICATION = 'PerfectCRM.wsgi.application'
     80 
     81 
     82 # Database
     83 # https://docs.djangoproject.com/en/2.0/ref/settings/#databases
     84 
     85 DATABASES = {
     86     'default': {
     87         'ENGINE': 'django.db.backends.sqlite3',
     88         'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
     89     }
     90 }
     91 
     92 
     93 # Password validation
     94 # https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators
     95 
     96 AUTH_PASSWORD_VALIDATORS = [
     97     {
     98         'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
     99     },
    100     {
    101         'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    102     },
    103     {
    104         'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    105     },
    106     {
    107         'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    108     },
    109 ]
    110 
    111 
    112 # Internationalization
    113 # https://docs.djangoproject.com/en/2.0/topics/i18n/
    114 
    115 #LANGUAGE_CODE = 'en-us'
    116 
    117 #英文转中文方法
    118 LANGUAGE_CODE = 'zh-Hans'
    119 
    120 TIME_ZONE = 'UTC'
    121 
    122 USE_I18N = True
    123 
    124 USE_L10N = True
    125 
    126 USE_TZ = True
    127 
    128 
    129 # Static files (CSS, JavaScript, Images)
    130 # https://docs.djangoproject.com/en/2.0/howto/static-files/
    131 
    132 STATIC_URL = '/static/'
    133 
    134 STATICFILES_DIRS = [os.path.join(BASE_DIR,'king_admin/static'),]
    settings.py

  • 相关阅读:
    windows端口占用处理方法
    【接口】接口测试常见响应码类型(二)
    【接口】SpringBoot+接口开发(一)
    【java+selenium3】Tesseract-OCR识别图片验证码 (十六)
    java读写Txt文件
    【java+selenium3】自动化基础小结+selenium原理揭秘 (十七)
    【java+selenium3】自动化cookie操作+图形验证码处理 (十五)
    【java+selenium3】自动化截图 (十四)
    【Java+selenium3】 Firefox/ IE/ Chrome主流浏览器自动化环境搭建(一)
    【java+selenium3】自动化处理文件上传 (十三)
  • 原文地址:https://www.cnblogs.com/ujq3/p/8553936.html
Copyright © 2020-2023  润新知