All Projects → cuongnv23 → sanic-url-shortener

cuongnv23 / sanic-url-shortener

Licence: other
Example of how to use Sanic and asyncpg (PostgreSQL)

Programming Languages

python
139335 projects - #7 most used programming language
HTML
75241 projects
Dockerfile
14818 projects
shell
77523 projects

Projects that are alternatives of or similar to sanic-url-shortener

Diy Async Web Framework
Learn how modern async web frameworks work, by writing simple clone from scratch
Stars: ✭ 309 (+1831.25%)
Mutual labels:  sanic, asyncio
Sanic Ms
基于sanic的微服务基础架构
Stars: ✭ 336 (+2000%)
Mutual labels:  sanic, asyncio
aiodogstatsd
An asyncio-based client for sending metrics to StatsD with support of DogStatsD extension
Stars: ✭ 26 (+62.5%)
Mutual labels:  sanic, asyncio
Gino
GINO Is Not ORM - a Python asyncio ORM on SQLAlchemy core.
Stars: ✭ 2,299 (+14268.75%)
Mutual labels:  asyncio, asyncpg
Owllook
owllook-小说搜索引擎
Stars: ✭ 2,163 (+13418.75%)
Mutual labels:  sanic, asyncio
dvhb-hybrid
A package to mix django and asyncio in one application
Stars: ✭ 45 (+181.25%)
Mutual labels:  asyncio, asyncpg
Annotated Py Projects
flask/sanic/asyncio/bottle/webpy 大量项目 源码阅读注释合集
Stars: ✭ 308 (+1825%)
Mutual labels:  sanic, asyncio
Mangum
AWS Lambda & API Gateway support for ASGI
Stars: ✭ 475 (+2868.75%)
Mutual labels:  sanic, asyncio
Hproxy
hproxy - Asynchronous IP proxy pool, aims to make getting proxy as convenient as possible.(异步爬虫代理池)
Stars: ✭ 62 (+287.5%)
Mutual labels:  sanic, asyncio
Lyanna
My Blog Using Sanic
Stars: ✭ 482 (+2912.5%)
Mutual labels:  sanic, asyncio
postile
Project migrated to: https://gitlab.com/Oslandia/postile
Stars: ✭ 67 (+318.75%)
Mutual labels:  sanic, asyncpg
Sanic
Async Python 3.7+ web server/framework | Build fast. Run fast.
Stars: ✭ 15,660 (+97775%)
Mutual labels:  sanic, asyncio
postmodel
ORM library for Python 3.6+, asyncio. Provides Django ORM like API.
Stars: ✭ 15 (-6.25%)
Mutual labels:  asyncio, asyncpg
aiorwlock
Read/Write Lock - synchronization primitive for asyncio
Stars: ✭ 90 (+462.5%)
Mutual labels:  asyncio
asyncqlio
A fully async ORM for Python 3.5+
Stars: ✭ 25 (+56.25%)
Mutual labels:  asyncio
trualias
Mentally computable verification codes for email aliases implemented as a postfix tcp table or milter; uses asyncio.
Stars: ✭ 33 (+106.25%)
Mutual labels:  asyncio
sanic-sentry
Sentry integration to sanic web server
Stars: ✭ 31 (+93.75%)
Mutual labels:  sanic
i2plib
🐍 i2plib: A modern asynchronous library for building I2P applications
Stars: ✭ 23 (+43.75%)
Mutual labels:  asyncio
aioaria2
An async/await wrapper around aria2-json-rpc with websocket support
Stars: ✭ 20 (+25%)
Mutual labels:  asyncio
website
PySlackers website for invites and learning resources
Stars: ✭ 61 (+281.25%)
Mutual labels:  asyncio

URL shortener

Another URL shoterner app.

This is an example of using Sanic with asyncpg - a fast PostgreSQL client lib for asyncio.

If you want to try, use docker-compose:

$ docker-compose build
$ docker-compose up

Screenshot of the app

Screenshot

Development

Each component of this app has its own Dockerfile:

  • PostgreSQL: sql/Dockerfile
  • Nginx: nginx.Dockerfile
  • App: app/Dockerfile

PostgreSQL

There is a dockerized PostgreSQL in sql, build your own PostgreSQL container:

$ cd sql
$ docker build -t postgres_local .
$ docker run --rm -it -v /tmp/pg:/var/lib/postgres/data -p 5432:5432 postgres_local

App

Only support Python 3 (tested on Python 3.6.4)

This app uses pipenv to manage virtualenv. Go to app and install dependencies, then you can start working with this:

$ cd app
$ pipenv install
$ pipenv shell # run app inside virtualenv

Run the app

$ POSTGRES_USER=url POSTGRES_PASSWORD=secret DEBUG=True python app.py

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].