健壮的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"

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
在java中,如何使用lambda表达式按月计算排名?   java如何更改createTempFile中的默认名称?   java无法找到或加载主类net。Fabrimc。德夫朗。主织物   java如何将应用程序绑定到端口161?   使用Spring Boot运行基于Flyway Java的回调   java如何将源代码库添加到IntelliJ(例如来自Github)?   用于MacOSX上应用程序打包的DMG后台java自定义下拉图标   Java泛型和返回类型   java Docker volume mapping+windows=难以置信的慢?   java gwt gxt文本字段。强制无效   试图使用Map<Class,Function<T,R>>替换Java8中的instanceOf,无法放入映射   java Spring SpEL错误   java如何格式化输出值?   java异步HTTP请求,排队请求   带有Kafka、ClassCastException的java Avro模式?   io我们是否需要在java中为Windows和linux提供单独的文件路径   哈姆克雷斯特爪哇。util。IllegalFormatFlagsException:标志=“”   java组合框所选项目   java如何停止程序以等待用户操作?