Configuration django drf project

  • Create a django project

  • Creating an application example app01

  • Settings.py configuration file
    •   Registration Application (app01 and rest_framework)
INSTALLED_APPS = [
    ...
    'rest_framework',
    'app01'
     ...   
]
    •   Notes csrf Middleware
#中间件
MIDDLEWARE = [
    ...
    # 'django.middleware.csrf.CsrfViewMiddleware',
     ...
]
    • database    
# Database 
DATABASES = {
     ' default ' : {
         ' ENGINE ' : ' django.db.backends.mysql ' ,   # what is written in what is behind the database, I use MySQL 
        ' NAME ' : ' TEST16 ' ,                       # database name 
        ' HOST ' : ' 127.0.0.1 ' ,                     # native domain 
        ' pORT ' : 3306,                            # ports 
        'USER': ' The root ' ,                          # username 
        ' PASSWORD ' : ' the root ' ,                      # password 
    } 
}
    • Internationalization Localization changed      
LANGUAGE_CODE = 'zh-hans'

TIME_ZONE = 'Asia/Shanghai'

USE_I18N = True

USE_L10N = True

USE_TZ = False
    • Static configuration file      
STATICFILES_DIRS = [
    os.path.join(BASE_DIR,'static'),
]

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/u-damowang1/p/12141922.html