
[ 测试 ]
发表评论
194 views
作者文章归档:陈海峰
本文使用了kubeshphere搭建的k8s平台并添加了devploy流水线部署
前端pod文件nginx_deploy.yaml - 39行volumeMounts为配置文件挂载, 需要提前创建好配置字典
kind: Deployment
apiVersion: apps/v1
metadata:
name: django-blog-nginx
namespace: chf-object
labels:
app: django-blog-nginx
spec:
replicas: 1
selector:
matchLabels输入: 127.0.0.1:8000/api/chf/
location ^~/api/ {
proxy_pass http://11.11.11.11:8000/;
}
输出: http://11.11.11.11:8000/chf
输入: 127.0.0.1:8000/api/chf/
location ^~/api {
proxy_pass http://11.11.11.11:8000;
}
输出: http://11.11.11.11:8000/api/chf/
default.conf
server {
l配合unittest使用实例
from django.test import TestCase
from selenium import webdriver
import time
class UserAuthTestCase(TestCase):
@classmethod
def setUpClass(cls):
print("开始")
@classmethod
def tearDownClass(cls):
print("结束")
def setUimport unittest, sys, os
"""
1. 每个测试文件必须test_开头.py
2. 把要测试的内容引入进来, 方便
3. class必须继承TestCase
4. method必须以test_开头
"""
class TestSeleiumn(unittest.TestCase):
@unittest.skipIf(sys.platform == "win32", "windows系统不允许")
# @unitte前提条件
安装
pip install gerapy
gerapy init
gerapy migrate
gerapy runserver
端口号写6800
1. 点击部署进入
2. 打包项目把写好的scrapy导入, 打包成压缩包,或者直接复制项目到gerapy里的project文件夹里面
3. 点击部署
1.pip install scrapy
scrapy startporject 项目名
cd 项目名 # 进入项目文件夹
scrapy genspider chf www.xxxx.com # chf是爬虫文件名, www.xxx.com是要爬的网站域名
scrapy crawl 爬虫文件名 -o wangzhan.json
或
scrapy crawl 爬虫文件名 -o wangzhan.csv