Browse Source

Move site specific URLs into /site

brett lockspeiser 1 year ago
parent
commit
78ed9ba614
4 changed files with 71 additions and 58 deletions
  1. 5 0
      .gitignore
  2. 7 58
      sefaria/urls.py
  3. 0 0
      site/__init__.py
  4. 59 0
      site/urls.py

+ 5 - 0
.gitignore

@@ -56,6 +56,11 @@ node_modules
 /sefaria/local_settings.py
 /node/local_settings.json
 
+
+# Site specific templates and urls #
+####################################
+# /site
+
 # Symlink needed for Djano admin #
 ##################################
 /static/admin

+ 7 - 58
sefaria/urls.py

@@ -2,6 +2,7 @@ from django.conf.urls import include, url
 from django.conf.urls import handler404, handler500
 from django.contrib import admin
 from django.http import HttpResponseRedirect
+import django.contrib.auth.views as django_auth_views
 
 from emailusernames.forms import EmailAuthenticationForm
 
@@ -12,7 +13,8 @@ import reader.views as reader_views
 import sefaria.views as sefaria_views
 import sourcesheets.views as sheets_views
 import sefaria.gauth.views as gauth_views
-import django.contrib.auth.views as django_auth_views
+
+from site.urls import site_urlpatterns
 
 
 admin.autodiscover()
@@ -282,62 +284,6 @@ urlpatterns += [
     url(r'^vgarden/custom/(?P<key>.*)$', reader_views.custom_visual_garden_page),  # legacy.  Used for "maggid" and "ecology"
 ]
 
-static_pages = [
-    "about",
-    "donate",
-    "strategy",
-    "supporters",
-    "team",
-    "help",
-    "connect",
-    "visualizations",
-    "jobs",
-    "terms",
-    "privacy-policy",
-    "coming-soon",
-    "shraga-silverstein",
-    "adin-even-israel-steinsaltz",
-    "william-davidson-talmud",
-    "linker",
-    "ios",
-    "mobile",
-    "sefaria-edition",
-    "sefaria-community-translation",
-    "contributed-to-sefaria",
-    "translation-guidelines",
-    "transliteration-guidelines",
-    "even-haezer-guidelines",
-    "random-walk-through-torah",
-    "educators",
-    "the-sefaria-story",
-    "aramaic-translation-contest",
-]
-
-# Static and Semi Static Content
-urlpatterns += [
-    url(r'^$', reader_views.home, name="home"),
-    url(r'^metrics/?$', reader_views.metrics),
-    url(r'^digitized-by-sefaria/?$', reader_views.digitized_by_sefaria),
-    url(r'^(%s)/?$' % "|".join(static_pages), reader_views.serve_static),
-]
-
-
-# Redirects to Forum, Wiki, etc
-urlpatterns += [
-    url(r'^forum/?$', lambda x: HttpResponseRedirect('https://groups.google.com/forum/?fromgroups#!forum/sefaria')),
-    url(r'^wiki/?$', lambda x: HttpResponseRedirect('https://github.com/Sefaria/Sefaria-Project/wiki')),
-    url(r'^developers/?$', lambda x: HttpResponseRedirect('https://github.com/Sefaria/Sefaria-Project/wiki#developers')),
-    url(r'^request-a-text/?$', lambda x: HttpResponseRedirect('https://goo.gl/forms/ru33ivawo7EllQxa2')),
-    url(r'^request-a-training/?$', lambda x: HttpResponseRedirect(' https://docs.google.com/forms/d/1CJZHRivM2qFeF2AE2afpvE1m86AgJPCxUEFu5EG92F8/edit?usp=sharing_eil&ts=5a4dc5e0')),
-    url(r'^contribute/?$', lambda x: HttpResponseRedirect('https://github.com/Sefaria/Sefaria-Project/wiki/Guide-to-Contributing')),
-    url(r'^faq/?$', lambda x: HttpResponseRedirect('https://github.com/Sefaria/Sefaria-Project/wiki#frequently-asked-questions')),
-    url(r'^textmap/?$', lambda x: HttpResponseRedirect('/static/files/Sefaria-Text-Map-June-2016.pdf')),
-    url(r'^workshop/?$', lambda x: HttpResponseRedirect('/static/files/Sefaria_SummerMeeting_2016.pdf')),
-    url(r'^ideasforteaching/?$', lambda x: HttpResponseRedirect('/static/files/Sefaria_Teacher_Generated_Ideas_for_Your_Classroom.pdf')),
-    url(r'^gala/?$', lambda x: HttpResponseRedirect('https://www.501auctions.com/sefaria')),
-    url(r'^jfn?$', lambda x: HttpResponseRedirect('https://www.sefaria.org/sheets/60494')),
-]
-
 # Sefaria.js -- Packaged JavaScript
 urlpatterns += [
     url(r'^data\.js$', sefaria_views.data_js),
@@ -392,7 +338,6 @@ urlpatterns += [
     url(r'^admin/versions-csv', sefaria_views.versions_csv),
     url(r'^admin/index-sheets-by-timestamp', sefaria_views.index_sheets_by_timestamp),
     url(r'^admin/?', include(admin.site.urls)),
-
 ]
 
 # Stats API - return CSV
@@ -407,12 +352,16 @@ urlpatterns += [
     url(r'^gauth/callback$', gauth_views.auth_return, name="gauth_callback"),
 ]
 
+# Site specific URLS loaded from 
+urlpatterns += site_urlpatterns
+
 # Catch all to send to Reader
 urlpatterns += [
     url(r'^(?P<tref>[^/]+)/(?P<lang>\w\w)/(?P<version>.*)$', reader_views.old_versions_redirect),
     url(r'^(?P<tref>[^/]+)(/)?$', reader_views.catchall)
 ]
 
+
 if DOWN_FOR_MAINTENANCE:
     # Keep admin accessible
     urlpatterns = [

+ 0 - 0
site/__init__.py


+ 59 - 0
site/urls.py

@@ -0,0 +1,59 @@
+import reader.views as reader_views
+
+
+site_urlpatterns = []
+
+static_pages = [
+    "about",
+    "donate",
+    "strategy",
+    "supporters",
+    "team",
+    "help",
+    "connect",
+    "visualizations",
+    "jobs",
+    "terms",
+    "privacy-policy",
+    "coming-soon",
+    "shraga-silverstein",
+    "adin-even-israel-steinsaltz",
+    "william-davidson-talmud",
+    "linker",
+    "ios",
+    "mobile",
+    "sefaria-edition",
+    "sefaria-community-translation",k
+    "contributed-to-sefaria",
+    "translation-guidelines",
+    "transliteration-guidelines",
+    "even-haezer-guidelines",
+    "random-walk-through-torah",
+    "educators",
+    "the-sefaria-story",
+    "aramaic-translation-contest",
+]
+
+# Semi Static Content
+urlpatterns += [
+    url(r'^$', reader_views.home, name="home"),
+    url(r'^metrics/?$', reader_views.metrics),
+    url(r'^digitized-by-sefaria/?$', reader_views.digitized_by_sefaria),
+    url(r'^(%s)/?$' % "|".join(static_pages), reader_views.serve_static),
+]
+
+# Redirects to Forum, Wiki, etc
+site_urlpatterns += [
+    url(r'^forum/?$', lambda x: HttpResponseRedirect('https://groups.google.com/forum/?fromgroups#!forum/sefaria')),
+    url(r'^wiki/?$', lambda x: HttpResponseRedirect('https://github.com/Sefaria/Sefaria-Project/wiki')),
+    url(r'^developers/?$', lambda x: HttpResponseRedirect('https://github.com/Sefaria/Sefaria-Project/wiki#developers')),
+    url(r'^request-a-text/?$', lambda x: HttpResponseRedirect('https://goo.gl/forms/ru33ivawo7EllQxa2')),
+    url(r'^request-a-training/?$', lambda x: HttpResponseRedirect(' https://docs.google.com/forms/d/1CJZHRivM2qFeF2AE2afpvE1m86AgJPCxUEFu5EG92F8/edit?usp=sharing_eil&ts=5a4dc5e0')),
+    url(r'^contribute/?$', lambda x: HttpResponseRedirect('https://github.com/Sefaria/Sefaria-Project/wiki/Guide-to-Contributing')),
+    url(r'^faq/?$', lambda x: HttpResponseRedirect('https://github.com/Sefaria/Sefaria-Project/wiki#frequently-asked-questions')),
+    url(r'^textmap/?$', lambda x: HttpResponseRedirect('/static/files/Sefaria-Text-Map-June-2016.pdf')),
+    url(r'^workshop/?$', lambda x: HttpResponseRedirect('/static/files/Sefaria_SummerMeeting_2016.pdf')),
+    url(r'^ideasforteaching/?$', lambda x: HttpResponseRedirect('/static/files/Sefaria_Teacher_Generated_Ideas_for_Your_Classroom.pdf')),
+    url(r'^gala/?$', lambda x: HttpResponseRedirect('https://www.501auctions.com/sefaria')),
+    url(r'^jfn?$', lambda x: HttpResponseRedirect('https://www.sefaria.org/sheets/60494')),
+]