码迷,mamicode.com
首页 > 其他好文 > 详细

django初识

时间:2018-09-01 23:46:59      阅读:188      评论:0      收藏:0      [点我收藏+]

标签:发送   server   path   目录   start   sed   auth   star   span   

1,创建django项目

django-admin startproject 项目名称,

2,进入项目目录

cd 项目名称

3,启动socket服务端,等待用户发送请求

python manage.py runserver  ip:por

 

 csrf注释

 配置template路径

技术分享图片
TEMPLATES = [
    {
        BACKEND: django.template.backends.django.DjangoTemplates,
        DIRS: [os.path.join(BASE_DIR, templates)],
        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,
            ],
        },
    },
]
View Code

 配置静态文件路径

技术分享图片
STATIC_URL = /static/

STATICFILES_DIRS=[
    os.path.join(BASE_DIR,static),
]
View Code

配置数据库

技术分享图片
DATABASES = {
    default: {
        ENGINE: django.db.backends.mysql,
        NAME: sms,
        USER:root,
        PASSWORD:2016191047,
        HOST:127.0.0.1,
        PORT:3306
    }
}
View Code

 

django初识

标签:发送   server   path   目录   start   sed   auth   star   span   

原文地址:https://www.cnblogs.com/liuhongshuai/p/9571713.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!