aboutsummaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2018-11-24 22:29:02 -0600
committerluxagraf <sng@luxagraf.net>2018-11-24 22:29:02 -0600
commit0c2a092e8d8ad33a1c306ee9efca0da96eb56415 (patch)
tree0aaf48f20771c97ec30e005ef818ef6ce4856097 /config
parent7a284139f6b97bb06548e69d47eef188bc99099d (diff)
way to much for a single commit
Diffstat (limited to 'config')
-rw-r--r--config/base_urls.py32
-rw-r--r--config/requirements.txt2
-rw-r--r--config/settings.py24
3 files changed, 49 insertions, 9 deletions
diff --git a/config/base_urls.py b/config/base_urls.py
index 84dd56d..953ceae 100644
--- a/config/base_urls.py
+++ b/config/base_urls.py
@@ -9,25 +9,39 @@ from django_registration.backends.activation.views import RegistrationView
from rest_framework import routers
from pages.views import PageDetailView
-from notes.views import NoteViewSet, FolderViewSet, NoteListView
from accounts.forms import UserForm
-
+from notes.views import (
+ NoteViewSet,
+ NotebookViewSet,
+ NoteListView,
+)
router = routers.DefaultRouter()
-router.register(r'<str:user>/notes/folder/', FolderViewSet, basename="folder-api")
-router.register(r'<str:user>/notes/', NoteViewSet, basename="notes-api")
-
+router.register(r'notes/notebook/', NotebookViewSet, basename="notebook-api")
+router.register(r'notes', NoteViewSet, basename="notes-api")
+ADMIN_URL = 'https://docs.djangoproject.com/en/dev/ref/contrib/admin/'
urlpatterns = static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += [
- path('admin/', admin.site.urls),
+ path('admin/', RedirectView.as_view(url=ADMIN_URL)),
+ path('magux/', admin.site.urls),
path(r'accounts/', include('django_registration.backends.activation.urls')),
path(r'accounts/', include('django.contrib.auth.urls')),
path(r'register/', RegistrationView.as_view(form_class=UserForm), name='django_registration_register',),
path(r'settings/', include('accounts.urls')),
path(r'', include('django_registration.backends.activation.urls')),
path(r'', include('django.contrib.auth.urls')),
- path(r'', include('notes.urls')),
- path(r'<slug>', PageDetailView.as_view(), name="pages"),
- path(r'<path>/<slug>/', PageDetailView.as_view(), name="pages"),
+ path(r'', NoteListView.as_view(), name='homepage',),
+ path(r'notes/', include('notes.urls')),
path(r'api/', include(router.urls)),
+ path(r'<slug>', PageDetailView.as_view(), name="pages"),
+ #path(r'<path>/<slug>/', PageDetailView.as_view(), name="pages"),
path(r'api-auth/', include('rest_framework.urls', namespace='rest_framework'))
]
+if settings.DEBUG:
+ import debug_toolbar
+ urlpatterns = [
+ path('__debug__/', include(debug_toolbar.urls)),
+
+ # For django versions before 2.0:
+ # url(r'^__debug__/', include(debug_toolbar.urls)),
+
+ ] + urlpatterns
diff --git a/config/requirements.txt b/config/requirements.txt
index fb66a23..cfe5b7f 100644
--- a/config/requirements.txt
+++ b/config/requirements.txt
@@ -7,6 +7,7 @@ confusable-homoglyphs==3.2.0
coverage==4.5.1
decorator==4.3.0
Django==2.1.2
+django-debug-toolbar==1.10.1
django-extensions==2.1.3
django-registration==3.0
django-storages==1.7.1
@@ -37,6 +38,7 @@ python-decouple==3.1
pytz==2018.7
requests==2.20.1
six==1.11.0
+sqlparse==0.2.4
text-unidecode==1.2
traitlets==4.3.2
urllib3==1.24.1
diff --git a/config/settings.py b/config/settings.py
index 52d2314..b95c18d 100644
--- a/config/settings.py
+++ b/config/settings.py
@@ -25,6 +25,7 @@ AUTH_PROFILE_MODULE = "accounts.UserProfile"
AUTH_USER_MODEL = "accounts.User"
DEFAULT_FILE_STORAGE = config('DEFAULT_FILE_STORAGE')
+INTERNAL_IPS = config('INTERNAL_IPS')
AWS_S3_OBJECT_PARAMETERS = {
'CacheControl': 'max-age=86400',
@@ -39,6 +40,9 @@ REGISTRATION_SALT = 'Astra inclinant, sed non obligant'
# Django Rest Framework
REST_FRAMEWORK = {
+ 'DEFAULT_AUTHENTICATION_CLASSES': (
+ 'rest_framework.authentication.SessionAuthentication',
+ ),
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.IsAuthenticated',
)
@@ -60,6 +64,7 @@ THIRD_PARTY_APPS = [
'taggit_serializer',
'django_extensions',
'rest_framework',
+ 'debug_toolbar'
]
LOCAL_APPS = [
'utils',
@@ -75,6 +80,7 @@ MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
+ 'debug_toolbar.middleware.DebugToolbarMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
@@ -164,5 +170,23 @@ STATIC_ROOT = BASE_DIR+'/static/'
MEDIA_URL = '/media/'
MEDIA_ROOT = BASE_DIR+'/media/'
+LOGOUT_REDIRECT_URL = "/"
+
EMAIL_BACKEND = "django.core.mail.backends.filebased.EmailBackend"
EMAIL_FILE_PATH = os.path.join(BASE_DIR, "sent_emails")
+
+LOGGING = {
+ 'version': 1,
+ 'disable_existing_loggers': False,
+ 'handlers': {
+ 'console': {
+ 'class': 'logging.StreamHandler',
+ },
+ },
+ 'loggers': {
+ 'django': {
+ 'handlers': ['console'],
+ 'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'),
+ },
+ },
+}