• django1.9安装以及使用


    安装setuptools
    wget --no-check-certificate https://pypi.python.org/packages/69/56/f0f52281b5175e3d9ca8623dadbc3b684e66350ea9e0006736194b265e99/setuptools-38.2.4.zip#md5=e8e05d4f8162c9341e1089c80f742f64
    unzip setuptools-38.2.4.zip
    cd setuptools-38.2.4
    python setup.py install
    cd ..

    安装pip
    wget --no-check-certificate https://github.com/pypa/pip/archive/1.5.5.tar.gz
    tar -xvf 1.5.5.tar.gz #解压文件
    cd pip-1.5.5/
    python setup.py install

    常用模块安装:

    如mysql mako等等安装软件很多的情况下,可以将模块版本填写到一个文本文档,一次性安装:

    PS:其中安装mysql模块会报错,需要提前安装以下两个模块:

    yum install -y python-devel mysql-devel openldap-devel

    vim requirements.txt

    django==1.9
    django
    -crispy-forms==1.6.0 django-import-export==0.5.1 django-reversion==2.0.12 django-formtools==1.0 future==0.15.2 MySQL-python==1.2.3 MarkupSafe==0.23 Mako==1.0.1 httplib2==0.9.1 suds==0.4 celery==3.1.18 django-celery==3.1.16 requests==2.0.1 SQLAlchemy==0.8.2 Tempita==0.5.1 amqp==1.4.6 anyjson==0.3.3 chardet==2.2.1 meld3==1.0.0 mimeparse==0.1.3 mysqlclient==1.3.4 paramiko==1.9.0 pep8==1.3.3 poster==0.8.1 pycrypto==2.3 pyparsing==2.0.3 python-dateutil==1.5 python-memcached==1.48 six==1.6.1 supervisor==3.0 wsgiref==0.1.2 Pillow==2.9.0 line-profiler==1.0 python-ldap==2.5.2 django-auth-ldap==1.3.0 pytz
    async==0.6.1
     

    安装命令:

    pip install -r requirements.txt

    django使用:

    创建项目:

    django-admin startproject myproject
    cd myproject

    创建app:

    django-admin startapp myapp

    启动app:
    python manage.py runserver 172.16.5.112:8000 &

    以下是django1.11.8+python3.6.4的安装:

    Django==1.11.8
    certifi==2017.11.5
    chardet==3.0.4
    codegen==1.0
    diff-match-patch==20121119
    django-auth-ldap==1.3.0
    django-auth-ldap3==0.9.6
    django-crispy-forms==1.6.0
    django-filter==1.1.0
    django-formtools==2.0
    django-import-export==0.5.1
    django-reversion==2.0.12
    djangorestframework==3.7.7
    et-xmlfile==1.0.1
    future==0.15.2
    httpie==0.9.9
    httplib2==0.9.2
    idna==2.6
    jdcal==1.3
    ldap3==2.4
    Mako==1.0.7
    Markdown==2.6.10
    MarkupSafe==1.0
    odfpy==1.3.6
    openpyxl==2.4.9
    patterns==0.3
    pip==9.0.1
    pyasn1==0.4.2
    Pygments==2.2.0
    pyldap==2.4.45
    PyMySQL==0.8.0
    pytz==2017.3
    PyYAML==3.12
    requests==2.18.4
    six==1.10.0
    tablib==0.12.1
    unicodecsv==0.14.1
    urllib3==1.22
    virtualenv==15.1.0
    xlrd==1.1.0
    xlwt==1.3.0
    

      

    python3.6.4后MySQL-python不在使用,需要连接mysql需要安装pymysql

    ln -s /usr/local/python3/lib/python3.6/site-packages/django/bin/django-admin.py /usr/local/bin
    ALLOWED_HOSTS = ['198.211.99.20', 'localhost', '127.0.0.1']
    import pymysql
    pymysql.install_as_MySQLdb()
    cp configparser.py ConfigParser.py

  • 相关阅读:
    jbpm 为任务自由选择办理人
    我永远的 dell 15r
    select radio readonly
    面向对象的5条基本设计原则
    Java数据库缓存思路
    作为java应届生,面试求职那点事
    项目开发中数据字典设计实现缓存
    oracle 优化 —— 分区表
    myeclipse快捷键
    win8 安装myeclipse 失败 MyEclipse ForSpring 安装失败
  • 原文地址:https://www.cnblogs.com/cjsblogs/p/8023014.html
Copyright © 2020-2023  润新知