diff --git a/.gitignore b/.gitignore index ffb70d8f..93c9dc0f 100644 --- a/.gitignore +++ b/.gitignore @@ -13,7 +13,7 @@ htmlcov *.pot *.pyc __pycache__/ -local_settings.py +settings_local.py env/ db.sqlite3 diff --git a/media/img.png b/media/img.png deleted file mode 100644 index 4d1143c9..00000000 Binary files a/media/img.png and /dev/null differ diff --git a/note_kfet/settings.py b/note_kfet/settings.py index 27912a77..320dab53 100644 --- a/note_kfet/settings.py +++ b/note_kfet/settings.py @@ -1,17 +1,11 @@ -""" -Django settings for note_kfet project. - -Generated by 'django-admin startproject' using Django 2.2.3. - -For more information on this file, see -https://docs.djangoproject.com/en/2.2/topics/settings/ - -For the full list of settings and their values, see -https://docs.djangoproject.com/en/2.2/ref/settings/ -""" +# -*- mode: python; coding: utf-8 -*- +# Copyright (C) 2018-2019 by BDE ENS Paris-Saclay +# SPDX-License-Identifier: GPL-3.0-or-later import os +from django.utils.translation import gettext_lazy as _ + # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @@ -20,21 +14,30 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = '!+61bazms$sebi=-btry)40fztxhmyo!0a*@&v!=1r&=hf9_7&' +SECRET_KEY = 'CHANGE_ME_IN_LOCAL_SETTINGS!' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True -ALLOWED_HOSTS = ["note.comby.xyz"] +ADMINS = ( + #('Admin', 'webmaster@example.com'), +) + +SITE_ID = 1 + +ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ + 'note_theme', 'django.contrib.admin', + 'django.contrib.admindocs', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', + 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', ] @@ -46,7 +49,10 @@ MIDDLEWARE = [ 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', + 'django.contrib.admindocs.middleware.XViewMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', + 'django.middleware.locale.LocaleMiddleware', + 'django.contrib.sites.middleware.CurrentSiteMiddleware', ] ROOT_URLCONF = 'note_kfet.urls' @@ -105,7 +111,12 @@ AUTH_PASSWORD_VALIDATORS = [ LANGUAGE_CODE = 'en-us' -TIME_ZONE = 'UTC' +LANGUAGES = [ + ('en-us', _('English')), + ('fr-fr', _('French')), +] + +TIME_ZONE = 'Europe/Paris' USE_I18N = True @@ -117,4 +128,17 @@ USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/2.2/howto/static-files/ +# Absolute path to the directory static files should be collected to. +# Don't put anything in this directory yourself; store your static files +# in apps' "static/" subdirectories and in STATICFILES_DIRS. +# Example: "/var/www/example.com/static/" +STATIC_ROOT = os.path.join(BASE_DIR, 'static') + +# URL prefix for static files. +# Example: "http://example.com/static/", "http://static.example.com/" STATIC_URL = '/static/' + +try: + from settings_local import * +except ImportError: + pass diff --git a/note_kfet/urls.py b/note_kfet/urls.py index 13e16a97..e2cd4951 100644 --- a/note_kfet/urls.py +++ b/note_kfet/urls.py @@ -1,21 +1,21 @@ -"""note_kfet URL Configuration +# -*- mode: python; coding: utf-8 -*- +# Copyright (C) 2018-2019 by BDE ENS Paris-Saclay +# SPDX-License-Identifier: GPL-3.0-or-later -The `urlpatterns` list routes URLs to views. For more information please see: - https://docs.djangoproject.com/en/2.2/topics/http/urls/ -Examples: -Function views - 1. Add an import: from my_app import views - 2. Add a URL to urlpatterns: path('', views.home, name='home') -Class-based views - 1. Add an import: from other_app.views import Home - 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') -Including another URLconf - 1. Import the include() function: from django.urls import include, path - 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) -""" from django.contrib import admin -from django.urls import path +from django.urls import path, include +from django.views.generic import RedirectView urlpatterns = [ + # No app, so redirect to admin + path('', RedirectView.as_view(pattern_name='admin:index'), name='index'), + + # Include Django Contrib and Core routers + # admin/login/ is redirected to the non-admin login page + path('i18n/', include('django.conf.urls.i18n')), + path('accounts/', include('django.contrib.auth.urls')), + path('accounts/profile/', + RedirectView.as_view(pattern_name='index')), + path('admin/doc/', include('django.contrib.admindocs.urls')), path('admin/', admin.site.urls), ] diff --git a/note_kfet/wsgi.py b/note_kfet/wsgi.py index cd9659e5..94a8e054 100644 --- a/note_kfet/wsgi.py +++ b/note_kfet/wsgi.py @@ -1,3 +1,7 @@ +# -*- mode: python; coding: utf-8 -*- +# Copyright (C) 2016-2019 by BDE +# SPDX-License-Identifier: GPL-3.0-or-later + """ WSGI config for note_kfet project. diff --git a/requirements.txt b/requirements.txt index 1727f8d4..d8984111 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ Django==2.2.3 pytz==2019.1 sqlparse==0.3.0 +https://gitlab.crans.org/bde/nk20/note-theme/-/jobs/artifacts/master/raw/dist/note-theme-0.1.0.tar.gz?job=build