diff --git a/cdc.md b/cdc.md index 9a4e8ca..0f283fe 100644 --- a/cdc.md +++ b/cdc.md @@ -11,8 +11,8 @@ todo long run - flake8 compliant (pep8 + other stuff) to do now +- log : for each page, log : ip, date, page ?? - https://docs.djangoproject.com/en/dev/ref/contrib/sitemaps/ -- htaccess ? (index follow) - previsualisation des posts - news / tuto / articles : export pdf (pandoc) - syndication (rss + atom) : https://docs.djangoproject.com/en/dev/ref/contrib/syndication/ diff --git a/iTeam/context_processors.py b/iTeam/context_processors.py new file mode 100644 index 0000000..d64d039 --- /dev/null +++ b/iTeam/context_processors.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# @Author: Adrien Chardon +# @Date: 2014-10-28 11:31:30 +# @Last Modified by: Adrien Chardon +# @Last Modified time: 2014-10-28 11:36:55 + +# This file is part of iTeam.org. +# Copyright (C) 2014 Adrien Chardon (Nodraak). +# +# iTeam.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# iTeam.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with iTeam.org. If not, see . + + +def git_version(request): + """ + Return the current deployed git version. + + If not running on a production machine (if the 'git_version.txt' file is + not found), this will just display that the running version is local. + """ + + try: + with open('git_version.txt') as f: + v = f.read().strip() + except IOError: + v = 'local_version' + + return {'git_version': v} diff --git a/iTeam/settings.py b/iTeam/settings.py index 9afb941..fca5b5e 100644 --- a/iTeam/settings.py +++ b/iTeam/settings.py @@ -3,7 +3,7 @@ # @Author: Adrien Chardon # @Date: 2014-09-02 12:01:06 # @Last Modified by: Adrien Chardon -# @Last Modified time: 2014-10-27 13:02:07 +# @Last Modified time: 2014-10-28 11:33:49 # This file is part of iTeam.org. # Copyright (C) 2014 Adrien Chardon (Nodraak). @@ -150,7 +150,6 @@ 'django.contrib.staticfiles', 'email_obfuscator', - # 'social.apps.django_app.default', ) MIDDLEWARE_CLASSES = ( @@ -177,24 +176,10 @@ 'django.core.context_processors.tz', 'django.contrib.messages.context_processors.messages', - # 'social.apps.django_app.context_processors.backends', - # 'social.apps.django_app.context_processors.login_redirect', + # Custom context processors + 'iTeam.context_processors.git_version', ) -""" -AUTHENTICATION_BACKENDS = ( - 'django.contrib.auth.backends.ModelBackend', - - 'social.backends.facebook.FacebookOAuth2', -) -""" - -""" -FILE_UPLOAD_HANDLERS = ( - "django.core.files.uploadhandler.MemoryFileUploadHandler", - "django.core.files.uploadhandler.TemporaryFileUploadHandler", -) -""" ############################################ # Database + Cache diff --git a/prod/deploy.sh b/prod/deploy.sh index a519a82..db2d35d 100755 --- a/prod/deploy.sh +++ b/prod/deploy.sh @@ -15,17 +15,17 @@ fi cd /opt/iteam-env/iteam-site/ # Maintenance mode -#sudo rm /etc/nginx/sites-enabled/iteam -#sudo ln -s /etc/nginx/sites-available/iteam-maintenance /etc/nginx/sites-enabled/iteam-maintenance -#sudo service nginx reload +sudo rm /etc/nginx/sites-enabled/iteam +sudo ln -s /etc/nginx/sites-available/iteam-maintenance /etc/nginx/sites-enabled/iteam-maintenance +sudo service nginx reload -# Delete old branch if exists +# Retrieve prod branch git branch prod origin/prod git checkout prod +# Delete old branch if exists git branch -D $1 -# Switch to new tag +# Switch to new tag (Server has git < 1.9, git fetch --tags doesn't retrieve commits...) git fetch --tags -# Server has git < 1.9, git fetch --tags doesn't retrieve commits... git fetch # Checkout the tag git checkout $1 @@ -39,17 +39,25 @@ python manage.py collectstatic --noinput # Update application data source ../bin/activate pip install --upgrade -r requirements.txt -python manage.py migrate +#python manage.py migrate deactivate # Restart iteam sudo supervisorctl restart iteam # Exit maintenance mode -#sudo rm /etc/nginx/sites-enabled/iteam-maintenance -#sudo ln -s /etc/nginx/sites-available/iteam /etc/nginx/sites-enabled/iteam -#sudo service nginx reload +sudo rm /etc/nginx/sites-enabled/iteam-maintenance +sudo ln -s /etc/nginx/sites-available/iteam /etc/nginx/sites-enabled/iteam +sudo service nginx reload # Display current branch and commit -git status -echo "Commit deployé : `git rev-parse HEAD`" +DEPLOYED_HASH=$(git show-ref --tags | grep v1.0-RC1.1 | cut -d " " -f 1) +DEPLOYED_TAG=$(git show-ref --tags | grep v1.0-RC1.1 | cut -d " " -f 2 | cut -d "/" -f 3) +HEAD_HASH=$(git rev-parse HEAD) + +echo "$DEPLOYED_TAG" > git_version.txt + +echo "Commit deployé :" +echo "tag\t$DEPLOYED_TAG" +echo "hash\t$DEPLOYED_HASH" +echo "head\t$HEAD_HASH" diff --git a/prod/nginx-maintenance.conf b/prod/nginx-maintenance.conf index bb94a60..1da304e 100644 --- a/prod/nginx-maintenance.conf +++ b/prod/nginx-maintenance.conf @@ -18,7 +18,7 @@ server { # media and static files location /static/ { - alias /opt/iteam-env/iteam_static/; + alias /opt/iteam-env/static/; expires 1d; add_header Pragma public; add_header Cache-Control "public, must-revalidate, proxy-revalidate"; diff --git a/prod/settings_prod.py b/prod/settings_prod.py index 4506b29..ccb23bb 100644 --- a/prod/settings_prod.py +++ b/prod/settings_prod.py @@ -37,3 +37,9 @@ ('images', os.path.join(SITE_ROOT, 'assets', 'images')), ) +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(SITE_ROOT, 'db.sqlite3'), + } +} diff --git a/templates/base.html b/templates/base.html index 4ba887d..102006b 100644 --- a/templates/base.html +++ b/templates/base.html @@ -132,17 +132,17 @@ diff --git a/templates/footer.html b/templates/footer.part.html similarity index 100% rename from templates/footer.html rename to templates/footer.part.html diff --git a/templates/pages/apropos.html b/templates/pages/apropos.html index 2eb10d5..91c730a 100644 --- a/templates/pages/apropos.html +++ b/templates/pages/apropos.html @@ -107,6 +107,12 @@
Javascript
+
+

Droits

+

+ ITeam.org est un site donc le code source est sous licence GNU GPL Affero version 3, et provient en partie de progdupeu.pl et zestedesavoir.com. +

+