nginx+uwsgi配置生产环境
nginx :端口转发, 配置用户访问
安装之前 先
apt-get update安装nginx
sudo apt-get install nginx
sudo apt-get install nginx
查看,进程是否启动 ps aux|grep nginx
ifconfig
访问
接下来是安装mysql ,我之前已经安装了,跳过
看一下 mysql 进程是否启动
ps aux|grep mysql
进入mysql : mysql -u root -p
grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;
flush privileges;
*.* : 数据库及表指定
==================================
安装虚拟环境
pip install virtualenv
pip install virtualenv sudo apt-get install python-virtualenv
pip install virtualenvwrapper
pip install virtualenvwrapper
报错:
root@www:~# clear root@www:~# pip install virtualenvwrapper Downloading/unpacking virtualenvwrapper http://mirrors.aliyun.com/pypi/simple/virtualenvwrapper/ uses an insecure transport scheme (http). Consider using https if mirrors.aliyun.com has it available Downloading virtualenvwrapper-4.8.4.tar.gz (334kB): 334kB downloaded Running setup.py (path:/tmp/pip_build_root/virtualenvwrapper/setup.py) egg_info for package virtualenvwrapper /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'requires_python' warnings.warn(msg) /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'long_description_content_type' warnings.warn(msg) /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'project_urls' warnings.warn(msg) /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'python_requires' warnings.warn(msg) Installed /tmp/pip_build_root/virtualenvwrapper/pbr-5.5.1-py2.7.egg [pbr] Processing SOURCES.txt warning: LocalManifestMaker: standard file '-c' not found warning: no previously-included files found matching '.gitignore' warning: no previously-included files found matching '.gitreview' warning: no previously-included files matching '*.pyc' found anywhere in distribution Requirement already satisfied (use --upgrade to upgrade): virtualenv in /usr/local/lib/python2.7/dist-packages (from virtualenvwrapper) Downloading/unpacking virtualenv-clone (from virtualenvwrapper) http://mirrors.aliyun.com/pypi/simple/virtualenv-clone/ uses an insecure transport scheme (http). Consider using https if mirrors.aliyun.com has it available Downloading virtualenv_clone-0.5.4-py2.py3-none-any.whl Downloading/unpacking stevedore (from virtualenvwrapper) http://mirrors.aliyun.com/pypi/simple/stevedore/ uses an insecure transport scheme (http). Consider using https if mirrors.aliyun.com has it available Downloading stevedore-3.3.0.tar.gz (513kB): 513kB downloaded Running setup.py (path:/tmp/pip_build_root/stevedore/setup.py) egg_info for package stevedore /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'requires_python' warnings.warn(msg) /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'long_description_content_type' warnings.warn(msg) /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'project_urls' warnings.warn(msg) /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'python_requires' warnings.warn(msg) Installed /tmp/pip_build_root/stevedore/pbr-5.5.1-py2.7.egg Marker evaluation failed, see the following error. For more information see: http://docs.openstack.org/pbr/latest/user/using.html#environment-markers ERROR:root:Error parsing Traceback (most recent call last): File "/tmp/pip_build_root/stevedore/pbr-5.5.1-py2.7.egg/pbr/core.py", line 96, in pbr attrs = util.cfg_to_args(path, dist.script_args) File "/tmp/pip_build_root/stevedore/pbr-5.5.1-py2.7.egg/pbr/util.py", line 273, in cfg_to_args kwargs = setup_cfg_to_setup_kwargs(config, script_args) File "/tmp/pip_build_root/stevedore/pbr-5.5.1-py2.7.egg/pbr/util.py", line 472, in setup_cfg_to_setup_kwargs if pkg_resources.evaluate_marker('(%s)' % env_marker): File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1271, in evaluate_marker return cls.interpret(parser.expr(text).totuple(1)[1]) File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1306, in interpret return op(nodelist) File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1223, in atom return cls.interpret(nodelist[2]) File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1306, in interpret return op(nodelist) File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1241, in comparison raise SyntaxError(repr(cop)+" operator not allowed in environment markers") SyntaxError: '<' operator not allowed in environment markers error in setup command: Error parsing /tmp/pip_build_root/stevedore/setup.cfg: SyntaxError: '<' operator not allowed in environment markers Complete output from command python setup.py egg_info: /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'requires_python' warnings.warn(msg) /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'long_description_content_type' warnings.warn(msg) /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'project_urls' warnings.warn(msg) /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'python_requires' warnings.warn(msg) Installed /tmp/pip_build_root/stevedore/pbr-5.5.1-py2.7.egg Marker evaluation failed, see the following error. For more information see: http://docs.openstack.org/pbr/latest/user/using.html#environment-markers ERROR:root:Error parsing Traceback (most recent call last): File "/tmp/pip_build_root/stevedore/pbr-5.5.1-py2.7.egg/pbr/core.py", line 96, in pbr attrs = util.cfg_to_args(path, dist.script_args) File "/tmp/pip_build_root/stevedore/pbr-5.5.1-py2.7.egg/pbr/util.py", line 273, in cfg_to_args kwargs = setup_cfg_to_setup_kwargs(config, script_args) File "/tmp/pip_build_root/stevedore/pbr-5.5.1-py2.7.egg/pbr/util.py", line 472, in setup_cfg_to_setup_kwargs if pkg_resources.evaluate_marker('(%s)' % env_marker): File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1271, in evaluate_marker return cls.interpret(parser.expr(text).totuple(1)[1]) File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1306, in interpret return op(nodelist) File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1223, in atom return cls.interpret(nodelist[2]) File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1306, in interpret return op(nodelist) File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1241, in comparison raise SyntaxError(repr(cop)+" operator not allowed in environment markers") SyntaxError: '<' operator not allowed in environment markers error in setup command: Error parsing /tmp/pip_build_root/stevedore/setup.cfg: SyntaxError: '<' operator not allowed in environment markers ---------------------------------------- Cleaning up... Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/stevedore Storing debug log for failure in /root/.pip/pip.log root@www:~#解决:
sudo python -m pip install --upgrade --force pip sudo pip install setuptools==33.1.1 root@www:~# pip3 install --upgrade pip The program 'pip3' is currently not installed. You can install it by typing: apt-get install python3-pip root@www:~# apt-get install python3-pip
现在workon 是不行的
在主目录下面 执行
vim ~/.bashrc到最下面,这是视频上面的配置
查找文件 virtualenvwrapper.sh
find / -name virtualenvwrapper.sh export WORKON_HOME=$HOME/.virtualenvs export PROJECT_HOME=$HOME/workspace source /usr/local/bin/virtualenvwrapper.sh执行 source ~/.bashrc 使生效
执行 pip list
