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

Fix Django CI issue #340

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Changes from all 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
4 changes: 1 addition & 3 deletions .github/workflows/django.yml
Original file line number Diff line number Diff line change
@@ -24,9 +24,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Create .secret file
run: |
echo "${{ secrets.PORTAL_USERDB_SECRET }}" > server/.secret

- name: Run Tests
run: |
python3.9 manage.py test
4 changes: 1 addition & 3 deletions biocompute/apis.py
Original file line number Diff line number Diff line change
@@ -243,7 +243,6 @@ def post(self, request) -> Response:
data=bco_results
)

import pdb; pdb.set_trace()
return Response(status=status.HTTP_200_OK, data=response_data)

# for index, object in enumerate(data):
@@ -306,7 +305,6 @@ def post(self, request) -> Response:
# continue

# bco_results = validator.parse_and_validate(bco_instance.contents)
# import pdb; pdb.set_trace()
# identifier, results = bco_results.popitem()

# if results["number_of_errors"] > 0:
@@ -498,7 +496,7 @@ def post(self, request) -> Response:
message=message,
data=results
))

status_code = response_status(accepted_requests, rejected_requests)
return Response(status=status_code, data=response_data)

2 changes: 1 addition & 1 deletion biocompute/models.py
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@
]

class Bco(models.Model):
"""BioComput Object Model.
"""BioCompute Object Model.

Attributes:
-----------
56 changes: 31 additions & 25 deletions config/settings.py
Original file line number Diff line number Diff line change
@@ -9,29 +9,35 @@
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

# --- SECURITY SETTINGS --- #
# Load the server config file.
secrets = configparser.ConfigParser()
secrets.read(BASE_DIR + "/.secrets")
DEBUG = secrets["SERVER"]["DEBUG"]
VERSION = secrets["SERVER"]["SERVER_VERSION"]
# Set the anonymous user's key.
ANON_KEY = secrets["DJANGO_KEYS"]["ANON_KEY"]
ALLOWED_HOSTS = secrets["SERVER"]["ALLOWED_HOSTS"].split(',')
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = secrets["DJANGO_KEYS"]["SECRET_KEY"]

# SECURITY WARNING: don't run with debug turned on in production!

# The publicly accessible hostname.
HOSTNAME = secrets["SERVER"]["HOSTNAME"]
# The human-readable hostname.
HUMAN_READABLE_HOSTNAME = secrets["SERVER"]["HUMAN_READABLE_HOSTNAME"]
# The publicly accessible hostname.
PUBLIC_HOSTNAME = secrets["SERVER"]["PUBLIC_HOSTNAME"]


CORS_ORIGIN_ALLOW_ALL = True
CORS_ORIGIN_WHITELIST = ["*"]
# Load the server .secrets file.
try:
secrets = configparser.ConfigParser()
secrets.read(BASE_DIR + "/.secrets")
DEBUG = secrets["SERVER"]["DEBUG"]
VERSION = secrets["SERVER"]["SERVER_VERSION"]
ANON_KEY = secrets["DJANGO_KEYS"]["ANON_KEY"]
ALLOWED_HOSTS = secrets["SERVER"]["ALLOWED_HOSTS"].split(',')
SECRET_KEY = secrets["DJANGO_KEYS"]["SECRET_KEY"]
HOSTNAME = secrets["SERVER"]["HOSTNAME"]
DATABASE=secrets["SERVER"]["DATABASE"]
HUMAN_READABLE_HOSTNAME = secrets["SERVER"]["HUMAN_READABLE_HOSTNAME"]
PUBLIC_HOSTNAME = secrets["SERVER"]["PUBLIC_HOSTNAME"]
EMAIL_BACKEND = secrets["SERVER"]["EMAIL_BACKEND"]

except KeyError:
SECRET_KEY="^2uql114+yy0d$xv6+lm8*#1=uxs_oa0zw0bvu^fpi4tc9x0i"
ANON_KEY="627626823549f787c3ec763ff687169206626149"
DEBUG=True
ALLOWED_HOSTS="*"
SERVER_VERSION="24.08.08"
HOSTNAME="127.0.0.1:8000"
HUMAN_READABLE_HOSTNAME="Local Test BCODB"
PUBLIC_HOSTNAME="http://127.0.0.1:8000"
SERVER_URL="http://localhost:3000"
DATABASE="db.sqlite3"
EMAIL_BACKEND="django.core.mail.backends.console.EmailBackend"
CORS_ORIGIN_ALLOW_ALL = True
CORS_ORIGIN_WHITELIST = ["*"]

# Use the REST framework
REST_FRAMEWORK = {
@@ -144,7 +150,7 @@
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": secrets["SERVER"]["DATABASE"],
"NAME": DATABASE,
}
}

@@ -178,7 +184,7 @@
# Make the object naming accessible as a dictionary.

# emailing notifications
EMAIL_BACKEND = secrets["SERVER"]["EMAIL_BACKEND"]
EMAIL_BACKEND = EMAIL_BACKEND
EMAIL_HOST = "localhost"
EMAIL_PORT = 25
DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
2 changes: 1 addition & 1 deletion config/urls.py
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
from rest_framework import permissions
from biocompute.apis import DraftRetrieveApi, PublishedRetrieveApi

VERSION = settings.VERSION
VERSION = settings.SERVER_VERSION

ShcemaView = get_schema_view(
openapi.Info(