尝试一下用“简书”来做进行笔记

2018-01-28  本文已影响0人  zulien

mkvirtualenv store_env # 该命令创建了一个干净的python环境

pip install -r requirements.txt -i https://pypi.douban.com/simple/

ps: requirements.txt实际是由pip freeze > requirements. txt生成的,这个命令是展示对应的已经安装报的python包跟版本

这里配置一个mysql的链接

DATABASES = {

'default': {

    'ENGINE': 'django.db.backends.mysql',                   # 引擎

    'NAME': 'store',                                        # 库名

    'USER': 'root',                                         # 用户名

    'PASSWORD': '123123',                                   # 密码

    'HOST': '192.168.0.243',                                # 地址

    'PORT': '3306',                                         # 端口

}

}

STATICFILES_DIRS = (

os.path.join(BASE_DIR, "static"),

)

ps: 配置好后在页面中随意引用一个静态文件,引用成功则配置OK

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',

            'django.template.context_processors.static'

        ],  

    },

},

]

ALLOWED_HOSTS = ["*"]

上一篇下一篇

猜你喜欢

热点阅读