{"id":24754099,"url":"https://github.com/harobed/python-docker-development-environment-example","last_synced_at":"2026-04-11T02:05:34.328Z","repository":{"id":56741631,"uuid":"124808923","full_name":"harobed/python-docker-development-environment-example","owner":"harobed","description":"Python project example to illustrate development environment workflow powered by Docker and docker-compose","archived":false,"fork":false,"pushed_at":"2018-03-11T23:22:32.000Z","size":34,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-28T11:45:59.904Z","etag":null,"topics":["aiohhtp","docker","docker-compose","example","migrate","pytest","python"],"latest_commit_sha":null,"homepage":null,"language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/harobed.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-11T23:22:02.000Z","updated_at":"2022-10-01T00:44:13.000Z","dependencies_parsed_at":"2022-08-16T01:10:25.244Z","dependency_job_id":null,"html_url":"https://github.com/harobed/python-docker-development-environment-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harobed%2Fpython-docker-development-environment-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harobed%2Fpython-docker-development-environment-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harobed%2Fpython-docker-development-environment-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harobed%2Fpython-docker-development-environment-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/harobed","download_url":"https://codeload.github.com/harobed/python-docker-development-environment-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245056906,"owners_count":20553856,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aiohhtp","docker","docker-compose","example","migrate","pytest","python"],"created_at":"2025-01-28T11:39:01.339Z","updated_at":"2026-04-11T02:05:34.282Z","avatar_url":"https://github.com/harobed.png","language":"CSS","readme":"# Python Docker development environment example\n\nThis project is based on [aiohttp polls example](https://github.com/aio-libs/aiohttp/tree/master/demos/polls) powered by [aiohttp](https://aiohttp.readthedocs.io/en/stable/), [jinja2](http://jinja.pocoo.org/docs/2.10/), [SQLAlchemy](https://www.sqlalchemy.org/) and [aiopg](http://aiopg.readthedocs.io/en/stable/).\n\nEnvironment features:\n\n* ✅ Development workflow powered by Docker and docker-compose\n* ✅ [migrate](https://github.com/mattes/migrate) to manage database migrations\n* ✅ [pytest](https://docs.pytest.org/en/latest/) to execute Python tests with [sql fixtures](demo_polls/conftest.py) (`questions_fixtures`, `choices_fixtures`)\n* ✅ [task](https://github.com/go-task/task) - A task runner / simpler Make alternative written in Go\n* ✅ [production deployment](prod_sample/) docker-compose example\n\n## Prerequisites\n\n* [Docker](https://docs.docker.com/engine/) and [docker-compose](https://docs.docker.com/compose/)\n* [task](https://github.com/go-task/task)\n\nInstall this prerequisites on OSX with [homebrew](https://brew.sh/index_fr):\n\n```\n$ brew tap go-task/tap\n$ brew update\n$ brew install go-task\n$ brew cask install docker\n```\n\n\n## Start development environment\n\nList tasks available:\n\n```\n$ task -l\ntask: Available tasks for this project:\n* build-docker: Build harobed/demo_polls Docker image\n* clean: \tStop and destroy all container and databases\n* enter: \tOpen shell in app container\n* init: \tStart and initialize\n* init-db: \tInitialize database with sample datas\n* tests: \tExecute tests\n```\n\nStart and initialize environment:\n\n```\n$ task init\n...\n$ docker-compose  ps\n               Name                              Command              State             Ports\n------------------------------------------------------------------------------------------------------\ndockerpythonexample_app_1             sleep infinity                  Up       0.0.0.0:32804-\u003e5000/tcp\ndockerpythonexample_migrate_1         sleep 10000d                    Up\ndockerpythonexample_postgres-test_1   docker-entrypoint.sh postgres   Up       5432/tcp\ndockerpythonexample_postgres_1        docker-entrypoint.sh postgres   Up       5432/tcp\ndockerpythonexample_wait_postgres_1   /wait                           Exit 0\n```\n\nExecute tests:\n\n```\n$ task tests\n================================================ test session starts =================================================\nplatform linux -- Python 3.6.4, pytest-3.4.2, py-1.5.2, pluggy-0.6.0 -- /usr/local/bin/python\ncachedir: .pytest_cache\nrootdir: /code, inifile:\nplugins: aiohttp-0.3.0\ncollected 4 items\n\ndemo_polls/test_views.py::test_index[pyloop] PASSED                                                            [ 25%]\ndemo_polls/test_views.py::test_get_poll[pyloop] PASSED                                                         [ 50%]\ndemo_polls/test_views.py::test_post_poll[pyloop] PASSED                                                        [ 75%]\ndemo_polls/test_views.py::test_poll_results[pyloop] PASSED                                                     [100%]\n\n============================================== 4 passed in 1.75 seconds ==============================================\n```\n\nEnter in *demo_polls* container and start server:\n\n```\n$ task enter\n# polls serve\nDEBUG:polls:Debug mode enabled\nINFO:polls:Serve 0.0.0.0:5000\n======== Running on http://0.0.0.0:5000 ========\n(Press CTRL+C to quit)\n```\n\nIn another terminal:\n\n```\n$ echo \"Browse to http://`docker-compose port app 5000`\"\nBrowse to http://0.0.0.0:32804\n```\n\n## Test production deployment\n\nBuild production Docker image:\n\n```\n$ task build-docker\n```\n\nnext read [prod_sample/README.md](prod_sample/README.md)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharobed%2Fpython-docker-development-environment-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharobed%2Fpython-docker-development-environment-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharobed%2Fpython-docker-development-environment-example/lists"}