{"action":"created","issue":{"url":"https://api.github.com/repos/hackoregon/transportation-system-backend/issues/14","repository_url":"https://api.github.com/repos/hackoregon/transportation-system-backend","labels_url":"https://api.github.com/repos/hackoregon/transportation-system-backend/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/hackoregon/transportation-system-backend/issues/14/comments","events_url":"https://api.github.com/repos/hackoregon/transportation-system-backend/issues/14/events","html_url":"https://github.com/hackoregon/transportation-system-backend/pull/14","id":294565723,"number":14,"title":"Base API functionality","user":{"login":"kiniadit","id":5795860,"avatar_url":"https://avatars1.githubusercontent.com/u/5795860?v=4","gravatar_id":"","url":"https://api.github.com/users/kiniadit","html_url":"https://github.com/kiniadit","followers_url":"https://api.github.com/users/kiniadit/followers","following_url":"https://api.github.com/users/kiniadit/following{/other_user}","gists_url":"https://api.github.com/users/kiniadit/gists{/gist_id}","starred_url":"https://api.github.com/users/kiniadit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kiniadit/subscriptions","organizations_url":"https://api.github.com/users/kiniadit/orgs","repos_url":"https://api.github.com/users/kiniadit/repos","events_url":"https://api.github.com/users/kiniadit/events{/privacy}","received_events_url":"https://api.github.com/users/kiniadit/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-02-05T22:30:57Z","updated_at":"2018-02-06T07:12:34Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/hackoregon/transportation-system-backend/pulls/14","html_url":"https://github.com/hackoregon/transportation-system-backend/pull/14","diff_url":"https://github.com/hackoregon/transportation-system-backend/pull/14.diff","patch_url":"https://github.com/hackoregon/transportation-system-backend/pull/14.patch"},"body":"**Docker**\r\n- switched from `env.sh` to `.env` to handle environment variables. Possibly more scalable\r\n- created two separate Dockerfiles - `DOCKERFILE.db` and `DOCKERFILE.api` for postgres and api containers repsectively\r\n\r\n**Django**\r\n- Models for `crash`, `partic` and `vhcl` (tables from the ODOT Postgres db) now working\r\n- Corresponding API endpoints now accessible via GET requests\r\n- pagination support added\r\n\r\nAPI ROOT is accessible from - http://<hostname>:8000/api/\r\n`crash` tables are accessible from - http://<hostname>:8000/api/crashes/\r\n`partic` tables are accessible from - http://<hostname>:8000/api/participants/\r\n`vhcl` tables are accessible from - http://<hostname>:8000/api/vehicles/"},"comment":{"url":"https://api.github.com/repos/hackoregon/transportation-system-backend/issues/comments/363331558","html_url":"https://github.com/hackoregon/transportation-system-backend/pull/14#issuecomment-363331558","issue_url":"https://api.github.com/repos/hackoregon/transportation-system-backend/issues/14","id":363331558,"user":{"login":"BrianHGrant","id":17940561,"avatar_url":"https://avatars0.githubusercontent.com/u/17940561?v=4","gravatar_id":"","url":"https://api.github.com/users/BrianHGrant","html_url":"https://github.com/BrianHGrant","followers_url":"https://api.github.com/users/BrianHGrant/followers","following_url":"https://api.github.com/users/BrianHGrant/following{/other_user}","gists_url":"https://api.github.com/users/BrianHGrant/gists{/gist_id}","starred_url":"https://api.github.com/users/BrianHGrant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BrianHGrant/subscriptions","organizations_url":"https://api.github.com/users/BrianHGrant/orgs","repos_url":"https://api.github.com/users/BrianHGrant/repos","events_url":"https://api.github.com/users/BrianHGrant/events{/privacy}","received_events_url":"https://api.github.com/users/BrianHGrant/received_events","type":"User","site_admin":false},"created_at":"2018-02-06T07:12:33Z","updated_at":"2018-02-06T07:12:33Z","author_association":"MEMBER","body":"DEBUG connects to the \"DEBUG_MODE\" in the settings.py ATM, which should\nturn the dev server on or off. My intent in including was that it might be\nable to be wired up to other areas will you might want such a switch, one\nvariable to rule them all.\n\nI'm fairly sure the host name for the dstabase in settings.py should be the\nname of the database container in the docker-compose, which was 'db', in\nthe version I wrote.\n\nIn this case it looks like it is being set to a OS variable name 'db',\nwhich you may or may not have set to the container name. If not set it\nwould default to localhost, which would be inside the container.\n\nI have not tried this as of yet, but think may be the issue.\n\n\n\nOn Feb 5, 2018 10:39 PM, \"M. Edward (Ed) Borasky\" <notifications@github.com>\nwrote:\n\n> Test results:\n>\n>    1. I had to \"export\" the environment variables in the compose file:\n>    POSTGRES_PASSWORD, PROJECT_NAME and DEBUG. I didn't know what to use for\n>    DEBUG so I used \"false\".\n>    2. I had to define a file bin/.env. I put all the variables I knew\n>    about.\n>    3. I had to copy odot_crash_data.sql into bin/.\n>\n> Then I did a docker-compose build and a docker-compose up -d. The\n> database container comes up but the API container crashed:\n>\n>  $ docker logs transportationsystembackend_api_1\n> Traceback (most recent call last):\n>   File \"./manage.py\", line 15, in <module>\n>     execute_from_command_line(sys.argv)\n>   File \"/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py\", line 371, in execute_from_command_line\n>     utility.execute()\n>   File \"/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py\", line 365, in execute\n>     self.fetch_command(subcommand).run_from_argv(self.argv)\n>   File \"/usr/local/lib/python3.6/site-packages/django/core/management/base.py\", line 288, in run_from_argv\n>     self.execute(*args, **cmd_options)\n>   File \"/usr/local/lib/python3.6/site-packages/django/core/management/commands/runserver.py\", line 62, in execute\n>     super().execute(*args, **options)\n>   File \"/usr/local/lib/python3.6/site-packages/django/core/management/base.py\", line 335, in execute\n>     output = self.handle(*args, **options)\n>   File \"/usr/local/lib/python3.6/site-packages/django/core/management/commands/runserver.py\", line 71, in handle\n>     if not settings.DEBUG and not settings.ALLOWED_HOSTS:\n>   File \"/usr/local/lib/python3.6/site-packages/django/conf/__init__.py\", line 56, in __getattr__\n>     self._setup(name)\n>   File \"/usr/local/lib/python3.6/site-packages/django/conf/__init__.py\", line 43, in _setup\n>     self._wrapped = Settings(settings_module)\n>   File \"/usr/local/lib/python3.6/site-packages/django/conf/__init__.py\", line 125, in __init__\n>     raise ImproperlyConfigured(\"The SECRET_KEY setting must not be empty.\")\n> django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.\n>\n> So I defined SECRET_KEY both as an export and in bin/.env. It crashed the\n> same way, so I looked at the code and discovered I need to set\n> DJANGO_SECRET_KEY. So I did that and now the API container stays up.\n>\n> I can browse to it now but it is resetting. It's having trouble connecting\n> to the database. Your connection string needs to connect to host \"db\" as\n> user \"postgres\" on port 5432 with the password $POSTGRES_PASSWORD. It looks\n> like it's trying to connect to a database inside the Django API container\n> and there isn't one running there.\n>\n> docker logs -f transportationsystembackend_api_1\n> Performing system checks...\n>\n> System check identified no issues (0 silenced).\n> Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7fe0f3d35950>\n> Traceback (most recent call last):\n>   File \"/usr/local/lib/python3.6/site-packages/django/db/backends/base/base.py\", line 216, in ensure_connection\n>     self.connect()\n>   File \"/usr/local/lib/python3.6/site-packages/django/db/backends/base/base.py\", line 194, in connect\n>     self.connection = self.get_new_connection(conn_params)\n>   File \"/usr/local/lib/python3.6/site-packages/django/db/backends/postgresql/base.py\", line 168, in get_new_connection\n>     connection = Database.connect(**conn_params)\n>   File \"/usr/local/lib/python3.6/site-packages/psycopg2/__init__.py\", line 130, in connect\n>     conn = _connect(dsn, connection_factory=connection_factory, **kwasync)\n> psycopg2.OperationalError: could not connect to server: No such file or directory\n> \tIs the server running locally and accepting\n> \tconnections on Unix domain socket \"/var/run/postgresql/.s.PGSQL.5432\"?\n>\n>\n> The above exception was the direct cause of the following exception:\n>\n> Traceback (most recent call last):\n>   File \"/usr/local/lib/python3.6/site-packages/django/utils/autoreload.py\", line 225, in wrapper\n>     fn(*args, **kwargs)\n>   File \"/usr/local/lib/python3.6/site-packages/django/core/management/commands/runserver.py\", line 124, in inner_run\n>     self.check_migrations()\n>   File \"/usr/local/lib/python3.6/site-packages/django/core/management/base.py\", line 427, in check_migrations\n>     executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])\n>   File \"/usr/local/lib/python3.6/site-packages/django/db/migrations/executor.py\", line 18, in __init__\n>     self.loader = MigrationLoader(self.connection)\n>   File \"/usr/local/lib/python3.6/site-packages/django/db/migrations/loader.py\", line 49, in __init__\n>     self.build_graph()\n>   File \"/usr/local/lib/python3.6/site-packages/django/db/migrations/loader.py\", line 206, in build_graph\n>     self.applied_migrations = recorder.applied_migrations()\n>   File \"/usr/local/lib/python3.6/site-packages/django/db/migrations/recorder.py\", line 61, in applied_migrations\n>     if self.has_table():\n>   File \"/usr/local/lib/python3.6/site-packages/django/db/migrations/recorder.py\", line 44, in has_table\n>     return self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor())\n>   File \"/usr/local/lib/python3.6/site-packages/django/db/backends/base/base.py\", line 255, in cursor\n>     return self._cursor()\n>   File \"/usr/local/lib/python3.6/site-packages/django/db/backends/base/base.py\", line 232, in _cursor\n>     self.ensure_connection()\n>   File \"/usr/local/lib/python3.6/site-packages/django/db/backends/base/base.py\", line 216, in ensure_connection\n>     self.connect()\n>   File \"/usr/local/lib/python3.6/site-packages/django/db/utils.py\", line 89, in __exit__\n>     raise dj_exc_value.with_traceback(traceback) from exc_value\n>   File \"/usr/local/lib/python3.6/site-packages/django/db/backends/base/base.py\", line 216, in ensure_connection\n>     self.connect()\n>   File \"/usr/local/lib/python3.6/site-packages/django/db/backends/base/base.py\", line 194, in connect\n>     self.connection = self.get_new_connection(conn_params)\n>   File \"/usr/local/lib/python3.6/site-packages/django/db/backends/postgresql/base.py\", line 168, in get_new_connection\n>     connection = Database.connect(**conn_params)\n>   File \"/usr/local/lib/python3.6/site-packages/psycopg2/__init__.py\", line 130, in connect\n>     conn = _connect(dsn, connection_factory=connection_factory, **kwasync)\n> django.db.utils.OperationalError: could not connect to server: No such file or directory\n> \tIs the server running locally and accepting\n> \tconnections on Unix domain socket \"/var/run/postgresql/.s.PGSQL.5432\"?\n>\n> —\n> You are receiving this because you are subscribed to this thread.\n> Reply to this email directly, view it on GitHub\n> <https://github.com/hackoregon/transportation-system-backend/pull/14#issuecomment-363325906>,\n> or mute the thread\n> <https://github.com/notifications/unsubscribe-auth/ARHAUUk1lPunFVfmeE6H3rbRPSMXDEb8ks5tR_OngaJpZM4R6M5u>\n> .\n>\n"}}
{"actor":{"display_login":"BrianHGrant"}}