zoukankan      html  css  js  c++  java
  • python 项目随笔-1

    python 版本:2.7.13  
    django 版本:1.9.8
    pycharm使用
      运行环境 tool -->Run manage.py Task 进入manage.py 的操作
      配置浏览器运行 run-->Edit Configurations...
      标记资源: 设置这个之后,可以没有引入对应的文件不会报错 选中文件夹-->右键-->mark Directory as--> Sources Root
             设置这个之后,写页面的时候可以快速引入 选中文件夹-->右键-->mark Directory as--> Template Folder

              
      

    1.文件结构
    apps --存放app的位置
    log --存放日志的位置、
    static --存放静态资源,如js,css,img
    media --存放视频资源
    2.安装mysql-python
    http://blog.csdn.net/u012882134/

    到python2 中, pip install mysql-python
    报错处理: http://blog.csdn.net/u012882134/
    找到 http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python
    搜索 mysql-python ,找到对应的mysql-python版本
    下载文件
    32位 MySQL_python‑1.2.5‑cp27‑none‑win32.whl
    64位 MySQL_python‑1.2.5‑cp27‑none‑win_amd64.whl
    放到python2文件夹中,执行
    32位 pip install MySQL_python‑1.2.5‑cp27‑none‑win32.whl
    64位 pip install MySQL_python‑1.2.5‑cp27‑none‑win_amd64.whl
    3.设置mysql连接
    setting.py
    DATABASES = {
    'default': {
    'ENGINE': 'django.db.backends.mysql',
    'NAME': "testdjango",
    'USER':"root",
    'PASSWORD':"123456",
    'HOST':"127.0.0.1",
    }
    }

    4.设置静态资源路径
    setting.py
    STATICFILES_DIRS=[
    os.path.join(BASE_DIR,'static')
    ]


  • 相关阅读:
    Cheatsheet: 2012 03.23 ~ 03.31
    Cheatsheet: 2012 04.13 ~ 04.24
    Cheatsheet: 2012 02.09 ~ 02.29
    Cheatsheet: 2012 03.01 ~ 03.12
    Cheatsheet: 2012 03.13 ~ 03.22
    Cheatsheet: 2012 01.20 ~ 01.31
    Cheatsheet: 2012 04.01 ~ 04.12
    Cheatsheet: 2012 04.25 ~ 05.03
    Cheatsheet: 2012 01.10 ~ 01.19
    1.30
  • 原文地址:https://www.cnblogs.com/luoyeyue/p/7420704.html
Copyright © 2011-2022 走看看