Dev tools for aiohttp
Dev tools for aiohttp.
(Note: aiohttp-devtools>=0.3 only supports aiohttp>=2.0, if you’re using older aiohttp, please use aiohtt-devtools==0.21, see History.rst for details.)
aiohttp-devtools provides a number of tools useful when developing applications with aiohttp and associated libraries.
Requires python 3.5 or python 3.6.
pip install aiohttp-devtools
Provides a simple local server for running your application while you’re developing.
Usage is simply
adev runserver <app-path>
app-path can be a path to either a directory containing a recognized default file (app.py or main.py) or to a specific file. The --app-factory option can be used to define which method is called from the app path file, if not supplied some default method names are tried.
All runserver arguments can be set via environment variables, the start command creates a script suitable for setting up your environment such that you can run the dev server with just adev runserver.
runserver has a few of useful features:
For more options see adev runserver --help.
Similar to runserver except just serves static files.
Usage is simply
adev serve <path-to-directory-to-serve>
Like runserver you get nice live reloading and access logs. For more options see adev serve --help.
Creates a new bare bones aiohttp app similar to django’s “startproject”.
Usage is simply
adev start <path-to-directory-to-create-project-in>
You’re then asked a bunch of questions about the the application you’re about to create, you get to choose:
For more options see adev start --help, or just run adev start foobar and follow instructions.
To demonstrate what adev can do, let’s walk through creating a new application:
First let’s create a clean python environment to work in and install aiohttp-devtools.
(it is assumed you’ve already got python 3.5, pip and virtualenv installed)
mkdir my_new_app && cd my_new_app virtualenv -p `which python3.5` env . env/bin/activate pip install aiohttp-devtools
We’re now ready to build our new application with start, using the current directory . will put files where we want them and will prompt adev to name the project my_new_app after the current directory.
We’re going to explicitly choose no database here to make, this tutorial easier but you can remove that option and choose to use a proper database if you like.
You can just hit return to choose the default for all the options.
adev start . --database none
That’s it, your app is now created. You might want to have a look through the local directory’s file tree.
Before you can run your app you’ll need to install the other requirements, luckily they’ve already been listed in ./requirements.txt by start, to install simply run
pip install -r requirements.txt
(If you went off-piste and choose to use a database you’ll need to edit activate.settings.sh to configure connection settings, then run make reset-database to create a database.)
You can then run your app with just:
source activate.settings.sh adev runserver
runserver uses the environment variables set in activate.settings.sh to decide how to serve your app.
That’s it, go develop.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|File Name & Checksum SHA256 Checksum Help||Version||File Type||Upload Date|
|aiohttp_devtools-0.4.1-py35.py36-none-any.whl (49.3 kB) Copy SHA256 Checksum SHA256||py35.py36||Wheel||Jun 3, 2017|
|aiohttp-devtools-0.4.1.tar.gz (35.4 kB) Copy SHA256 Checksum SHA256||–||Source||Jun 3, 2017|