Test environment deployment, executed in step
Download centos7 Mirror Mirror address DVD version
Virtual machine installation centos7, first try to reboot after the installation is complete
ping www.baidu.com
Ping fails, then, with reference to the method to solve
After you can ping, referring ssh remote connection complete remote connection
tips:
Virtual machine network using NAT mode, remote connectivity tools: MobaXterm
centos ip command to view Bahrain as ip add, will be used when the host virtual machine ping
ssh connection:
```shell
ssh root@<虚拟机ip>
```
tips: we downloaded the source station mirrored Ali Ali has always been needed here
After replacing the source station first performs
yum update
tips:
Note look at the version link which version is 3.5.1, 3.5.2 to change
In -s flexible connection command path when a problem with the file path before / usr / local / python3 be /usr/local/python3.5/bin/xxxx, two command lines have changed
Not recommended to use the vi command gedit
vi / usr / libexec / urlgrabber-ext-down the first line of this file should be changed to python2.7
yum install mongo look of a first embodiment yum install
Replacing the source station pip install the recommended manner of pip.conf
Restore python environment
The first step: the switching mobaXterm to the / root directory, the directory of the dragged file requirements.txt
Step two:
cd $HOME pip install -r requirements.txt
Turn off the system firewall
service firewalld stop
setenforce 0
vim /etc/selinux/config
The SELINUX = enforcing changed SELINUX = disabled
- Configuring nginx + uwsgi web back-end test environment
tips: Before doing the following, first with python -V command to ensure python version 3.5
yum install epel-release
yum install python-devel nginx gcc
curl http://uwsgi.it/install | bash -s default /tmp/uwsgi
ln -s /tmp/uwsgi /usr/bin/uwsgi
- Test nginx + uwsgi + flask available
cd /home/<your_user_path>
mkdir test
cd test
vim test.py
Paste test flask app:
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "<h1 style='color:blue'>Hello There!</h1>"
if __name__ == "__main__":
app.run(host='0.0.0.0')
vim wsgi.py
Paste the following code:
from myproject import app
if __name__ == "__main__":
app.run()
Wsgi edit the configuration file:
vim test.ini
Copy the following code and modify <your_user_path>:
[uwsgi]
# uwsgi 启动时所使用的地址与端口
socket = 127.0.0.1:8000
# 指向网站目录
chdir = /home/<your_user_path>/test
# python 启动程序文件
wsgi-file = wsgi.py
# python 程序内用以启动的 application 变量名
callable = app
# 处理器数
processes = 5
# 线程数
threads = 2
#状态检测地址
stats = 127.0.0.1:9191
Write wsgi app backgrounding service files
vim /etc/systemd/system/test.service
Copy the following code and modify <your_user_path>:
[Unit]
Description=uWSGI instance to serve myproject
[Service]
WorkingDirectory=/home/<your_user_path>/test
ExecStart=/usr/bin/uwsgi --ini test.ini
[Install]
WantedBy=multi-user.target
Then execute:
service test start
Nginx configuration change
vim /etc/nginx/nginx.conf
Add and modify <your_user_path> and <virtual machine ip> at http attributes:
server {
listen 8888;
server_name <虚拟机ip>;
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:8000;
uwsgi_param UWSGI_CHDIR /home/<your_user_path>/test;
uwsgi_param UWSGI_SCRIPT wsgi:app;
}
}
Then execute:
service nginx restart
Finally, native browser to access <virtual machine ip address: 8888>, and finally the deployment is successful display hello there
Basic use mongo Information:
mongo python client rookie Basic Course
influxDB introduction and use of the sample