Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add WSGI script and fix errors with pip install #207

Merged
merged 7 commits into from
Feb 26, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ max-complexity = 17
max-line-length = 80
application-import-names = datagateway_api,test,util
import-order-style = google
per-file-ignores = test/*:S101,util/icat_db_generator.py:S311
per-file-ignores = test/*:S101,util/icat_db_generator.py:S311,datagateway_api/wsgi.py:E402,F401
enable-extensions=G
4 changes: 2 additions & 2 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ jobs:
run: touch logs.log
- name: Configure log file location
run: echo "`jq -r --arg REPO_DIR "$GITHUB_WORKSPACE/logs.log" \
'.log_location=$REPO_DIR' config.json.example`" > config.json.example
'.log_location=$REPO_DIR' datagateway_api/config.json.example`" > datagateway_api/config.json.example
- name: Create config.json
run: cp config.json.example config.json
run: cp datagateway_api/config.json.example datagateway_api/config.json

# Install Nox, Poetry and API's dependencies
- name: Install Nox
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,9 @@ illustrated below:
├── .pre-commit-config.yaml
├── LICENSE
├── README.md
├── config.json.example
├── datagateway_api
│ ├── config.json.example
│ ├── wsgi.py
│ ├── common
│ │ ├── backend.py
│ │ ├── backends.py
Expand Down
2 changes: 1 addition & 1 deletion datagateway_api/common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


class Config(object):
def __init__(self, path=Path(__file__).parent.parent.parent / "config.json"):
def __init__(self, path=Path(__file__).parent.parent / "config.json"):
self.path = path
with open(self.path) as target:
self.config = json.load(target)
Expand Down
File renamed without changes.
6 changes: 6 additions & 0 deletions datagateway_api/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import logging
import sys

logging.basicConfig(stream=sys.stderr)

from datagateway_api.src.main import app as application
119 changes: 69 additions & 50 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ PyYAML = "5.3.1"
python-icat = "0.17.0"
suds-community = "^0.8.4"
Flask-SQLAlchemy = "^2.4.4"
requests = "^2.25.1"

[tool.poetry.dev-dependencies]
pip-tools = "5.3.1"
Expand Down
4 changes: 3 additions & 1 deletion test/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

@pytest.fixture()
def valid_config():
return Config(path=Path(__file__).parent.parent / "config.json.example")
return Config(
path=Path(__file__).parent.parent / "datagateway_api" / "config.json.example",
)


@pytest.fixture()
Expand Down