###中文说明请看 http://shenxugongzi.github.io/Ershou/
Web.py framework based on the production of this site is divided into two parts, the data crawling and web show. Database using sqlite
Please refer to how to install web.py
http://webpy.org/install
Get a directory folder file is responsible for crawling Information
Before crawling you should install the following dependencies:
requests, pyquery
After installing the implementation:
python Get.py
You can grab data
The server can use crontab timing crawl, the source file has been written only as follows sh
Get.sh edit the file in the root directory
vim get.sh
Modify your path
python /home/yourfile/get.py
Then join the crontab
crontab -e
* / 10 * * * * sh /home/yourfile/get.sh
Can be.
Note: It is recommended to delete the database file to re-crawl.
Start the application needs to be installed gunicorn
pip install gunicorn
Start the service after installing
gunicorn -w 8 app: ershou
After starting the service default port is 8000 by default only allow 127.0.0.1 access is only allowed to access the machine. Debugging when you can add the following parameters
gunicorn -w 8 0.0.0.0:8000 app: ershou
So that you can visit any address.
Nginx configuration, the xmiao.org replacement for your own domain name on it.
server { listen 80; server_name xmiao.org www.xmiao.org; access_log /var/log/nginx/example.log; location / { proxy_pass http://127.0.0.1:8000; proxy_set_header Host $ host; proxy_set_header X-Real-IP $ remote_addr; proxy_set_header X-Forwarded-For $ proxy_add_x_forwarded_for; } } server { listen 80; server_name ershou.miaowu.asia; location / { rewrite ^ http: //www.xmiao.org$request_uri permanent;? } }