All Projects → sseg → Heroku Aiohttp Web

sseg / Heroku Aiohttp Web

Licence: mit
A project starter template for deploying an aiohttp app to Heroku

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Heroku Aiohttp Web

Template Micro Service
Scaffolding out a micro-service
Stars: ✭ 12 (-14.29%)
Mutual labels:  scaffold, template
Aiohttp Demos
Demos for aiohttp project
Stars: ✭ 517 (+3592.86%)
Mutual labels:  asyncio, aiohttp
Sanic Ms
基于sanic的微服务基础架构
Stars: ✭ 336 (+2300%)
Mutual labels:  asyncio, aiohttp
Aiodocker
Python Docker API client based on asyncio and aiohttp
Stars: ✭ 288 (+1957.14%)
Mutual labels:  asyncio, aiohttp
Mrm
Codemods for your project config files
Stars: ✭ 900 (+6328.57%)
Mutual labels:  scaffold, template
Python Slack Sdk
Slack Developer Kit for Python
Stars: ✭ 3,307 (+23521.43%)
Mutual labels:  asyncio, aiohttp
Aiojobs
Jobs scheduler for managing background task (asyncio)
Stars: ✭ 492 (+3414.29%)
Mutual labels:  asyncio, aiohttp
TG-FileStreamBot
Stream Telegram files to web
Stars: ✭ 193 (+1278.57%)
Mutual labels:  heroku, aiohttp
Heroku Wp
WordPress on Heroku
Stars: ✭ 865 (+6078.57%)
Mutual labels:  heroku, template
Aiobotocore
asyncio support for botocore library using aiohttp
Stars: ✭ 630 (+4400%)
Mutual labels:  asyncio, aiohttp
Aioresponses
Aioresponses is a helper for mock/fake web requests in python aiohttp package.
Stars: ✭ 278 (+1885.71%)
Mutual labels:  asyncio, aiohttp
Aioslacker
slacker wrapper for asyncio
Stars: ✭ 23 (+64.29%)
Mutual labels:  asyncio, aiohttp
Python3 Concurrency Pics 02
爬取 www.mzitu.com 全站图片,截至目前共5162个图集,16.5万多张美女图片,使用 asyncio 和 aiohttp 实现的异步版本只需要不到2小时就能爬取完成。按日期创建图集目录,保存更合理。控制台只显示下载的进度条,详细信息保存在日志文件中。支持异常处理,不会终止爬虫程序。失败的请求,下次再执行爬虫程序时会自动下载
Stars: ✭ 275 (+1864.29%)
Mutual labels:  asyncio, aiohttp
Diy Async Web Framework
Learn how modern async web frameworks work, by writing simple clone from scratch
Stars: ✭ 309 (+2107.14%)
Mutual labels:  asyncio, aiohttp
Web Main
🎉 Ultimate Emoji Generator
Stars: ✭ 261 (+1764.29%)
Mutual labels:  asyncio, aiohttp
Userge
Userge, Durable as a Serge
Stars: ✭ 363 (+2492.86%)
Mutual labels:  heroku, asyncio
aiohttp traversal
Traversal based router for aiohttp.web
Stars: ✭ 21 (+50%)
Mutual labels:  aiohttp, asyncio
binance-chain-python
Binance chain SDK in Python
Stars: ✭ 22 (+57.14%)
Mutual labels:  aiohttp, asyncio
Noahv
An efficient front-end application framework based on vue.js
Stars: ✭ 593 (+4135.71%)
Mutual labels:  scaffold, template
Aiomixcloud
Mixcloud API wrapper for Python and Async IO
Stars: ✭ 23 (+64.29%)
Mutual labels:  asyncio, aiohttp

Heroku aiohttp Web Template

An opinionated project template for deploying an aiohttp web app to Heroku, designed to encourage the rapid development and deployment of real-time front-end features.

NB: This template currently tracks an out-of-date version of aiohttp. Please tread carefully. Contributions are welcome to bring it up-to-date.

Launch the app

Use this button:

Deploy

Or alternatively:

$ git clone https://github.com/sseg/heroku-aiohttp-web.git
$ cd heroku-aiohttp-web
$ heroku create
$ heroku buildpacks:set https://github.com/heroku/heroku-buildpack-multi.git
$ heroku config:set ROOT_LOG_LEVEL=INFO
$ git push heroku master

Develop locally

Make sure you have:

Install the project packages:

$ pip install -r dev-requirements.txt
$ pip-sync
$ npm install -g brunch
$ npm install

Then run the project with development asset server:

$ chmod +x ./dev_start.sh `# run this just once`
$ ./dev_start.sh

Or run the app using compiled assets with the Procfile:

$ npm run clean && npm run build:prod
$ heroku local

Local config values are defined in the .env file, and invoked when you start the application using heroku local.

Run the tests

There are no tests yet... but stay tuned!

Application structure

Handlers

aiohttp dispatches requests to handlers which can be either coroutines or functions that accept a Request and return a Response. A base class aiohttp.web.View is also provided to help organize handlers into classes, which provides the convenience of automatically creating an OPTIONS method.

Templates

This app uses jinja2 templates to construct its index view. Template files are kept in the web/templates directory and compiled by the aiohttp_jinja2 renderer. You might prefer mako for templates, or something else—connecting a new renderer to your handlers is easy.

Static files

Javascript and CSS source files are defined in the assets/js and assets/css directories, respectively. These assets are compiled by brunch to the top-level public directory (configuration in brunch-config.js). You might want to add React or Elm compilation which is as simple as installing a new brunch plugin. In development you can run a file watcher with an HTTP + pushstate server to reload your page on file changes (this is started with the dev_start.sh script).

Production asset delivery

In production the assets are compiled once (triggered during Heroku deployment by package.json's postinstall directive). Based on the Python configuration the compiled assets are served through aiohttp (with the piping handled by web.utils.assets.AssetManager).

NB: the aiohttp server is not designed to serve static files, and allowing it to serve production asset traffic will detrimentally affect your application's performance. You will either want to expose this application behind a content delivery proxy (e.g. Cloudflare) or reconfigure it to serve assets from a separate assets server. The brunch asset compiler is configured here to append checksum digests to asset filenames which facilitates cache eviction in these scenarios.

Configuration

This application uses a configuration base file, config/web.yml, which defines defaults and wraps environment variables. New configuration settings should be added to this file and refer to new environment variables. For more information on Heroku app configuration see the devcenter docs.

Contributions

Contributions are welcome! Bugs, feature requests, and unanswered questions can be reported in the Github issue tracker here. Fixes, enhancements, and suggestions are also gratefully accepted in pull requests.

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].