Skip to content

Commit

Permalink
improve comments and fix substitute_environ
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelcolvin committed Jan 11, 2017
1 parent 3e9607a commit e4d4eb6
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
5 changes: 2 additions & 3 deletions aiohttp_devtools/start/template/app/gunicorn.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
"""
This file allows your to serve your application using gunicorn. gunicorn is not installed by default
by the requirements file adev creates, you'll need to install it yourself.
by the requirements file adev creates, you'll need to install it yourself and add it to requirements.txt.
To run the app using gunicorn, in the terminal run
pip install gunicorn
gunicorn app.gunicorn:app --worker-class aiohttp.worker.GunicornWebWorker
You could also use a variant of the above with heroku (in the `Procfile`) or with Docker in the
ENTRYPOINT statement.
You could use a variant of the above with heroku (in the `Procfile`) or with Docker in the ENTRYPOINT statement.
"""
import asyncio
from .main import create_app
Expand Down
4 changes: 2 additions & 2 deletions aiohttp_devtools/start/template/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def substitute_environ(s_dict: dict, prefix: str) -> dict:
Names are searched hierarchically with underscores representing levels, environment variables must be
capitalised.
For sample lets say we have ` {'foo': 'bar', 'subdict': {'value': 123}}` with prefix 'APP_',
For example lets say we have ` {'foo': 'bar', 'subdict': {'value': 123}}` with prefix 'APP_',
the environment variable "APP_FOO = spam" would replace "bar" and "APP_SUBDICT_VALUE = 3"
would be converted to int and replace 123 in the dict.
Expand All @@ -76,7 +76,7 @@ def substitute_environ(s_dict: dict, prefix: str) -> dict:
for key, value in s_dict.items():
if isinstance(value, dict):
s_dict[key] = substitute_environ(value, prefix + key + '_')
elif isinstance(value, dict):
elif isinstance(value, list):
# doesn't make sense, we can't do anything here
pass
else:
Expand Down
2 changes: 1 addition & 1 deletion aiohttp_devtools/start/template/app/management.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def prepare_database(delete_existing: bool) -> bool:
(Re)create a fresh database and run migrations.
:param delete_existing: whether or not to drop an existing database if it exists
:return: whether or not a database as (re)created
:return: whether or not a database has been (re)created
"""
db = load_settings()['database']

Expand Down
Empty file.
3 changes: 2 additions & 1 deletion aiohttp_devtools/start/template/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ message_file: 'messages.txt'
# {% elif database.is_pg_sqlalchemy %}
database:
name: '{{ clean_name }}'
user: 'postgres' # TODO make sure connection settings here are correct
user: 'postgres' # TODO you need to make sure connection settings here are correct
# you can override password without saving it with an env variable: `APP_DATABASE_PASSWORD=waffle`
password: 'You need to set this!'
host: localhost
port: 5432
Expand Down

0 comments on commit e4d4eb6

Please sign in to comment.