Skip to content

Commit

Permalink
refactor: Adjust project structure to use new directory structure
Browse files Browse the repository at this point in the history
Change import statements and Django project strings to account for
moving the dashboard from dashboard/ to ui/.
  • Loading branch information
chrisarridge committed Oct 21, 2024
1 parent c44aa31 commit 00fdb77
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion dashboard/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'dashboard.settings')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ui.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
Expand Down
2 changes: 1 addition & 1 deletion dashboard/ui/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@

from django.core.asgi import get_asgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'dashboard.settings')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ui.settings')

application = get_asgi_application()
6 changes: 3 additions & 3 deletions dashboard/ui/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'dashboard.urls'
ROOT_URLCONF = 'ui.urls'

TEMPLATES = [
{
Expand All @@ -76,12 +76,12 @@
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
'environment': 'dashboard.jinja2.environment'
'environment': 'ui.jinja2.environment'
},
},
]

WSGI_APPLICATION = 'dashboard.wsgi.application'
WSGI_APPLICATION = 'ui.wsgi.application'


# Database
Expand Down
26 changes: 13 additions & 13 deletions dashboard/ui/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,34 +18,34 @@
from django.urls import path
# from django.shortcuts import redirect

import dashboard.views
import ui.views


urlpatterns = [
path('admin/', admin.site.urls),

# Top level dashboard pages.
path('', dashboard.views.index, name="dash-index"),
path('headlines', dashboard.views.headlines, name="dash-headlines"),
path('data-quality', dashboard.views.data_quality, name="dash-dataquality"),
path('publishing-statistics', dashboard.views.publishing_stats, name="dash-publishingstats"),
path('exploring-data', dashboard.views.exploring_data, name="dash-exploringdata"),
path('faq', dashboard.views.faq, name="dash-faq"),
path('', ui.views.index, name="dash-index"),
path('headlines', ui.views.headlines, name="dash-headlines"),
path('data-quality', ui.views.data_quality, name="dash-dataquality"),
path('publishing-statistics', ui.views.publishing_stats, name="dash-publishingstats"),
path('exploring-data', ui.views.exploring_data, name="dash-exploringdata"),
path('faq', ui.views.faq, name="dash-faq"),

# Headlines pages and detail pages - placeholders for now.
path('headlines/publishers', dashboard.views.headlines_publishers, name="dash-headlines-publishers"),
path('headlines/files', dashboard.views.headlines_files, name="dash-headlines-files"),
path('headlines/activities', dashboard.views.headlines_activities, name="dash-headlines-activities"),
path('headlines/publishers/<slug:publisher>', dashboard.views.headlines_publisher_detail, name='dash-headlines-publisher-detail'),
path('headlines/publishers', ui.views.headlines_publishers, name="dash-headlines-publishers"),
path('headlines/files', ui.views.headlines_files, name="dash-headlines-files"),
path('headlines/activities', ui.views.headlines_activities, name="dash-headlines-activities"),
path('headlines/publishers/<slug:publisher>', ui.views.headlines_publisher_detail, name='dash-headlines-publisher-detail'),

# Data quality pages.
path('data-quality/download-errors', lambda x: None, name="dash-dataquality-download"),
path('data-quality/xml-errors', lambda x: None, name="dash-dataquality-xml"),
path('data-quality/validation', lambda x: None, name="dash-dataquality-validation"),
path('data-quality/versions', lambda x: None, name="dash-dataquality-versions"),
path('data-quality/organisation-xml', lambda x: None, name="dash-dataquality-organisation"),
path('data-quality/licenses', dashboard.views.dataquality_licenses, name="dash-dataquality-licenses"),
path('data-quality/licenses/<slug:license_id>', dashboard.views.dataquality_licenses_detail, name="dash-dataquality-licenses-detail"),
path('data-quality/licenses', ui.views.dataquality_licenses, name="dash-dataquality-licenses"),
path('data-quality/licenses/<slug:license_id>', ui.views.dataquality_licenses_detail, name="dash-dataquality-licenses-detail"),
path('data-quality/identifiers', lambda x: None, name="dash-dataquality-identifiers"),
path('data-quality/reporting-orgs', lambda x: None, name="dash-dataquality-reportingorgs"),

Expand Down
4 changes: 2 additions & 2 deletions dashboard/ui/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import config
import text
import dashboard.template_funcs
import ui.template_funcs

from data import (
ckan,
Expand Down Expand Up @@ -145,7 +145,7 @@ def _make_context(page_name: str):
commit_hash=COMMIT_HASH,
stats_commit_hash=STATS_COMMIT_HASH,
func={"sorted": sorted,
"firstint": dashboard.template_funcs.firstint,
"firstint": ui.template_funcs.firstint,
"dataset_to_publisher": lambda x: dataset_to_publisher_dict.get(x, ""),
"get_publisher_stats": get_publisher_stats,
"is_valid_element": is_valid_element,
Expand Down
2 changes: 1 addition & 1 deletion dashboard/ui/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'dashboard.settings')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ui.settings')

application = get_wsgi_application()

0 comments on commit 00fdb77

Please sign in to comment.