健壮的URL缩短服务,零配置。
shorter的Python项目详细描述
简单的flask应用程序,创建一个简短的url服务。
使用零配置创建健壮的url shorten服务。
用法
使用PIP安装较短的:
$ pip install shorter
使用“shorter”运行:
$ shorter
简单测试:
$ curl --form "url=http://google.com" localhost:5000 cpYNkF $ curl localhost:5000/cpYNkF <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <title>Redirecting...</title> <h1>Redirecting...</h1> <p>You should be redirected automatically to target URL: <a href="http://google.com">http://google.com</a>. If not click the link.
您也可以尝试使用浏览器访问它。
展开
使用Gunicorn进行部署很简单:
$ gunicorn -w 4 -b 127.0.0.1:5000 shorter:app
自定义
使用shorter_config.py自定义数据库uri:
# shorter_config.py exampleSQLALCHEMY_DATABASE_URI="sqlite:///shorter.db"