from django.conf import settings
from django.contrib.staticfiles import views

from django.contrib import admin
from django.urls import path, re_path, include
from django.views.generic.base import RedirectView

from core import views as core

urlpatterns = [
	path('trumbowyg/', include('trumbowyg.urls')),
	path('admin/', admin.site.urls),

	path('favicon.ico', RedirectView.as_view(url = '/static/favicon.ico')),

	re_path(r'youtube/(?P<path>.*)$', RedirectView.as_view(url='https://feeds.duhaz.fr/flux/%(path)s')),
	re_path(r'lecture_flux/(?P<path>.*)$', RedirectView.as_view(url='https://feeds.duhaz.fr/flux/lecture_flux/%(path)s')),

	path('blog/', include('blog.urls')),

	
	path('', RedirectView.as_view(url = 'blog/')),
	path('' , core.index, name='core_index'),
	# url generique
	re_path(r'page/(?P<p_url>[a-zA-Z0-9_,-/]+)', core.page, name='core_page'),
	# last chance 
	re_path(r'(?P<p_url>[a-zA-Z0-9_.,-]+)', core.page, name='core_page'),

]

if settings.DEBUG:
	urlpatterns += [
		re_path(r'^static/(?P<path>.*)$', views.serve),
	]
