From f9f3af04652574322057151611629cdb9e90b5a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20=C5=81ukawski?= Date: Thu, 9 Apr 2020 11:14:19 +0200 Subject: [PATCH] Add simple index view --- .dockerignore | 3 ++- README.md | 2 +- application/urls.py | 3 +++ application/views.py | 5 +++++ docker-compose.yml | 23 +++++++++++++++++++++++ docker/entrypoint.sh | 2 +- 6 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 application/views.py diff --git a/.dockerignore b/.dockerignore index 723ef36..2d1f99b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1,2 @@ -.idea \ No newline at end of file +.idea/ +docker/.data/ \ No newline at end of file diff --git a/README.md b/README.md index af9ff2b..72799dc 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Heroku one. #### First steps 1. Login to your Heroku account from the console using `heroku login`. -2. Create a new Heroku project with `heroku create [APP_NAME]`. +2. Create a new Heroku project with `heroku create [APP_NAME]git`. This command allows to have several 3. Provision a PostgreSQL database with `heroku addons:create heroku-postgresql:hobby-dev`. diff --git a/application/urls.py b/application/urls.py index 0aa4ce1..6338101 100644 --- a/application/urls.py +++ b/application/urls.py @@ -16,6 +16,9 @@ from django.contrib import admin from django.urls import path +from application.views import index_view + urlpatterns = [ path("admin/", admin.site.urls), + path("", index_view), ] diff --git a/application/views.py b/application/views.py new file mode 100644 index 0000000..0f760da --- /dev/null +++ b/application/views.py @@ -0,0 +1,5 @@ +from django.http import HttpResponse + + +def index_view(request): + return HttpResponse("It's working!") diff --git a/docker-compose.yml b/docker-compose.yml index 746ce4f..28f4758 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,3 +7,26 @@ services: - "./:/app" ports: - "5000:5000" + depends_on: + - "db" + - "rabbitmq" + env_file: + - ".env" + + db: + image: "postgres:12.2-alpine" + restart: "always" + volumes: + - "./docker/.data/postgres:/var/lib/postgresql/data" + env_file: + - ".env" + + rabbitmq: + image: "rabbitmq:3.8-management-alpine" + ports: + - "5672:5672" + - "15672:15672" + volumes: + - "./docker/.data/rabbitmq:/var/lib/rabbitmq" + env_file: + - ".env" diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 9eda36b..e35568d 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -1,3 +1,3 @@ #!/usr/bin/env bash -heroku local:start web \ No newline at end of file +heroku local:start