Skip to content

Commit

Permalink
extract urls.py
Browse files Browse the repository at this point in the history
  • Loading branch information
schlich committed Dec 19, 2023
1 parent f354e35 commit df903eb
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 28 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ site.css.map
build
.venv
dist
*.egg-info
*.egg-info
db.sqlite
28 changes: 1 addition & 27 deletions dsa_actionkit/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,40 +212,14 @@ def proxy_serve(request, path, document_root=None, show_indexes=False):
raise Http404


#############
# URLS
#############

ROOT_URLCONF = 'dsa_actionkit.settings'

urlpatterns = [
re_path(r'^context', login_context),
re_path(r'^progress', login_context, name='progress'),
re_path(r'^logout', logout, name="logout"),
re_path(r'^(?P<name>[-.\w]+)?(/(?P<page>[-.\w]+))?$', index),
re_path(r'^forgot/$', user_password_forgot, name='user_password_forgot'),
re_path(r'^cms/event/(?P<page>[-.\w]+)/search_results/', event_search_results, name='event_search_results'),
re_path(r'^fake/api/events', event_api_moveon_fake, name="event_api_moveon_fake"),
# ActionKit urls or {% url %} template tag:
re_path(r'^fake/stub/reverse', event_api_moveon_fake, name="reverse_donation"),
]
if STATIC_ROOT:
urlpatterns = (urlpatterns
+ static(STATIC_URL, document_root=STATIC_ROOT)
+ static('/resources/',
view=proxy_serve,
document_root=os.path.join(STATIC_ROOT, './resources'))
+ static('/media/',
view=proxy_serve,
document_root=os.path.join(STATIC_ROOT, './media'))
)

if os.path.exists(os.path.join(PROJECT_ROOT_PATH, 'local_settings.py')):
from local_settings import *

DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": "mydatabase",
"NAME": "db.sqlite",
}
}
27 changes: 27 additions & 0 deletions dsa_actionkit/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#############
# URLS
#############

ROOT_URLCONF = 'dsa_actionkit.urls'

urlpatterns = [
re_path(r'^context', login_context),
re_path(r'^progress', login_context, name='progress'),
re_path(r'^logout', logout, name="logout"),
re_path(r'^(?P<name>[-.\w]+)?(/(?P<page>[-.\w]+))?$', index),
re_path(r'^forgot/$', user_password_forgot, name='user_password_forgot'),
re_path(r'^cms/event/(?P<page>[-.\w]+)/search_results/', event_search_results, name='event_search_results'),
re_path(r'^fake/api/events', event_api_moveon_fake, name="event_api_moveon_fake"),
# ActionKit urls or {% url %} template tag:
re_path(r'^fake/stub/reverse', event_api_moveon_fake, name="reverse_donation"),
]
if STATIC_ROOT:
urlpatterns = (urlpatterns
+ static(STATIC_URL, document_root=STATIC_ROOT)
+ static('/resources/',
view=proxy_serve,
document_root=os.path.join(STATIC_ROOT, './resources'))
+ static('/media/',
view=proxy_serve,
document_root=os.path.join(STATIC_ROOT, './media'))
)

0 comments on commit df903eb

Please sign in to comment.