zoukankan      html  css  js  c++  java
  • 腾讯云python网站开发环境搭建

    前段时间腾讯云做活动,于是就花了几百大洋买了三年的云服务,准备在上 面安装python web的开发环境,下面将安装过程做一个总结,希望能够帮助大家.

    一、使用环境
     
    使用的软件环境为:CentOS7.2 | Python2.7 | Django1.11
     
    二、安装软件
     
    2.1  查看python安装版本
     python --version
     
     2.2 安装pip
    wget https://pypi.python.org/packages/6f/10/5398a054e63ce97921913052fde13ebf332a3a4104c50c4d7be9c465930e/setuptools-26.1.1.zip#md5=f81d3cc109b57b715d46d971737336db
    # unzip setuptools-26.1.1.zip
    # cd setuptools-26.1.1
    wget https://bootstrap.pypa.io/get-pip.py --no-check-certificate
    python get-pip.py
     
    2.3 安装django
    pip install django
    pip install django==1.11.7 #指定版本号
    安装完成后,可以通过如下命令查看版本号:
    python
    >>> import django
    >>> django.VERSION (1, 11, 11, u'final', 0)
     
    2.4 安装apache服务
    yum install httpd -y
    启动服务:service httpd start
    停止服务:service httpd stop
    重启服务:service httpd restart
    严重apache是否正常,只要在客户端浏览器输入:http:\IP:POR即可
     
    2.5 安装mysql服务器
    tar -zxvf PyMySQL-0.7.11.tar.gz
    cd PyMySQL-0.7.11
    python setup.py install
    到此为止,基本的工具已经安装完毕,下面是创建和配置mysql
     
    三、mysq配置
     
    3.1 修改配置文件
    root@test etc]# vi my.cnf
    [mysqld] port=修改端口号
    datadir=/var/lib/mysql
    socket=/var/lib/mysql/mysql.sock
    user=mysql # Disabling symbolic-links is recommended to prevent assorted security risks
    symbolic-links=0
    [mysqld_safe]
    log-error=/var/log/mysqld.log
    pid-file=/var/run/mysqld/mysqld.pid
    4. 重新启动mysql
    [root@test ~]# mysqld restart service mysqld restart
     
    3.2 创建数据库和赋权
    CREATE USER data@localhost IDENTIFIED BY 'data’;
    grant all on data to 'data'@'localhost’;
    FLUSH PRIVILEGES;
     
    3.3 mysql登录
    mysql -udata -pdata
     
    四、创建APP.
     
    4.1、创建项目:
     django-admin startproject <网站名称>
     
    4.2、运行网站:
    python manage.py runnserver
     
    到此为止,就可以在部署的机器上面开发django网站了,是不是很爽.
  • 相关阅读:
    POJ 1401 Factorial
    POJ 2407 Relatives(欧拉函数)
    POJ 1730 Perfect Pth Powers(唯一分解定理)
    POJ 2262 Goldbach's Conjecture(Eratosthenes筛法)
    POJ 2551 Ones
    POJ 1163 The Triangle
    POJ 3356 AGTC
    POJ 2192 Zipper
    POJ 1080 Human Gene Functions
    POJ 1159 Palindrome(最长公共子序列)
  • 原文地址:https://www.cnblogs.com/newzol/p/8682176.html
Copyright © 2011-2022 走看看