import core.mock # Mock all url names so they can be reversed. url_names = [] with open(__file__) as urls: for line in urls: match = re.search(r'name="(\w+)"', line) if match: url_names.append(match.groups()[0]) urlpatterns = [ path("", core.mock.index, name=url_name) for url_name in url_names ] else: from core.base import Base BASE = Base() MUSIQ_URLS = [ path("state/", BASE.musiq.get_state, name="musiq_state"), path( "random_suggestion/", BASE.musiq.suggestions.random_suggestion, name="random_suggestion", ), path("request_music/", BASE.musiq.request_music, name="request_music"), path("suggestions/", BASE.musiq.suggestions.get_suggestions, name="suggestions"), path("restart/", BASE.musiq.player.restart, name="restart_song"), path("seek_backward/", BASE.musiq.player.seek_backward,
from django.urls import include from django.urls import path from django.contrib import admin from django.views.generic import RedirectView import os if os.environ.get('DJANGO_MOCK'): import core.mock urlpatterns = [ path('', core.mock.index), ] else: from core.base import Base base = Base() urlpatterns = [ path('', RedirectView.as_view(pattern_name='musiq', permanent=False), name='base'), path('musiq/', base.musiq.index, name='musiq'), path('lights/', base.lights.index, name='lights'), path('pad/', base.pad.index, name='pad'), path('settings/', base.settings.index, name='settings'), path('accounts/', include('django.contrib.auth.urls')), path('login/', RedirectView.as_view(pattern_name='login', permanent=False)), path('logged_in/', base.logged_in, name='logged_in'), path('logout/', RedirectView.as_view(pattern_name='logout', permanent=False)), path('ajax/', include([ path('state/', base.get_state, name='base_state'), path('submit_hashtag/', base.submit_hashtag, name='submit_hashtag'),