Skip to content

Commit

Permalink
refactor: Split Django project from Django application
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Nov 8, 2021
1 parent ed63347 commit df4b678
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 8 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Expand Up @@ -34,7 +34,6 @@ jobs:
PYTHONWARNINGS: error,ignore:::tastypie.resources
DATABASE_URL: postgresql://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/postgres
PELICAN_BACKEND_DATABASE_URL: postgresql://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/postgres
DJANGO_SETTINGS_MODULE: dqt.settings
# Tastypie 0.14.3 has a missing migration.
run: |
./manage.py migrate
Expand Down
Empty file added backend/core/__init__.py
Empty file.
16 changes: 16 additions & 0 deletions backend/core/asgi.py
@@ -0,0 +1,16 @@
"""
ASGI config for core project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
"""

import os

from django.core.asgi import get_asgi_application

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

application = get_asgi_application()
4 changes: 2 additions & 2 deletions backend/dqt/settings.py → backend/core/settings.py
Expand Up @@ -66,7 +66,7 @@
"django.middleware.clickjacking.XFrameOptionsMiddleware",
]

ROOT_URLCONF = "dqt.urls"
ROOT_URLCONF = "core.urls"

TEMPLATES = [
{
Expand All @@ -85,7 +85,7 @@
},
]

WSGI_APPLICATION = "dqt.wsgi.application"
WSGI_APPLICATION = "core.wsgi.application"


# Database
Expand Down
5 changes: 5 additions & 0 deletions backend/core/urls.py
@@ -0,0 +1,5 @@
from django.urls import include, path

urlpatterns = [
path("", include("dqt.urls"), name="api"),
]
6 changes: 3 additions & 3 deletions backend/dqt/wsgi.py → backend/core/wsgi.py
@@ -1,16 +1,16 @@
"""
WSGI config for dqt project.
WSGI config for core project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dqt.settings")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "core.settings")

application = get_wsgi_application()
2 changes: 1 addition & 1 deletion backend/gunicorn_runner.sh
@@ -1,2 +1,2 @@
#!/bin/sh
gunicorn --bind 0.0.0.0:$1 --timeout 120 dqt.wsgi -c gunicorn_docker.py
gunicorn --bind 0.0.0.0:$1 --timeout 120 core.wsgi -c gunicorn_docker.py
3 changes: 2 additions & 1 deletion backend/manage.py
Expand Up @@ -5,7 +5,8 @@


def main():
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dqt.settings")
"""Run administrative tasks."""
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "core.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Expand Up @@ -19,3 +19,4 @@ Set up the git pre-commit hook:

backend/index
frontend/index
changelog

0 comments on commit df4b678

Please sign in to comment.