Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ codekit-config.json

# Django static
staticfiles/
static/hash.txt

.venv
release-notes-checklist
Expand Down
8 changes: 5 additions & 3 deletions bin/pre_compile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

# Syntax bin/compile <build-dir> <cache-dir>

echo "-----> Writing out SOURCE_VERSION ($SOURCE_VERSION) to $BUILD_DIR/frontends/mit-open/build/static"
mkdir -p $BUILD_DIR/frontends/mit-open/build/static
echo $SOURCE_VERSION >$BUILD_DIR/frontends/mit-open/build/static/hash.txt
STATIC_DIR="$BUILD_DIR/static"

echo "-----> Writing out SOURCE_VERSION ($SOURCE_VERSION) to $STATIC_DIR"
mkdir -p $STATIC_DIR
echo $SOURCE_VERSION >$STATIC_DIR/hash.txt
2 changes: 1 addition & 1 deletion main/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@
STATIC_URL = "/static/"

STATIC_ROOT = "staticfiles"
STATICFILES_DIRS = [os.path.join(BASE_DIR, "frontends/mit-open/public")] # noqa: PTH118
STATICFILES_DIRS = [os.path.join(BASE_DIR, "static")] # noqa: PTH118

# Important to define this so DEBUG works properly
INTERNAL_IPS = (get_string("HOST_IP", "127.0.0.1"),)
Expand Down
70 changes: 37 additions & 33 deletions main/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,39 +36,43 @@
features_router = DefaultRouter()
features_router.register(r"_/features", FeaturesViewSet, basename="features")

urlpatterns = [ # noqa: RUF005
path("scim/v2/", include("django_scim.urls")),
re_path(r"^o/", include("oauth2_provider.urls", namespace="oauth2_provider")),
re_path(r"^admin/", admin.site.urls),
re_path(r"", include("authentication.urls")),
re_path(r"", include("channels.urls")),
re_path(r"", include("profiles.urls")),
re_path(r"", include("embedly.urls")),
re_path(r"", include("learning_resources_search.urls")),
re_path(r"", include("ckeditor.urls")),
re_path(r"", include("widgets.urls")),
re_path(r"", include("openapi.urls")),
re_path(r"", include("learning_resources.urls")),
re_path(r"", include("articles.urls")),
re_path(r"", include("testimonials.urls")),
# React App
re_path(r"^$", index, name="main-index"),
re_path(r"^privacy-statement/", index, name="privacy-statement"),
re_path(r"^search/", index, name="site-search"),
re_path(r"^departments/", index, name="departments"),
re_path(r"^learningpaths/", index, name="learningpaths"),
re_path(r"^userlists/", index, name="userlists"),
re_path(r"^articles/", index, name="articles"),
re_path(r"^dashboard/", index, name="dashboard"),
re_path(r"^program_letter/", index, name="programletter"),
re_path(r"^c/", index, name="channels"),
re_path(r"", include(features_router.urls)),
# Hijack
re_path(r"^hijack/", include("hijack.urls", namespace="hijack")),
re_path(r"", include("news_events.urls")),
re_path(r"^app", RedirectView.as_view(url=settings.APP_BASE_URL)),
re_path(r"^silk/", include("silk.urls", namespace="silk")),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns = (
[ # noqa: RUF005
path("scim/v2/", include("django_scim.urls")),
re_path(r"^o/", include("oauth2_provider.urls", namespace="oauth2_provider")),
re_path(r"^admin/", admin.site.urls),
re_path(r"", include("authentication.urls")),
re_path(r"", include("channels.urls")),
re_path(r"", include("profiles.urls")),
re_path(r"", include("embedly.urls")),
re_path(r"", include("learning_resources_search.urls")),
re_path(r"", include("ckeditor.urls")),
re_path(r"", include("widgets.urls")),
re_path(r"", include("openapi.urls")),
re_path(r"", include("learning_resources.urls")),
re_path(r"", include("articles.urls")),
re_path(r"", include("testimonials.urls")),
re_path(r"", include("news_events.urls")),
# React App
re_path(r"^$", index, name="main-index"),
re_path(r"^privacy-statement/", index, name="privacy-statement"),
re_path(r"^search/", index, name="site-search"),
re_path(r"^departments/", index, name="departments"),
re_path(r"^learningpaths/", index, name="learningpaths"),
re_path(r"^userlists/", index, name="userlists"),
re_path(r"^articles/", index, name="articles"),
re_path(r"^dashboard/", index, name="dashboard"),
re_path(r"^program_letter/", index, name="programletter"),
re_path(r"^c/", index, name="channels"),
re_path(r"", include(features_router.urls)),
re_path(r"^app", RedirectView.as_view(url=settings.APP_BASE_URL)),
re_path(r"^silk/", include("silk.urls", namespace="silk")),
# Hijack
re_path(r"^hijack/", include("hijack.urls", namespace="hijack")),
]
+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
+ static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
)

if settings.DEBUG:
import debug_toolbar # pylint: disable=wrong-import-position, wrong-import-order
Expand Down