Skip to content

Commit

Permalink
Adds asgi config (#1130)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmsmkn authored Jan 29, 2020
1 parent ba1a14a commit 3d72853
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 29 deletions.
7 changes: 7 additions & 0 deletions app/config/asgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import os

from django.core.asgi import get_asgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")

application = get_asgi_application()
2 changes: 1 addition & 1 deletion app/config/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from celery import Celery

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")

app = Celery("grandchallenge")
app.config_from_object("django.conf:settings", namespace="CELERY_")
# Load all of the tasks from the registered apps
app.autodiscover_tasks()
15 changes: 0 additions & 15 deletions app/config/wsgi.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,7 @@
import os
import sys

from django.core.wsgi import get_wsgi_application

# Appending app_path to path allows us to easily keep the apps in the subfolder
app_path = os.path.abspath(
os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir)
)
sys.path.append(os.path.join(app_path, "grandchallenge"))

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")

# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION
# setting points here.

application = get_wsgi_application()

# Apply WSGI middleware here.
# from helloworld.wsgi import HelloWorldApplication
# application = HelloWorldApplication(application)
22 changes: 14 additions & 8 deletions app/manage.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys

if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")

from django.core.management import execute_from_command_line
def main():
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)

# Appending app_path to path allows us to easily keep the apps in the
# subfolder
current_path = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(current_path, "grandchallenge"))

execute_from_command_line(sys.argv)
if __name__ == "__main__":
main()
105 changes: 100 additions & 5 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 @@ -32,6 +32,7 @@ python-memcached = "*"
pytz = "*"
social-auth-app-django = "*"
gunicorn = "*"
uvicorn = "*"
django-celery-email = "*"
simpleitk = "*"
django-celery-beat = "*"
Expand Down

0 comments on commit 3d72853

Please sign in to comment.