Skip to content

Commit

Permalink
Updates Lingo to latest v7.6 patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
johnatawnclementawn committed Jul 29, 2024
1 parent 99de9a9 commit 4a6a6e0
Show file tree
Hide file tree
Showing 7 changed files with 536 additions and 12,760 deletions.
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ omit =
*/settings*.py
*/urls.py
*/wsgi.py
*/hosts.py
*/celery.py
*/__init__.py

Expand Down
7 changes: 7 additions & 0 deletions arches_lingo/hosts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import re
from django_hosts import patterns, host

host_patterns = patterns(
"",
host(re.sub(r"_", r"-", r"arches_lingo"), "arches_lingo.urls", name="arches_lingo"),
)
14 changes: 13 additions & 1 deletion arches_lingo/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
"django.contrib.messages",
"django.contrib.staticfiles",
"django.contrib.gis",
"django_hosts",
"arches",
"arches.app.models",
"arches.management",
Expand All @@ -143,10 +144,13 @@
"oauth2_provider",
"django_celery_results",
# "silk",
"arches.app",
"arches_lingo",
)

INSTALLED_APPS += ("arches.app",)

ROOT_HOSTCONF = "arches_lingo.hosts"
DEFAULT_HOST = "arches_lingo"

MIDDLEWARE = [
"corsheaders.middleware.CorsMiddleware",
Expand All @@ -165,6 +169,14 @@
# "silk.middleware.SilkyMiddleware",
]

MIDDLEWARE.insert( # this must resolve to first MIDDLEWARE entry
0, "django_hosts.middleware.HostsRequestMiddleware"
)

MIDDLEWARE.append( # this must resolve last MIDDLEWARE entry
"django_hosts.middleware.HostsResponseMiddleware"
)

STATICFILES_DIRS = build_staticfiles_dirs(app_root=APP_ROOT)

TEMPLATES = build_templates_config(
Expand Down
9 changes: 7 additions & 2 deletions arches_lingo/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@
from arches_lingo.views import ConceptTreeView

urlpatterns = [
path("", include("arches.urls")),
path("concept_trees/", ConceptTreeView.as_view(), name="concept_trees"),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
]

# Ensure Arches core urls are superseded by project-level urls
urlpatterns.append(path("", include("arches.urls")))

# Adds URL pattern to serve media files during development
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

# Only handle i18n routing in active project. This will still handle the routes provided by Arches core and Arches applications,
# but handling i18n routes in multiple places causes application errors.
Expand Down
13,255 changes: 499 additions & 12,756 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions webpack/webpack-utils/build-filepath-lookup.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ function buildFilepathLookup(path, staticUrlPrefix) {
};

return getFileList(path).reduce((lookup, file) => {
// Ignore dotfiles
if (file.match(new RegExp(Path.sep + '\\.')) || file.match(/^\./)) {
return lookup;
}
const extension = file.match(/[^.]+$/).toString();
const extensionReplacementRegex = new RegExp(`\\.${extension}$`);

Expand Down
6 changes: 5 additions & 1 deletion webpack/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,11 @@ module.exports = () => {
...nodeModulesAliases,
...parsedPackageJSONFilepaths,
'@': [Path.resolve(__dirname, APP_ROOT, 'src'), ...archesApplicationsVuePaths, Path.resolve(__dirname, ROOT_DIR, 'app', 'src')],
'node_modules': Path.resolve(__dirname, PROJECT_RELATIVE_NODE_MODULES_PATH)
'node_modules': Path.resolve(__dirname, PROJECT_RELATIVE_NODE_MODULES_PATH),
'arches/arches/app': Path.resolve(__dirname, ROOT_DIR, 'app'), // ensure project-level imports of arches components point to local file
...Object.fromEntries(ARCHES_APPLICATIONS.map(app => [ // ensure project-level imports of arches application components point to local file
Path.join(app, app), Path.resolve(__dirname, ARCHES_APPLICATIONS_PATHS[app])
])),
},
},
module: {
Expand Down

0 comments on commit 4a6a6e0

Please sign in to comment.