fuser -k /var/www/html/centos/
HTML转markdown工具比较
Html2MarkDown – aTool在线工具
一款html和markdown标签互转的工具,直接输入Html,网页会自动帮你转换。
HTML2Markdown
Javascript Implementation for converting HTML to Markdown text.
html2markdown
Javascript implementation for converting HTML to Markdown text. Browser and Node.js support.
Turndown
Convert HTML into Markdown with JavaScript.
Python 新轮子 Tomd: HTML 转 Markdown 工具库
用途: 爬虫爬文章保存到本地为 Markdown 格式
LCTT选题工具
将内容复制到左侧输入框内,点击生成MD,在中部编辑器处进行二次修改,并在右侧的预览框中查看效果。 确认无误后点击上方的复制代码按钮即可将代码复制到剪贴板中!
html-to-markdown
An HTML-to-markdown conversion helper for PHP
Markdown Navigator 2.0
Markdown language support for IntelliJ platform
django2 + uwsgi + nginx
安装uwsgi模块
pip install uwsgi
测试uwsgi服务
uwsgi --http 0.0.0.0:8080 --file project/wsgi.py --static-map=/static=static
配置uwsgi.ini
# uwsig使用配置文件启动
[uwsgi]
# 项目目录
chdir=/data/pyproject/zc1024
# 指定项目的application
module=zc1024.wsgi:application
# 指定sock的文件路径
socket=/data/pyproject/zc1024/tmp/uwsgi.sock
# 进程个数
workers=4
pidfile=/data/pyproject/zc1024/tmp/uwsgi.pid
# 指定IP端口
http=127.0.0.1:8080
# 指定静态文件
static-map=/static=/data/pyproject/zc1024/static
# 启动uwsgi的用户名和用户组
uid=ning
gid=ning
# 启用主进程
master=true
# 自动移除unix Socket和pid文件当服务停止的时候
vacuum=true
# 序列化接受的内容,如果可能的话
thunder-lock=true
# 启用线程
enable-threads=true
# 设置自中断时间
harakiri=30
# 设置缓冲
post-buffering=4096
# 设置日志目录
daemonize=/data/pyproject/zc1024/tmp/uwsgi.log
运行配置
uwsgi --ini uwsgi.ini
配置nginx
# 指定项目路径uwsgi
location / { # 这个location就和咱们Django的url(r'^admin/', admin.site.urls),
include uwsgi_params; # 导入一个Nginx模块他是用来和uWSGI进行通讯的
uwsgi_connect_timeout 30; # 设置连接uWSGI超时时间
uwsgi_pass unix:/data/pyproject/zc1024/tmp/uwsgi.sock; # 指定uwsgi的sock文件所有动态请求就会直接丢给他
}
# 指定静态文件路径
location /static/ {
alias /data/pyproject/zc1024/static/;
index index.html index.htm;
}
重新加载nginx配置
nginx -s reload
CentOS7通过yum安装PostgreSQL10
发现最新的postgresql版本
https://www.postgresql.org/download/linux/redhat/
下载
yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm
安装
yum install postgresql10-server
设置数据目录
创建数据目录并修改权限
mkdir -p /data/postgresql/
chown postgres:postgres /data/postgresql/
复制开机启动文件
sudo cp /usr/lib/systemd/system/postgresql-10.service /etc/systemd/system/
修改开机启动文件
vim /etc/systemd/system/postgresql-10.service
找到
Environment=PGDATA=/var/lib/pgsql/10/data/
修改为
Environment=PGDATA=/data/postgresql/
初始化数据库
/usr/pgsql-10/bin/postgresql-10-setup initdb
开机自启动
systemctl enable postgresql-10
systemctl start postgresql-10
systemctl status postgresql-10
修改本地帐户权限
vim /data/postgresql/pg_hba.conf
将
host all all 127.0.0.1/32 ident
修改为
host all all 127.0.0.1/32 md5
重新加载配置
systemctl restart postgresql-10
新增用户和数据库
su - postgres
createuser dbuser
createdb -e -O dbuser dbname
设定密码
su - postgres
psql
\password dbuser (输入两次密码)
新用户登录数据库
psql -U dbuser -d dbname -h 127.0.0.1 (输入之前的密码)
允许非本机ip登录
- 编辑
data/postgresql.conf修改listen_addresses = 'localhost'为listen_addresses = 'localhost' -
编辑
data/pg_hba.confhost all all 192.168.1.0/24 md5
Django CMS比较
Mezzanine
Mezzanine is a powerful, consistent, and flexible content management platform. Built using the Django framework, Mezzanine provides a simple yet highly extensible architecture that encourages diving in and hacking on the code. Mezzanine is BSD licensed and supported by a diverse and active community.
In some ways, Mezzanine resembles tools such as WordPress, providing an intuitive interface for managing pages, blog posts, form data, store products, and other types of content. But Mezzanine is also different. Unlike many other platforms that make extensive use of modules or reusable applications, Mezzanine provides most of its functionality by default. This approach yields a more integrated and efficient platform.
Django Fiber
Django Fiber – a simple, open-source, user-friendly CMS for all your django projects. It complements your project, it doesn’t take it over. It allows you to create simple textual, template based pages, add simple content items in pages and views, and adds simple menus that always work. All this can be maintained by a friendly frontend admin.
django CMS
Enterprise content management with django
Django-Fluent
A smooth, flexible CMS to create the designs you like, built on top of the powerful Django framework.
Django-Fluent CMS is a Open Source CMS, designed for the following needs:
- Shape the CMS according to the client’s needs.
- Make any kind of design editable for end-users.
- Be easy to use
- Be easy to code with -Be usable for small up to large sites
The CMS is flexible for your own needs. You can install parts of the CMS you like to use, and leave everything else out of your project. The system is designed to perform well (blocks are cached in memcache), models and admin screens can be modified to your needs easily.
FeinCMS
One of the most advanced Content Management Systems built on Django
Wagtail
There are plenty of great open source content management systems. We’ve used Drupal very successfully on big sites for clients including high profile campaigning NGOs, fundraising charities, think tanks, universities and public sector organisations. There are also some excellent Django CMSs, including Mezzanine, Fein and Django CMS, with thriving developer communities and impressive case studies.
But having built content-managed websites for 14 years we have strong opinions about the editor experience and how a CMS should work and be structured, and we need to manage a more rapid pace of development than we can achieve by contributing to existing projects.
手机移动端富文本编辑器比较
Quill
Quill is a modern WYSIWYG editor built for compatibility and extensibility. https://quilljs.com – API Driven Design – Custom Content and Formatting – Cross Platform – Easy to Use 重要的是linkedin也在用
Eleditor
- 兼容Android&ios
- Eleditor的开发是为了解决移动端项目中的富文本编辑问题。具有
- 轻量,可定制,注重用户体验等特点 -开源基于MIT协议,允许自由使用和修改代码
simditor
An Easy and Fast WYSIWYG Editor
- 有插件和文档(非移动优先)
vue-html-editor
A Vue.js component implementing the HTML editor with the jQuery summernote plugin.
Squire
the textarea of the future
Angular-trix
A rich wysiwyg text editor directive for angularjs.
textAngular
textAngular is a super cool WYSIWYG Text Editor directive for AngularJS
Draft.js
Rich Text Editor Framework for React
python+selenium自动登录淘宝网并获取订单数据
本文将介绍使用python3+ selenium自动登录淘宝,并获取订单信息。
# -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium.webdriver.common.action_chains import ActionChains
import unittest, time, re
class Login(unittest.TestCase):
def setUp(self):
# binary = FirefoxBinary(r'C:\Program Files\Mozilla Firefox\firefox.exe')
self.driver = webdriver.Firefox()
self.driver.implicitly_wait(30)
self.driver.maximize_window()
self.base_url = "https://www.taobao.com/"
self.verificationErrors = []
self.accept_next_alert = True
def test_login(self):
driver = self.driver
# 打开登录页面
driver.get("https://login.taobao.com/member/login.jhtml?&redirectURL=http%3A%2F%2Fwww.taobao.com%2F")
self.driver.implicitly_wait(5)
# 点击账号密码登录
driver.find_element_by_id('J_Quick2Static').click()
self.driver.implicitly_wait(2)
# 输入账号密码
driver.find_element_by_id("TPL_username_1").clear()
driver.find_element_by_id("TPL_username_1").send_keys("username")
driver.find_element_by_id("TPL_password_1").clear()
driver.find_element_by_id("TPL_password_1").send_keys("passwd")
driver.implicitly_wait(5)
# 判断是否显示滑块,如果显示则拖动滑块
# 提交表单
driver.find_element_by_id("J_SubmitStatic").click()
while True:
if driver.find_element_by_link_text("卖家中心").is_displayed():
break
# 查看已卖出的宝贝
driver.execute_script('window.location="https://trade.taobao.com/trade/detail/trade_order_detail.htm?biz_order_id=xxxxxx"')
driver.implicitly_wait(5)
driver.find_element_by_link_text("收货和物流信息").click()
print(driver.page_source)
def tearDown(self):
# self.driver.quit()
self.assertEqual([], self.verificationErrors)
if __name__ == "__main__":
unittest.main()
fedora27(centos)下用过dnf(yum)安装postgresql10
安装postgresql10-server
所有repo包都在 https://yum.postgresql.org/下,这里通过一级一级,先是postgresql10版本,然后选择fedora 10,然后下载安装
dnf install https://download.postgresql.org/pub/repos/yum/10/fedora/fedora-27-x86_64/pgdg-fedora10-10-3.noarch.rpm dnf install postgresql10-server
安装 pgadmin4
dnf install pgadmin4-v2
初始化数据库
sudo /usr/pgsql-10/bin/postgresql-10-setup initdb
运行数据库
系统服务被安装在/usr/lib/systemd/system/postgresql-10.service
systemctl start postgresql-10
systemctl enable postgresql-10
修改本地登录无需密码
sudo vim /var/lib/pgsql/10/data/pg_hba.conf
#host all all 127.0.0.1/32 ident
host all all 127.0.0.1/32 trust
fedora27+python3+virtualenv+virtualenvwrapper安装及使用
安装virtualenvwrapper
这里使用pip3进行安装即可
sudo pip3 install virtualenvwrapper
设置virtualenvwrapper的运行环境变量
编辑~/.bashrc,加入以下几行
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
export WORKON_HOME='~/.virtualenvs'
source /usr/local/bin/virtualenvwrapper.sh
使环境变量马上生效:
source ~/.bashrc
virtualenvwrapper使用
mkvirtualenv 新建虚拟环境
mkvirtualenv env1
建立后可以看到终端会以env1开头
(env1) [ning@localhost]$
再建立一个env2
mkvirtualenv env2
workon 启动/切换虚拟环境
workon env1
deactivate 离开虚拟环境
deactivate
rmvirtualenv 删除虚拟环境
rmvirtualenv env2
virtualenvwrapper help 查看virtualenvwrapper使用帮助
virtualenvwrapper is a set of extensions to Ian Bicking's virtualenv
tool. The extensions include wrappers for creating and deleting
virtual environments and otherwise managing your development workflow,
making it easier to work on more than one project at a time without
introducing conflicts in their dependencies.
For more information please refer to the documentation:
http://virtualenvwrapper.readthedocs.org/en/latest/command_ref.html
Commands available:
add2virtualenv: add directory to the import path
allvirtualenv: run a command in all virtualenvs
cdproject: change directory to the active project
cdsitepackages: change to the site-packages directory
cdvirtualenv: change to the $VIRTUAL_ENV directory
cpvirtualenv: duplicate the named virtualenv to make a new one
lssitepackages: list contents of the site-packages directory
lsvirtualenv: list virtualenvs
mkproject: create a new project directory and its associated virtualenv
mktmpenv: create a temporary virtualenv
mkvirtualenv: Create a new virtualenv in $WORKON_HOME
rmvirtualenv: Remove a virtualenv
setvirtualenvproject: associate a project directory with a virtualenv
showvirtualenv: show details of a single virtualenv
toggleglobalsitepackages: turn access to global site-packages on/off
virtualenvwrapper: show this help message
wipeenv: remove all packages installed in the current virtualenv
workon: list or change working virtualenvs
virtualenv –help 帮助
Usage: virtualenv [OPTIONS] DEST_DIR
Options:
--version show program's version number and exit
-h, --help show this help message and exit
-v, --verbose Increase verbosity.
-q, --quiet Decrease verbosity.
-p PYTHON_EXE, --python=PYTHON_EXE
The Python interpreter to use, e.g.,
--python=python2.5 will use the python2.5 interpreter
to create the new environment. The default is the
interpreter that virtualenv was installed with
(/usr/bin/python3)
--clear Clear out the non-root install and start from scratch.
--no-site-packages DEPRECATED. Retained only for backward compatibility.
Not having access to global site-packages is now the
default behavior.
--system-site-packages
Give the virtual environment access to the global
site-packages.
--always-copy Always copy files rather than symlinking.
--unzip-setuptools Unzip Setuptools when installing it.
--relocatable Make an EXISTING virtualenv environment relocatable.
This fixes up scripts and makes all .pth files
relative.
--no-setuptools Do not install setuptools in the new virtualenv.
--no-pip Do not install pip in the new virtualenv.
--no-wheel Do not install wheel in the new virtualenv.
--extra-search-dir=DIR
Directory to look for setuptools/pip distributions in.
This option can be used multiple times.
--download Download preinstalled packages from PyPI.
--no-download, --never-download
Do not download preinstalled packages from PyPI.
--prompt=PROMPT Provides an alternative prompt prefix for this
environment.
--setuptools DEPRECATED. Retained only for backward compatibility.
This option has no effect.
--distribute DEPRECATED. Retained only for backward compatibility.
This option has no effect.
Windows上安装Django2(Python3+virtualenv+virtualenvwrapper)
本文档将指导您在Windows上安装Python 3.5和Django。它还提供了安装virtualenv和virtualenvwrapper的指导,这使得在Python项目上工作变得更容易。这是为使用Django项目的用户提供的初学者指南,并不反映在为Django本身开发补丁程序时如何安装Django。
本指南中的步骤已经通过Windows 7、8和10进行了测试。在其他版本中,步骤是类似的。您需要熟悉使用Windows命令提示符。
安装Python
Django是一个Python的web框架,因此需要在你的机器上安装Python。在编写的时候,Python 3.6是最新版本。
要在您的机器上安装Python,请访问https://python.org/downloads/。该网站应该为您提供最新的Python版本的下载按钮。下载可执行安装程序并运行它。选中“Add Python 3.6 to PATH”旁边的复选框,然后单击“Install Now”。
安装完成后,打开命令提示符并检查Python版本是否与执行的安装版本相匹配:
python --version
关于 pip
pip是Python的包管理。它使得安装和卸载Python包(如Django!)非常简单。对于安装的其余部分,我们将使用pip从命令行安装Python包。
要在您的机器上安装pip,请转到https://pip.pypa.io/en/latest/installing/,然后按照使用get-pip.py安装说明进行操作。
安装 virtualenv 和 virtualenvwrapper
virtualenv和virtualenvwrapper为您创建的每个Django项目提供了一个专用的环境。虽然不是强制性的,但这被认为是最佳实践,在您准备好部署项目时将为您节省时间。只需输入:
pip install virtualenvwrapper-win
然后为您的项目创建一个虚拟环境:
mkvirtualenv myproject
虚拟环境将被自动激活,您将在命令提示符旁边看到(myproject),以指定它。如果您启动一个新的命令提示符,您将需要再次激活环境
workon myproject
安装 Django
Django可以在您的虚拟环境中使用pip轻松安装。
在命令提示符下,确保您的虚拟环境处于活动状态,然后执行以下命令:
pip install django
这将下载并安装最新的Django版本。
安装完成后,您可以通过在命令提示符下执行django-admin --version来验证您的Django安装。
请参阅运行您的数据库以获取有关使用Django安装数据库的信息。