Commit 8d3d5f76 authored by Charlie Jacomme's avatar Charlie Jacomme

Stertchtisation de la note

parent 87710f05
......@@ -2,19 +2,25 @@
# -*- encoding: utf-8 -*-
import os
import sys
# À partir de Django 1.7, on doit faire le setup si on veut pouvoir
# importer les modules avant d'avoir chargé toutes les apps
# Et on a besoin de connaître le nom du module settings pour cela
import django
os.environ["DJANGO_SETTINGS_MODULE"] = "note.settings"
django.setup()
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "note.settings")
from django.core.management import execute_from_command_line
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
# issue is really that Django is missing to avoid masking other
# exceptions on Python 2.
try:
import django
except ImportError:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
)
raise
execute_from_command_line(sys.argv)
......@@ -24,8 +24,6 @@ else:
DEFAULT_CHARSET = "utf-8"
#: Mode de debug
DEBUG = not PROD
#: Debug aussi quand on plante dans le rendering d'un template
TEMPLATE_DEBUG = DEBUG
#: Adresse mail à qui envoyer des problèmes durant l'exécution
......@@ -129,11 +127,11 @@ MEDIA_URL = os.path.join(NOTE_ROOT_URL, 'media/')
#: URL prefix for static files.
#: Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'
STATIC_URL = r'/static/'
#: Additional locations of static files
STATICFILES_DIRS = (
ROOT_PATH + "static/",
os.path.join(PROJECT_PATH, '../static/'),
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
......@@ -150,24 +148,20 @@ STATICFILES_FINDERS = (
from secrets import SECRET_KEY
#: List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)
#: A tuple of callables that are used to populate the context in RequestContext.
#: These callables take a request object as their argument
#: and return a dictionary of items to be merged into the context.
TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.auth.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.static",
"django.core.context_processors.request",
"django.contrib.messages.context_processors.messages"
)
TEMPLATES = [{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ['templates'],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
}]
#: A tuple of middleware classes to use. See `Middleware <https://docs.djangoproject.com/en/dev/topics/http/middleware/>`_.
MIDDLEWARE_CLASSES = (
......@@ -190,15 +184,9 @@ MIDDLEWARE_CLASSES = (
ROOT_URLCONF = 'urls'
#: Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = '..wsgi.application'
WSGI_APPLICATION = 'note.wsgi.application'
#: List of locations of the template source files searched by django.template.loaders.filesystem.Loader, in search order.
TEMPLATE_DIRS = (
ROOT_PATH + "note/templates/",
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)
#: A tuple of strings designating all applications that are enabled in this Django installation.
#: Each string should be a full Python path to a Python package that contains a Django application,
......
{% load note_templatetags %}
{% load i18n %}
{% load static %}
<!DOCTYPE html>
{% get_current_language as LANGUAGE_CODE %}
......@@ -10,8 +11,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
{% block stylesheets %}
<link rel="stylesheet" href="{{ STATIC_URL }}css/bootstrap.css"/>
<link rel="stylesheet" href="{{ STATIC_URL }}css/custom/note-bootstrap.css"/>
<link rel="stylesheet" href="{% static 'css/bootstrap.css' %}"/>
<link rel="stylesheet" href="{% static 'css/custom/note-bootstrap.css' %}"/>
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
......@@ -97,8 +98,8 @@
<!-- Le javascript
========================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="{{ STATIC_URL }}js/jquery.js"></script>
<script src="{{ STATIC_URL }}js/bootstrap.js"></script>
<script src="{% static 'js/jquery.js' %}"></script>
<script src="{% static 'js/bootstrap.js' %}"></script>
<script>
/* On peut avoir besoin de ces variables n'importe où dans le Javascript */
var NOTE_ROOT_URL = {{ NOTE_ROOT_URL }};
......
{% load note_templatetags %}
{% load i18n %}
{% load static %}
<!DOCTYPE html>
{% get_current_language as LANGUAGE_CODE %}
<html lang="{{ LANGUAGE_CODE }}">
......@@ -10,8 +10,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
{% block stylesheets %}
<link rel="stylesheet" href="{{ STATIC_URL }}css/bootstrap.css"/>
<link rel="stylesheet" href="{{ STATIC_URL }}css/custom/note-bootstrap.css"/>
<link rel="stylesheet" href="{% static 'css/bootstrap.css' %}"/>
<link rel="stylesheet" href="{% static 'css/custom/note-bootstrap.css' %}"/>
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
......@@ -102,12 +102,12 @@
========================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script type="text/javascript" src="{% url 'javascript_catalog' %}"></script>
<script src="{{ STATIC_URL }}js/jquery.js"></script>
<script src="{{ STATIC_URL }}js/bootstrap.js"></script>
<script src="{% static 'js/jquery.js' %}"></script>
<script src="{% static 'js/bootstrap.js' %}"></script>
<script>
/* On peut avoir besoin de ces variables n'importe où dans le Javascript */
var NOTE_ROOT_URL = {{ NOTE_ROOT_URL }};
var STATIC_URL = {{ STATIC_URL }};
var STATIC_URL = /static/;
/* Responsiveness des onglets de la note*/
......
{% extends "note/base.html" %}
{% load note_templatetags %}
{% load i18n %}
{% load static %}
{% block title %}{% trans "Gestion des boutons" %}{% endblock %}
{% block additional_javascript %}
<script src="{{ STATIC_URL }}js/custom/getXMLHttpRequest.js"></script>
<script src="{{ STATIC_URL }}js/custom/boutons_dynamiques.js"></script>
<script src="{% static 'js/custom/getXMLHttpRequest.js' %}"></script>
<script src="{% static 'js/custom/boutons_dynamiques.js' %}"></script>
{% endblock %}
{% block applets %}
<li role="presentation", class="active"><a href="{{ NOTE_ROOT_URL }}boutons/">{% trans "Boutons" %}</a></li>
......
{% extends "note/base.html" %}
{% load i18n %}
{% load static %}
{# Pour ne pas utiliser la taille par défaut de la page #}
......
{% extends "note/base.html" %}
{% load i18n %}
{% load static %}
{% block title %}{% trans "Comptes" %}{% endblock %}
{% block additional_javascript %}
<script src="{{ STATIC_URL }}js/custom/getXMLHttpRequest.js"></script>
<script src="{{ STATIC_URL }}js/custom/liste_dynamique_search.js"></script>
<script src="{% static 'js/custom/getXMLHttpRequest.js' %}"></script>
<script src="{% static 'js/custom/liste_dynamique_search.js' %}"></script>
{% endblock %}
{% block applets %}
<li role="presentation" class="active"><a href="{{ NOTE_ROOT_URL }}comptes/">{% trans "Recherche" %}</a></li>
......
{% extends "note/base.html" %}
{% load note_templatetags %}
{% load i18n %}
{% load static %}
{% block title %}{% trans "Consos" %}{% endblock %}
{% block additional_javascript %}
<script src="{{ STATIC_URL }}js/custom/getXMLHttpRequest.js"></script>
<script src="{{ STATIC_URL }}js/custom/liste_dynamique_quick.js"></script>
<script src="{% static 'js/custom/getXMLHttpRequest.js' %}"></script>
<script src="{% static 'js/custom/liste_dynamique_quick.js' %}"></script>
<!--Attention, intervertir les deux lignes qui suivent provoque l'apocalypse-->
<script src="{{ STATIC_URL }}js/custom/consos_double_stack.js"></script>
<script src="{{ STATIC_URL }}js/custom/consos_single_stack.js"></script>
<script src="{{ STATIC_URL }}js/custom/consos_base.js"></script>
<script src="{{ STATIC_URL }}js/custom/tabs.js"></script>
<script src="{{ STATIC_URL }}js/custom/toggle_transactions.js"></script>
<script src="{% static 'js/custom/consos_double_stack.js' %}"></script>
<script src="{% static 'js/custom/consos_single_stack.js' %}"></script>
<script src="{% static 'js/custom/consos_base.js' %}"></script>
<script src="{% static 'js/custom/tabs.js' %}"></script>
<script src="{% static 'js/custom/toggle_transactions.js' %}"></script>
{% endblock %}
{% block applets %}
......
{% extends "note/base.html" %}
{% load note_templatetags %}
{% load i18n %}
{% load static %}
{% block title %}{% trans "Virements" %}{% endblock %}
{% block additional_javascript %}
<script src="{{ STATIC_URL }}js/custom/getXMLHttpRequest.js"></script>
<script src="{{ STATIC_URL }}js/custom/liste_dynamique_quick.js"></script>
<script src="{{ STATIC_URL }}js/custom/consos_single_stack.js"></script>
<script src="{{ STATIC_URL }}js/custom/consos_base.js"></script>
<script src="{% static 'js/custom/getXMLHttpRequest.js' %}"></script>
<script src="{% static 'js/custom/liste_dynamique_quick.js' %}"></script>
<script src="{% static 'js/custom/consos_single_stack.js' %}"></script>
<script src="{% static 'js/custom/consos_base.js' %}"></script>
<script>
/* Sur la page de dons, il y a certaines données auxquelles on n'a pas accès (le solde, la photo) */
page_dons = true;
......
{% extends "note/base.html" %}
{% load note_templatetags %}
{% load i18n %}
{% load static %}
{% block title %}{% blocktrans with id=activite.id %}Invitation à l'activité n°{{ id }}{% endblocktrans %}{% endblock %}
{% if isadmin %}
{% block additional_javascript %}
<script src="{{ STATIC_URL }}js/custom/getXMLHttpRequest.js"></script>
<script src="{{ STATIC_URL }}js/custom/liste_dynamique_quick.js"></script>
<script src="{% static 'js/custom/getXMLHttpRequest.js' %}"></script>
<script src="{% static 'js/custom/liste_dynamique_quick.js' %}"></script>
<script>
/* fonction appelée à la fin du timer (déclenché sur un onkeyup sur le champ de recherche) */
......
{% extends "note/base.html" %}
{% load i18n %}
{% load static %}
{% block title %}Comptes{% endblock %}
{% block additional_javascript %}
<script src="{{ STATIC_URL }}js/custom/getXMLHttpRequest.js"></script>
<script src="{{ STATIC_URL }}js/custom/liste_dynamique_search.js"></script>
<script src="{% static 'js/custom/getXMLHttpRequest.js' %}"></script>
<script src="{% static 'js/custom/liste_dynamique_search.js' %}"></script>
<script>var readhesion = true;</script>
{% endblock %}
{% block applets %}
......
{% extends "note/compte.html" %}
{% load i18n %}
{% load static %}
{% block title %}{% blocktrans with idbde=compte.idbde %}Historique des transactions du compte n°{{ idbde }}{% endblocktrans %}{% endblock %}
......@@ -8,6 +9,6 @@
{% endblock %}
{% block additional_javascript %}
<script src="{{ STATIC_URL }}js/custom/getXMLHttpRequest.js"></script>
<script src="{{ STATIC_URL }}js/custom/toggle_transactions.js"></script>
<script src="{% static 'js/custom/getXMLHttpRequest.js' %}"></script>
<script src="{% static 'js/custom/toggle_transactions.js' %}"></script>
{% endblock %}
This diff is collapsed.
"""
WSGI config for plop project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "note.settings")
application = get_wsgi_application()
......@@ -9,8 +9,8 @@
est en mode DEBUG.
"""
from django.conf.urls import patterns, include, url
from django.conf.urls import include, url
from django.conf.urls.static import static
from note import settings
if settings.DEBUG:
......@@ -26,18 +26,14 @@ handler500 = "note.views.server_error"
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
import note.urls
urlpatterns = [
url(r'^' + settings.NOTE_ROOT_URL.strip('/'), include('note.urls')),
url(r'', include('note.urls')),
url(r'^admin/', include(admin.site.urls)),
)
]
if settings.DEBUG:
# On n'utilise pas ça en prod
urlpatterns += staticfiles_urlpatterns()
urlpatterns += patterns('',
(r'^%s/(?P<path>.*)$' % (settings.MEDIA_URL.strip('/')),
'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT}),
)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
WSGI config for Django_Client project.
WSGI config for plop project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` setting.
Usually you will have the standard Django WSGI application here, but it also
might make sense to replace the whole Django WSGI application with a custom one
that later delegates to the Django one. For example, you could introduce WSGI
middleware here, or combine a Django application with an application of another
framework.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""
import os
# ligne qui était là au départ, je l'ai virée parce que ça avait pas l'air
# d'importer ce qu'il fallait
#os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
from django.core.wsgi import get_wsgi_application
# à la place, on va récupérer le path du dossier du fichier courant
here=os.path.dirname( os.path.realpath( __file__ ) )
import sys
sys.path.append(here)
# et a priori settings.py est dans le même dossier
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "note.settings")
# Bon, il semblerait qu'on a aussi besoin du répertoire parent
uphere="/".join(here.split("/")[:-1])
sys.path.append(uphere)
# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION
# setting points here.
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
# Apply WSGI middleware here.
#from helloworld.wsgi import HelloWorldApplication
#application = HelloWorldApplication(application)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment