摘要: Scrapy生成的调试信息非常有用,但是通常太啰嗦,你可以在Scrapy项目中的setting.py中设置日志显示等级: LOG_LEVEL = 'ERROR' 日志级别 Scrapy日志有五种等级,按照范围递增顺序排列如下:(注意《Python网络数据采集》书中这里有错) CRITICAL - 严 阅读全文
posted @ 2018-10-25 21:34 CrossPython 阅读(3119) 评论(0) 推荐(0) 编辑
摘要: # coding:utf-8 from sqlalchemy import create_engine, Column, String, Integer, ForeignKey, Table from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker, relati... 阅读全文
posted @ 2018-10-25 20:55 CrossPython 阅读(743) 评论(0) 推荐(0) 编辑
摘要: # -*- coding: utf-8 -*- from sqlalchemy import Column, String, create_engine,ForeignKey,Text,Integer,Table from sqlalchemy.orm import sessionmaker,relationship from sqlalchemy.ext.declarative import... 阅读全文
posted @ 2018-10-25 18:42 CrossPython 阅读(236) 评论(0) 推荐(0) 编辑
摘要: https://blog.csdn.net/pushiqiang/article/details/50652080?utm_source=blogxgwz1 https://blog.csdn.net/qq_40157234/article/details/80691348 https://blog 阅读全文
posted @ 2018-10-25 14:54 CrossPython 阅读(1264) 评论(0) 推荐(0) 编辑
摘要: from django.shortcuts import render,HttpResponse from django.views import View from Fiskars.models import * from django.conf import settings from Fiskars.forms import * import os import xlrd class I... 阅读全文
posted @ 2018-10-25 11:26 CrossPython 阅读(360) 评论(0) 推荐(0) 编辑
摘要: https://blog.csdn.net/xxm524/article/details/48369623 阅读全文
posted @ 2018-10-25 08:49 CrossPython 阅读(786) 评论(0) 推荐(0) 编辑
摘要: //*[@id=”post_content”]/p[1] 意思是:在根节点下面的有一个id为post_content的标签里面的第一个p标签(p[1]) 如果你需要提取的是这个标签的文本你需要在后面加点东西变成下面这样: //*[@id=”post_content”]/p[1]/text() 后面加 阅读全文
posted @ 2018-10-24 21:53 CrossPython 阅读(193) 评论(0) 推荐(0) 编辑
摘要: ModelForm表单 save()方法 每一个ModelForm都有一个save()方法,这个方法可以更具绑定的form表单创建并且保存一个数据库对象,ModelForm的子类可以接受一个model的子类作为instance的参数,如果存在那么save()方法会更新这个实例,否则会创建一个新的实例 阅读全文
posted @ 2018-10-24 15:55 CrossPython 阅读(419) 评论(0) 推荐(0) 编辑
摘要: start items.py spider.py pipelines.py 通过 item__class__ 是什么类来决定如何处理数据 当然 ItemClass() 类里可以加 def __str__(self): return 'ItemClass" 更直观. 阅读全文
posted @ 2018-10-24 08:43 CrossPython 阅读(227) 评论(0) 推荐(0) 编辑
摘要: 分页 https://www.jianshu.com/p/0c957c57ae10 关于 follow=true, rule https://zhuanlan.zhihu.com/p/25650763 关于rule Each Rule defines a certain behaviour for 阅读全文
posted @ 2018-10-24 07:51 CrossPython 阅读(629) 评论(0) 推荐(0) 编辑
摘要: 重点在于CrawlSpider的学习!!!!!!!!!!!!! **通过前面的学习我们可以进行一些页面的简单自动话爬取,对于一些比较规则的网站,我们似乎可以用Spider类去应付,可是,对于一些较为复杂或者说链接的存放不规则的网站我们该怎么去爬取呢,接下来的爬虫就是要解决这个问题,而且还可以高度的自 阅读全文
posted @ 2018-10-23 09:12 CrossPython 阅读(887) 评论(1) 推荐(0) 编辑
摘要: 注意: uselist=False 表示一对一关系. 如果没有 uselist=False, 则查询 阅读全文
posted @ 2018-10-22 22:40 CrossPython 阅读(230) 评论(0) 推荐(0) 编辑
摘要: from selenium import webdriver import requests def loginZhihu(): loginurl = 'https://www.zhihu.com/signin' driver = webdriver.Chrome() driver.get(loginurl) #生物智能在干活当中............. ... 阅读全文
posted @ 2018-10-22 15:47 CrossPython 阅读(214) 评论(0) 推荐(0) 编辑
摘要: //移动到元素element对象的“顶端”与当前窗口的“顶部”对齐 ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView();", element); ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoVie... 阅读全文
posted @ 2018-10-22 15:09 CrossPython 阅读(650) 评论(0) 推荐(0) 编辑
摘要: # -*- coding: utf-8 -*- # 导入依赖包 import scrapy from selenium import webdriver import time import json # 构建spider自动生成的基本配置 class ZhihuSpider(scrapy.Spider): name = 'zhihu' allowed_domains =... 阅读全文
posted @ 2018-10-22 14:08 CrossPython 阅读(1075) 评论(1) 推荐(0) 编辑
摘要: 1. nginx.conf http{ server { listen 80; server_name www.web1.com ....... location / { uwsgi_pass 127.0.0.1:8000; ....... } } server { listen 80; serve 阅读全文
posted @ 2018-10-21 22:04 CrossPython 阅读(4556) 评论(3) 推荐(0) 编辑
摘要: #user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections ... 阅读全文
posted @ 2018-10-21 21:24 CrossPython 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 实现类似: 上一页 1 ... 4 5 6 7 8 ... 89 下一页 的效果 阅读全文
posted @ 2018-10-21 11:02 CrossPython 阅读(304) 评论(0) 推荐(0) 编辑
摘要: trouble shooting https://www.django.cn/article/show-4.html https://blog.csdn.net/lh756437907/article/details/52151000/usr/local/nginx/sbin/nginx -c /u 阅读全文
posted @ 2018-10-20 19:21 CrossPython 阅读(193) 评论(0) 推荐(0) 编辑
摘要: GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123!@#sdt@' WITH GRANT OPTION; FLUSH PRIVILEGES; 阅读全文
posted @ 2018-10-20 18:43 CrossPython 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 严格按下面步骤 一、更新系统软件包 yum update -y 二、安装软件管理包和可能使用的依赖 yum -y groupinstall "Development tools" yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel 三、下载Pyhton3到/usr/... 阅读全文
posted @ 2018-10-20 15:40 CrossPython 阅读(902) 评论(4) 推荐(0) 编辑
摘要: 要自定义处理url请求错误需要进行三步操作:主要错误有: 404错误:page not found视图 500错误:server error视图 400错误:bad request视图 以404错误为例,500、404同理 我这里创建了一个应用,名为booktest Step1:修改settings 阅读全文
posted @ 2018-10-20 13:00 CrossPython 阅读(5631) 评论(1) 推荐(1) 编辑
摘要: django 存在则忽略, 不存在则创 TagSheet.objects.get_or_create(tag='test') 阅读全文
posted @ 2018-10-18 20:32 CrossPython 阅读(500) 评论(0) 推荐(0) 编辑
摘要: 总结: 好麻烦. 阅读全文
posted @ 2018-10-18 20:02 CrossPython 阅读(544) 评论(0) 推荐(0) 编辑
摘要: 根据反射做, 按钮 value 要设置成统一的, 这里是 submit 阅读全文
posted @ 2018-10-18 14:31 CrossPython 阅读(266) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2018-10-15 18:21 CrossPython 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2018-10-15 18:20 CrossPython 阅读(555) 评论(0) 推荐(0) 编辑
摘要: aaa 阅读全文
posted @ 2018-10-15 08:58 CrossPython 阅读(261) 评论(0) 推荐(0) 编辑
摘要: sss 阅读全文
posted @ 2018-10-15 08:57 CrossPython 阅读(301) 评论(0) 推荐(0) 编辑
摘要: 暗暗啊 阅读全文
posted @ 2018-10-15 08:56 CrossPython 阅读(399) 评论(0) 推荐(0) 编辑
摘要: 暗暗啊 阅读全文
posted @ 2018-10-15 08:55 CrossPython 阅读(464) 评论(1) 推荐(0) 编辑
摘要: 应用 django FORM 录入数据 必须 item_id supplier_id 不能item, supplier 阅读全文
posted @ 2018-10-13 13:15 CrossPython 阅读(376) 评论(0) 推荐(0) 编辑
摘要: item=CharField(max_length=20,min_length=1,required=True,widget=widgets.TextInput({'placeholder':'testing',}),) type=CharField(min_length=1,max_length=4,required=True,widget=Select(choices=(('0','P'),(... 阅读全文
posted @ 2018-10-13 10:45 CrossPython 阅读(947) 评论(0) 推荐(0) 编辑
摘要: name=models.CharField(max_length=30,unique=True,verbose_name='姓 名') birthday=models.DateField(blank=True,null=True) GENDER_CHOICES=( (1,'Male'), (2,'F 阅读全文
posted @ 2018-10-09 14:28 CrossPython 阅读(190) 评论(0) 推荐(0) 编辑
摘要: 表名 ,foreignkey, 正向 obj.表名小写_set.all() 反向操作. 阅读全文
posted @ 2018-10-07 22:32 CrossPython 阅读(147) 评论(0) 推荐(0) 编辑
摘要: https://segmentfault.com/a/1190000006949536 阅读全文
posted @ 2018-10-06 21:46 CrossPython 阅读(107) 评论(0) 推荐(0) 编辑
摘要: https://www.cnblogs.com/chenice/p/6921727.html https://blog.csdn.net/Aaroun/article/details/78218131 阅读全文
posted @ 2018-10-06 10:58 CrossPython 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 网上各种找,最后自己猜,猜到了. 必须安装python插件, 网上找的都是不带数字的版本号, 要么找不到要么不行. 我是 3.6.1,尝试加36, 成了。 yum install -y uwsgi-plugin-python36 识别的时候也要加36。 uwsgi --http-socket :80 阅读全文
posted @ 2018-10-06 10:21 CrossPython 阅读(1036) 评论(0) 推荐(0) 编辑
摘要: sudo yum install python-django-common 阅读全文
posted @ 2018-10-06 09:23 CrossPython 阅读(318) 评论(0) 推荐(0) 编辑
摘要: python2个版本导致的问题. 网上找了好多方法都不行. 最后自己莫名其妙弄好了, 回想了一下大概是 安装sqlite3 重新安装python 最后 yum update 更新 就好了. 阅读全文
posted @ 2018-10-06 09:14 CrossPython 阅读(337) 评论(0) 推荐(0) 编辑