Configure Django App

This commit is contained in:
Alexandre Iooss 2019-07-08 11:08:07 +02:00
parent 5c03f15d6f
commit 3345ddb0f7
No known key found for this signature in database
GPG Key ID: 6C79278F3FCDCC02
6 changed files with 59 additions and 30 deletions

2
.gitignore vendored
View File

@ -13,7 +13,7 @@ htmlcov
*.pot *.pot
*.pyc *.pyc
__pycache__/ __pycache__/
local_settings.py settings_local.py
env/ env/
db.sqlite3 db.sqlite3

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

View File

@ -1,17 +1,11 @@
""" # -*- mode: python; coding: utf-8 -*-
Django settings for note_kfet project. # Copyright (C) 2018-2019 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
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/
"""
import os import os
from django.utils.translation import gettext_lazy as _
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 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/ # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret! # 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! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True DEBUG = True
ALLOWED_HOSTS = ["note.comby.xyz"] ADMINS = (
#('Admin', 'webmaster@example.com'),
)
SITE_ID = 1
ALLOWED_HOSTS = []
# Application definition # Application definition
INSTALLED_APPS = [ INSTALLED_APPS = [
'note_theme',
'django.contrib.admin', 'django.contrib.admin',
'django.contrib.admindocs',
'django.contrib.auth', 'django.contrib.auth',
'django.contrib.contenttypes', 'django.contrib.contenttypes',
'django.contrib.sessions', 'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
] ]
@ -46,7 +49,10 @@ MIDDLEWARE = [
'django.middleware.csrf.CsrfViewMiddleware', 'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware', 'django.contrib.messages.middleware.MessageMiddleware',
'django.contrib.admindocs.middleware.XViewMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.contrib.sites.middleware.CurrentSiteMiddleware',
] ]
ROOT_URLCONF = 'note_kfet.urls' ROOT_URLCONF = 'note_kfet.urls'
@ -105,7 +111,12 @@ AUTH_PASSWORD_VALIDATORS = [
LANGUAGE_CODE = 'en-us' LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC' LANGUAGES = [
('en-us', _('English')),
('fr-fr', _('French')),
]
TIME_ZONE = 'Europe/Paris'
USE_I18N = True USE_I18N = True
@ -117,4 +128,17 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images) # Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.2/howto/static-files/ # 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/' STATIC_URL = '/static/'
try:
from settings_local import *
except ImportError:
pass

View File

@ -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.contrib import admin
from django.urls import path from django.urls import path, include
from django.views.generic import RedirectView
urlpatterns = [ 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), path('admin/', admin.site.urls),
] ]

View File

@ -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. WSGI config for note_kfet project.

View File

@ -1,3 +1,4 @@
Django==2.2.3 Django==2.2.3
pytz==2019.1 pytz==2019.1
sqlparse==0.3.0 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