@@ -1,6 +1,6 @@ | |||||
ecomonde | |||||
======== | |||||
EcoMonde V2 | |||||
=========== | |||||
Interface pour le Jeux de rôle Ecomonde | |||||
Interface pour le Jeux de rôle Ecomonde Version 2 avec Django. | |||||
Licence Créative Commons : BY-NC-SA : http://creativecommons.org/licenses/by-nc-sa/4.0/ | Licence Créative Commons : BY-NC-SA : http://creativecommons.org/licenses/by-nc-sa/4.0/ |
@@ -1,26 +0,0 @@ | |||||
<?php | |||||
include "header.php"; | |||||
$nom = "map.jpg"; | |||||
$uploaddir = './medias/'.$hash.'/'; | |||||
$uploadfile = $uploaddir . basename($nom); | |||||
$extensions_valides = array( 'jpg' , 'jpeg' ); | |||||
$extension_upload = strtolower( substr( strrchr($_FILES['userfile']['name'], '.') ,1) ); | |||||
if ( in_array($extension_upload,$extensions_valides) ) { | |||||
$resultat = move_uploaded_file($_FILES['userfile']['tmp_name'],$uploadfile); | |||||
if ($resultat) header("location:index.php?msg=5"); | |||||
else { | |||||
header("location:index.php?msg=6"); | |||||
} | |||||
} | |||||
else { | |||||
header("location:index.php?msg=6"); | |||||
} | |||||
?> |
@@ -1,26 +0,0 @@ | |||||
<?php | |||||
include "header.php"; | |||||
$nom = "dark.mp3"; | |||||
$uploaddir = './medias/'.$hash.'/'; | |||||
$uploadfile = $uploaddir . basename($nom); | |||||
$extensions_valides = array( 'mp3' ); | |||||
$extension_upload = strtolower( substr( strrchr($_FILES['userfile']['name'], '.') ,1) ); | |||||
if ( in_array($extension_upload,$extensions_valides) ) { | |||||
$resultat = move_uploaded_file($_FILES['userfile']['tmp_name'],$uploadfile); | |||||
if ($resultat) header("location:index.php?msg=9"); | |||||
else { | |||||
header("location:index.php?msg=10"); | |||||
} | |||||
} | |||||
else { | |||||
header("location:index.php?msg=10"); | |||||
} | |||||
?> |
@@ -1,26 +0,0 @@ | |||||
<?php | |||||
include "header.php"; | |||||
$nom = "hard.mp3"; | |||||
$uploaddir = './medias/'.$hash.'/'; | |||||
$uploadfile = $uploaddir . basename($nom); | |||||
$extensions_valides = array( 'mp3' ); | |||||
$extension_upload = strtolower( substr( strrchr($_FILES['userfile']['name'], '.') ,1) ); | |||||
if ( in_array($extension_upload,$extensions_valides) ) { | |||||
$resultat = move_uploaded_file($_FILES['userfile']['tmp_name'],$uploadfile); | |||||
if ($resultat) header("location:index.php?msg=9"); | |||||
else { | |||||
header("location:index.php?msg=10"); | |||||
} | |||||
} | |||||
else { | |||||
header("location:index.php?msg=10"); | |||||
} | |||||
?> |
@@ -1,26 +0,0 @@ | |||||
<?php | |||||
include "header.php"; | |||||
$nom = "light.mp3"; | |||||
$uploaddir = './medias/'.$hash.'/'; | |||||
$uploadfile = $uploaddir . basename($nom); | |||||
$extensions_valides = array( 'mp3' ); | |||||
$extension_upload = strtolower( substr( strrchr($_FILES['userfile']['name'], '.') ,1) ); | |||||
if ( in_array($extension_upload,$extensions_valides) ) { | |||||
$resultat = move_uploaded_file($_FILES['userfile']['tmp_name'],$uploadfile); | |||||
if ($resultat) header("location:index.php?msg=9"); | |||||
else { | |||||
header("location:index.php?msg=10"); | |||||
} | |||||
} | |||||
else { | |||||
header("location:index.php?msg=10"); | |||||
} | |||||
?> |
@@ -1,26 +0,0 @@ | |||||
<?php | |||||
include "header.php"; | |||||
$nom = "soft.mp3"; | |||||
$uploaddir = './medias/'.$hash.'/'; | |||||
$uploadfile = $uploaddir . basename($nom); | |||||
$extensions_valides = array( 'mp3' ); | |||||
$extension_upload = strtolower( substr( strrchr($_FILES['userfile']['name'], '.') ,1) ); | |||||
if ( in_array($extension_upload,$extensions_valides) ) { | |||||
$resultat = move_uploaded_file($_FILES['userfile']['tmp_name'],$uploadfile); | |||||
if ($resultat) header("location:index.php?msg=9"); | |||||
else { | |||||
header("location:index.php?msg=10"); | |||||
} | |||||
} | |||||
else { | |||||
header("location:index.php?msg=10"); | |||||
} | |||||
?> |
@@ -1,26 +0,0 @@ | |||||
<?php | |||||
include "header.php"; | |||||
$nom = "tonic.mp3"; | |||||
$uploaddir = './medias/'.$hash.'/'; | |||||
$uploadfile = $uploaddir . basename($nom); | |||||
$extensions_valides = array( 'mp3' ); | |||||
$extension_upload = strtolower( substr( strrchr($_FILES['userfile']['name'], '.') ,1) ); | |||||
if ( in_array($extension_upload,$extensions_valides) ) { | |||||
$resultat = move_uploaded_file($_FILES['userfile']['tmp_name'],$uploadfile); | |||||
if ($resultat) header("location:index.php?msg=9"); | |||||
else { | |||||
header("location:index.php?msg=10"); | |||||
} | |||||
} | |||||
else { | |||||
header("location:index.php?msg=10"); | |||||
} | |||||
?> |
@@ -1,11 +0,0 @@ | |||||
<?php | |||||
include "header.php"; | |||||
connecte("ecomonde"); | |||||
$id=$_POST['id']; | |||||
$pseudo=$_POST['pseudo']; | |||||
$pass=sha1($_POST['password']); | |||||
$sql="UPDATE membres SET pseudo='$pseudo',pass='$pass' WHERE id=$id"; | |||||
mysql_query($sql) or die(include('index.php?msg=0')); | |||||
if($sql) header("location:index.php?msg=1"); | |||||
?> |
@@ -1 +0,0 @@ | |||||
body{padding-top:50px}#banner{border-bottom:none}.page-header h1{font-size:4em}.bs-docs-section{margin-top:8em}.bs-component{position:relative}.bs-component .modal{position:relative;top:auto;right:auto;left:auto;bottom:auto;z-index:1;display:block}.bs-component .modal-dialog{width:90%}.bs-component .popover{position:relative;display:inline-block;width:220px;margin:20px}#source-button{position:absolute;top:0;right:0;z-index:100;font-weight:bold}.progress{margin-bottom:10px}footer{margin:5em 0}footer li{float:left;margin-right:1.5em;margin-bottom:1.5em}footer p{clear:left;margin-bottom:0}.splash{padding:4em 0 2em;background:#141d27;background:-moz-linear-gradient(70deg, #141d27 0, #233344 72%, #2c4055 89%, #39526e 100%);background:-webkit-gradient(linear, left bottom, right top, color-stop(0, #141d27), color-stop(72%, #233344), color-stop(89%, #2c4055), color-stop(100%, #39526e));background:-webkit-linear-gradient(70deg, #141d27 0, #233344 72%, #2c4055 89%, #39526e 100%);background:-o-linear-gradient(70deg, #141d27 0, #233344 72%, #2c4055 89%, #39526e 100%);background:-ms-linear-gradient(70deg, #141d27 0, #233344 72%, #2c4055 89%, #39526e 100%);background:linear-gradient(70deg, #141d27 0, #233344 72%, #2c4055 89%, #39526e 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#141d27', endColorstr='#39526e', GradientType=1);color:#fff;text-align:center}.splash h1{font-size:4em}.splash #social{margin:2em 0}.splash .alert{margin:2em 0}.splash .bsa{max-width:350px;margin:0 auto;background:none}.splash .bsa .one .bsa_it_ad{border:1px solid #3e4653 !important;border-color:rgba(255,255,255,0.2) !important}.splash .bsa a{color:#fff}.section-tout{padding:4em 0 3em;border-top:1px solid rgba(255,255,255,0.1);border-bottom:1px solid rgba(0,0,0,0.1);background-color:#eaf1f1}.section-tout .fa{margin-right:.5em}.section-tout p{margin-bottom:3em}.section-preview{padding:4em 0 4em}.section-preview .preview{margin-bottom:4em;background-color:#eaf1f1;border:1px solid rgba(0,0,0,0.1)}.section-preview .preview .options{padding:1em 2em 2em;border-top:1px solid rgba(0,0,0,0.1);text-align:center}.section-preview .preview .options p{margin-bottom:2em}.section-preview .dropdown-menu{text-align:left}.section-preview .lead{margin-bottom:2em}@media (max-width:767px){.section-preview .image img{width:100%}}.sponsor img{border:1px solid rgba(0,0,0,0.1);border-radius:4px}.sponsor a:hover{text-decoration:none}.bsa{padding:0}.bsa .one .bsa_it_ad{border:none !important;background-color:transparent !important}.bsa .one .bsa_it_ad .bsa_it_t,.bsa .one .bsa_it_ad .bsa_it_d{color:inherit !important}.bsa .one .bsa_it_ad .bsa_it_i{margin-bottom:0 !important}.bsa .one .bsa_it_p{display:none} |
@@ -1,5 +0,0 @@ | |||||
<?php | |||||
include "header.php"; | |||||
unlink("medias/".$hash."/".$_GET['player']); | |||||
header("location:index.php"); | |||||
?> |
@@ -1,17 +0,0 @@ | |||||
<?php | |||||
include "header.php"; | |||||
connecte("ecomonde"); | |||||
$hash=md5($email); | |||||
$path="./medias/".$hash; | |||||
if ($email) { | |||||
exec("rm -rf {$path}"); | |||||
$sql="DELETE FROM membres WHERE id=$id"; | |||||
mysql_query($sql) or die(include('index.php?msg=0')); | |||||
$_SESSION['status']=0; | |||||
header("location:index.php?msg=4"); | |||||
} | |||||
else { | |||||
header("location:index.php?msg=0"); | |||||
} | |||||
?> |
@@ -0,0 +1,76 @@ | |||||
# This file must be used with "source bin/activate" *from bash* | |||||
# you cannot run it directly | |||||
deactivate () { | |||||
# reset old environment variables | |||||
if [ -n "$_OLD_VIRTUAL_PATH" ] ; then | |||||
PATH="$_OLD_VIRTUAL_PATH" | |||||
export PATH | |||||
unset _OLD_VIRTUAL_PATH | |||||
fi | |||||
if [ -n "$_OLD_VIRTUAL_PYTHONHOME" ] ; then | |||||
PYTHONHOME="$_OLD_VIRTUAL_PYTHONHOME" | |||||
export PYTHONHOME | |||||
unset _OLD_VIRTUAL_PYTHONHOME | |||||
fi | |||||
# This should detect bash and zsh, which have a hash command that must | |||||
# be called to get it to forget past commands. Without forgetting | |||||
# past commands the $PATH changes we made may not be respected | |||||
if [ -n "$BASH" -o -n "$ZSH_VERSION" ] ; then | |||||
hash -r | |||||
fi | |||||
if [ -n "$_OLD_VIRTUAL_PS1" ] ; then | |||||
PS1="$_OLD_VIRTUAL_PS1" | |||||
export PS1 | |||||
unset _OLD_VIRTUAL_PS1 | |||||
fi | |||||
unset VIRTUAL_ENV | |||||
if [ ! "$1" = "nondestructive" ] ; then | |||||
# Self destruct! | |||||
unset -f deactivate | |||||
fi | |||||
} | |||||
# unset irrelavent variables | |||||
deactivate nondestructive | |||||
VIRTUAL_ENV="/var/www/html/ecomonde/ecomonde-venv" | |||||
export VIRTUAL_ENV | |||||
_OLD_VIRTUAL_PATH="$PATH" | |||||
PATH="$VIRTUAL_ENV/bin:$PATH" | |||||
export PATH | |||||
# unset PYTHONHOME if set | |||||
# this will fail if PYTHONHOME is set to the empty string (which is bad anyway) | |||||
# could use `if (set -u; : $PYTHONHOME) ;` in bash | |||||
if [ -n "$PYTHONHOME" ] ; then | |||||
_OLD_VIRTUAL_PYTHONHOME="$PYTHONHOME" | |||||
unset PYTHONHOME | |||||
fi | |||||
if [ -z "$VIRTUAL_ENV_DISABLE_PROMPT" ] ; then | |||||
_OLD_VIRTUAL_PS1="$PS1" | |||||
if [ "x(ecomonde-venv) " != x ] ; then | |||||
PS1="(ecomonde-venv) $PS1" | |||||
else | |||||
if [ "`basename \"$VIRTUAL_ENV\"`" = "__" ] ; then | |||||
# special case for Aspen magic directories | |||||
# see http://www.zetadev.com/software/aspen/ | |||||
PS1="[`basename \`dirname \"$VIRTUAL_ENV\"\``] $PS1" | |||||
else | |||||
PS1="(`basename \"$VIRTUAL_ENV\"`)$PS1" | |||||
fi | |||||
fi | |||||
export PS1 | |||||
fi | |||||
# This should detect bash and zsh, which have a hash command that must | |||||
# be called to get it to forget past commands. Without forgetting | |||||
# past commands the $PATH changes we made may not be respected | |||||
if [ -n "$BASH" -o -n "$ZSH_VERSION" ] ; then | |||||
hash -r | |||||
fi |
@@ -0,0 +1,37 @@ | |||||
# This file must be used with "source bin/activate.csh" *from csh*. | |||||
# You cannot run it directly. | |||||
# Created by Davide Di Blasi <davidedb@gmail.com>. | |||||
# Ported to Python 3.3 venv by Andrew Svetlov <andrew.svetlov@gmail.com> | |||||
alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; test "\!:*" != "nondestructive" && unalias deactivate' | |||||
# Unset irrelavent variables. | |||||
deactivate nondestructive | |||||
setenv VIRTUAL_ENV "/var/www/html/ecomonde/ecomonde-venv" | |||||
set _OLD_VIRTUAL_PATH="$PATH" | |||||
setenv PATH "$VIRTUAL_ENV/bin:$PATH" | |||||
set _OLD_VIRTUAL_PROMPT="$prompt" | |||||
if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then | |||||
if ("ecomonde-venv" != "") then | |||||
set env_name = "ecomonde-venv" | |||||
else | |||||
if (`basename "VIRTUAL_ENV"` == "__") then | |||||
# special case for Aspen magic directories | |||||
# see http://www.zetadev.com/software/aspen/ | |||||
set env_name = `basename \`dirname "$VIRTUAL_ENV"\`` | |||||
else | |||||
set env_name = `basename "$VIRTUAL_ENV"` | |||||
endif | |||||
endif | |||||
set prompt = "[$env_name] $prompt" | |||||
unset env_name | |||||
endif | |||||
alias pydoc python -m pydoc | |||||
rehash |
@@ -0,0 +1,74 @@ | |||||
# This file must be used with ". bin/activate.fish" *from fish* (http://fishshell.org) | |||||
# you cannot run it directly | |||||
function deactivate -d "Exit virtualenv and return to normal shell environment" | |||||
# reset old environment variables | |||||
if test -n "$_OLD_VIRTUAL_PATH" | |||||
set -gx PATH $_OLD_VIRTUAL_PATH | |||||
set -e _OLD_VIRTUAL_PATH | |||||
end | |||||
if test -n "$_OLD_VIRTUAL_PYTHONHOME" | |||||
set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME | |||||
set -e _OLD_VIRTUAL_PYTHONHOME | |||||
end | |||||
if test -n "$_OLD_FISH_PROMPT_OVERRIDE" | |||||
functions -e fish_prompt | |||||
set -e _OLD_FISH_PROMPT_OVERRIDE | |||||
. ( begin | |||||
printf "function fish_prompt\n\t#" | |||||
functions _old_fish_prompt | |||||
end | psub ) | |||||
functions -e _old_fish_prompt | |||||
end | |||||
set -e VIRTUAL_ENV | |||||
if test "$argv[1]" != "nondestructive" | |||||
# Self destruct! | |||||
functions -e deactivate | |||||
end | |||||
end | |||||
# unset irrelavent variables | |||||
deactivate nondestructive | |||||
set -gx VIRTUAL_ENV "/var/www/html/ecomonde/ecomonde-venv" | |||||
set -gx _OLD_VIRTUAL_PATH $PATH | |||||
set -gx PATH "$VIRTUAL_ENV/bin" $PATH | |||||
# unset PYTHONHOME if set | |||||
if set -q PYTHONHOME | |||||
set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME | |||||
set -e PYTHONHOME | |||||
end | |||||
if test -z "$VIRTUAL_ENV_DISABLE_PROMPT" | |||||
# fish uses a function instead of an env var to generate the prompt. | |||||
# save the current fish_prompt function as the function _old_fish_prompt | |||||
. ( begin | |||||
printf "function _old_fish_prompt\n\t#" | |||||
functions fish_prompt | |||||
end | psub ) | |||||
# with the original prompt function renamed, we can override with our own. | |||||
function fish_prompt | |||||
# Prompt override? | |||||
if test -n "(ecomonde-venv) " | |||||
printf "%s%s%s" "(ecomonde-venv) " (set_color normal) (_old_fish_prompt) | |||||
return | |||||
end | |||||
# ...Otherwise, prepend env | |||||
set -l _checkbase (basename "$VIRTUAL_ENV") | |||||
if test $_checkbase = "__" | |||||
# special case for Aspen magic directories | |||||
# see http://www.zetadev.com/software/aspen/ | |||||
printf "%s[%s]%s %s" (set_color -b blue white) (basename (dirname "$VIRTUAL_ENV")) (set_color normal) (_old_fish_prompt) | |||||
else | |||||
printf "%s(%s)%s%s" (set_color -b blue white) (basename "$VIRTUAL_ENV") (set_color normal) (_old_fish_prompt) | |||||
end | |||||
end | |||||
set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV" | |||||
end |
@@ -0,0 +1,11 @@ | |||||
#!/var/www/html/ecomonde/ecomonde-venv/bin/python3 | |||||
# -*- coding: utf-8 -*- | |||||
import re | |||||
import sys | |||||
from django.core.management import execute_from_command_line | |||||
if __name__ == '__main__': | |||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) | |||||
sys.exit(execute_from_command_line()) |
@@ -0,0 +1,5 @@ | |||||
#!/var/www/html/ecomonde/ecomonde-venv/bin/python3 | |||||
from django.core import management | |||||
if __name__ == "__main__": | |||||
management.execute_from_command_line() |
@@ -0,0 +1,11 @@ | |||||
#!/var/www/html/ecomonde/ecomonde-venv/bin/python3 | |||||
# -*- coding: utf-8 -*- | |||||
import re | |||||
import sys | |||||
from setuptools.command.easy_install import main | |||||
if __name__ == '__main__': | |||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) | |||||
sys.exit(main()) |
@@ -0,0 +1,11 @@ | |||||
#!/var/www/html/ecomonde/ecomonde-venv/bin/python3 | |||||
# -*- coding: utf-8 -*- | |||||
import re | |||||
import sys | |||||
from setuptools.command.easy_install import main | |||||
if __name__ == '__main__': | |||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) | |||||
sys.exit(main()) |
@@ -0,0 +1,11 @@ | |||||
#!/var/www/html/ecomonde/ecomonde-venv/bin/python3 | |||||
# -*- coding: utf-8 -*- | |||||
import re | |||||
import sys | |||||
from pip import main | |||||
if __name__ == '__main__': | |||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) | |||||
sys.exit(main()) |
@@ -0,0 +1,11 @@ | |||||
#!/var/www/html/ecomonde/ecomonde-venv/bin/python3 | |||||
# -*- coding: utf-8 -*- | |||||
import re | |||||
import sys | |||||
from pip import main | |||||
if __name__ == '__main__': | |||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) | |||||
sys.exit(main()) |
@@ -0,0 +1,11 @@ | |||||
#!/var/www/html/ecomonde/ecomonde-venv/bin/python3 | |||||
# -*- coding: utf-8 -*- | |||||
import re | |||||
import sys | |||||
from pip import main | |||||
if __name__ == '__main__': | |||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) | |||||
sys.exit(main()) |
@@ -0,0 +1 @@ | |||||
python3 |
@@ -0,0 +1 @@ | |||||
/usr/bin/python3 |
@@ -0,0 +1,3 @@ | |||||
UNKNOWN | |||||
@@ -0,0 +1,27 @@ | |||||
Copyright (c) Django Software Foundation and individual contributors. | |||||
All rights reserved. | |||||
Redistribution and use in source and binary forms, with or without modification, | |||||
are permitted provided that the following conditions are met: | |||||
1. Redistributions of source code must retain the above copyright notice, | |||||
this list of conditions and the following disclaimer. | |||||
2. Redistributions in binary form must reproduce the above copyright | |||||
notice, this list of conditions and the following disclaimer in the | |||||
documentation and/or other materials provided with the distribution. | |||||
3. Neither the name of Django nor the names of its contributors may be used | |||||
to endorse or promote products derived from this software without | |||||
specific prior written permission. | |||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | |||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | |||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
@@ -0,0 +1,32 @@ | |||||
Metadata-Version: 2.0 | |||||
Name: Django | |||||
Version: 1.9.8 | |||||
Summary: A high-level Python Web framework that encourages rapid development and clean, pragmatic design. | |||||
Home-page: http://www.djangoproject.com/ | |||||
Author: Django Software Foundation | |||||
Author-email: foundation@djangoproject.com | |||||
License: BSD | |||||
Platform: UNKNOWN | |||||
Classifier: Development Status :: 5 - Production/Stable | |||||
Classifier: Environment :: Web Environment | |||||
Classifier: Framework :: Django | |||||
Classifier: Intended Audience :: Developers | |||||
Classifier: License :: OSI Approved :: BSD License | |||||
Classifier: Operating System :: OS Independent | |||||
Classifier: Programming Language :: Python | |||||
Classifier: Programming Language :: Python :: 2 | |||||
Classifier: Programming Language :: Python :: 2.7 | |||||
Classifier: Programming Language :: Python :: 3 | |||||
Classifier: Programming Language :: Python :: 3.4 | |||||
Classifier: Programming Language :: Python :: 3.5 | |||||
Classifier: Topic :: Internet :: WWW/HTTP | |||||
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content | |||||
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI | |||||
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks | |||||
Classifier: Topic :: Software Development :: Libraries :: Python Modules | |||||
Provides-Extra: bcrypt | |||||
Requires-Dist: bcrypt; extra == 'bcrypt' | |||||
UNKNOWN | |||||
@@ -0,0 +1,6 @@ | |||||
Wheel-Version: 1.0 | |||||
Generator: bdist_wheel (0.29.0) | |||||
Root-Is-Purelib: true | |||||
Tag: py2-none-any | |||||
Tag: py3-none-any | |||||
@@ -0,0 +1,3 @@ | |||||
[console_scripts] | |||||
django-admin = django.core.management:execute_from_command_line | |||||
@@ -0,0 +1 @@ | |||||
{"classifiers": ["Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Internet :: WWW/HTTP :: WSGI", "Topic :: Software Development :: Libraries :: Application Frameworks", "Topic :: Software Development :: Libraries :: Python Modules"], "extensions": {"python.commands": {"wrap_console": {"django-admin": "django.core.management:execute_from_command_line"}}, "python.details": {"contacts": [{"email": "foundation@djangoproject.com", "name": "Django Software Foundation", "role": "author"}], "document_names": {"description": "DESCRIPTION.rst", "license": "LICENSE.txt"}, "project_urls": {"Home": "http://www.djangoproject.com/"}}, "python.exports": {"console_scripts": {"django-admin": "django.core.management:execute_from_command_line"}}}, "extras": ["bcrypt"], "generator": "bdist_wheel (0.29.0)", "license": "BSD", "metadata_version": "2.0", "name": "Django", "run_requires": [{"extra": "bcrypt", "requires": ["bcrypt"]}], "summary": "A high-level Python Web framework that encourages rapid development and clean, pragmatic design.", "version": "1.9.8"} |
@@ -0,0 +1 @@ | |||||
django |
@@ -0,0 +1,16 @@ | |||||
try: | |||||
import ast | |||||
from _markerlib.markers import default_environment, compile, interpret | |||||
except ImportError: | |||||
if 'ast' in globals(): | |||||
raise | |||||
def default_environment(): | |||||
return {} | |||||
def compile(marker): | |||||
def marker_fn(environment=None, override=None): | |||||
# 'empty markers are True' heuristic won't install extra deps. | |||||
return not marker.strip() | |||||
marker_fn.__doc__ = marker | |||||
return marker_fn | |||||
def interpret(marker, environment=None, override=None): | |||||
return compile(marker)() |
@@ -0,0 +1,119 @@ | |||||
# -*- coding: utf-8 -*- | |||||
"""Interpret PEP 345 environment markers. | |||||
EXPR [in|==|!=|not in] EXPR [or|and] ... | |||||
where EXPR belongs to any of those: | |||||
python_version = '%s.%s' % (sys.version_info[0], sys.version_info[1]) | |||||
python_full_version = sys.version.split()[0] | |||||
os.name = os.name | |||||
sys.platform = sys.platform | |||||
platform.version = platform.version() | |||||
platform.machine = platform.machine() | |||||
platform.python_implementation = platform.python_implementation() | |||||
a free string, like '2.6', or 'win32' | |||||
""" | |||||
__all__ = ['default_environment', 'compile', 'interpret'] | |||||
import ast | |||||
import os | |||||
import platform | |||||
import sys | |||||
import weakref | |||||
_builtin_compile = compile | |||||
try: | |||||
from platform import python_implementation | |||||
except ImportError: | |||||
if os.name == "java": | |||||
# Jython 2.5 has ast module, but not platform.python_implementation() function. | |||||
def python_implementation(): | |||||
return "Jython" | |||||
else: | |||||
raise | |||||
# restricted set of variables | |||||
_VARS = {'sys.platform': sys.platform, | |||||
'python_version': '%s.%s' % sys.version_info[:2], | |||||
# FIXME parsing sys.platform is not reliable, but there is no other | |||||
# way to get e.g. 2.7.2+, and the PEP is defined with sys.version | |||||
'python_full_version': sys.version.split(' ', 1)[0], | |||||
'os.name': os.name, | |||||
'platform.version': platform.version(), | |||||
'platform.machine': platform.machine(), | |||||
'platform.python_implementation': python_implementation(), | |||||
'extra': None # wheel extension | |||||
} | |||||
for var in list(_VARS.keys()): | |||||
if '.' in var: | |||||
_VARS[var.replace('.', '_')] = _VARS[var] | |||||
def default_environment(): | |||||
"""Return copy of default PEP 385 globals dictionary.""" | |||||
return dict(_VARS) | |||||
class ASTWhitelist(ast.NodeTransformer): | |||||
def __init__(self, statement): | |||||
self.statement = statement # for error messages | |||||
ALLOWED = (ast.Compare, ast.BoolOp, ast.Attribute, ast.Name, ast.Load, ast.Str) | |||||
# Bool operations | |||||
ALLOWED += (ast.And, ast.Or) | |||||
# Comparison operations | |||||
ALLOWED += (ast.Eq, ast.Gt, ast.GtE, ast.In, ast.Is, ast.IsNot, ast.Lt, ast.LtE, ast.NotEq, ast.NotIn) | |||||
def visit(self, node): | |||||
"""Ensure statement only contains allowed nodes.""" | |||||
if not isinstance(node, self.ALLOWED): | |||||
raise SyntaxError('Not allowed in environment markers.\n%s\n%s' % | |||||
(self.statement, | |||||
(' ' * node.col_offset) + '^')) | |||||
return ast.NodeTransformer.visit(self, node) | |||||
def visit_Attribute(self, node): | |||||
"""Flatten one level of attribute access.""" | |||||
new_node = ast.Name("%s.%s" % (node.value.id, node.attr), node.ctx) | |||||
return ast.copy_location(new_node, node) | |||||
def parse_marker(marker): | |||||
tree = ast.parse(marker, mode='eval') | |||||
new_tree = ASTWhitelist(marker).generic_visit(tree) | |||||
return new_tree | |||||
def compile_marker(parsed_marker): | |||||
return _builtin_compile(parsed_marker, '<environment marker>', 'eval', | |||||
dont_inherit=True) | |||||
_cache = weakref.WeakValueDictionary() | |||||
def compile(marker): | |||||
"""Return compiled marker as a function accepting an environment dict.""" | |||||
try: | |||||
return _cache[marker] | |||||
except KeyError: | |||||
pass | |||||
if not marker.strip(): | |||||
def marker_fn(environment=None, override=None): | |||||
"""""" | |||||
return True | |||||
else: | |||||
compiled_marker = compile_marker(parse_marker(marker)) | |||||
def marker_fn(environment=None, override=None): | |||||
"""override updates environment""" | |||||
if override is None: | |||||
override = {} | |||||
if environment is None: | |||||
environment = default_environment() | |||||
environment.update(override) | |||||
return eval(compiled_marker, environment) | |||||
marker_fn.__doc__ = marker | |||||
_cache[marker] = marker_fn | |||||
return _cache[marker] | |||||
def interpret(marker, environment=None): | |||||
return compile(marker)(environment) |
@@ -0,0 +1,18 @@ | |||||
from django.utils.version import get_version | |||||
VERSION = (1, 9, 8, 'final', 0) | |||||
__version__ = get_version(VERSION) | |||||
def setup(): | |||||
""" | |||||
Configure the settings (this happens as a side effect of accessing the | |||||
first setting), configure logging and populate the app registry. | |||||
""" | |||||
from django.apps import apps | |||||
from django.conf import settings | |||||
from django.utils.log import configure_logging | |||||
configure_logging(settings.LOGGING_CONFIG, settings.LOGGING) | |||||
apps.populate(settings.INSTALLED_APPS) |
@@ -0,0 +1,9 @@ | |||||
""" | |||||
Invokes django-admin when the django module is run as a script. | |||||
Example: python -m django check | |||||
""" | |||||
from django.core import management | |||||
if __name__ == "__main__": | |||||
management.execute_from_command_line() |
@@ -0,0 +1,4 @@ | |||||
from .config import AppConfig | |||||
from .registry import apps | |||||
__all__ = ['AppConfig', 'apps'] |
@@ -0,0 +1,207 @@ | |||||
import os | |||||
from importlib import import_module | |||||
from django.core.exceptions import AppRegistryNotReady, ImproperlyConfigured | |||||
from django.utils._os import upath | |||||
from django.utils.module_loading import module_has_submodule | |||||
MODELS_MODULE_NAME = 'models' | |||||
class AppConfig(object): | |||||
""" | |||||
Class representing a Django application and its configuration. | |||||
""" | |||||
def __init__(self, app_name, app_module): | |||||
# Full Python path to the application eg. 'django.contrib.admin'. | |||||
self.name = app_name | |||||
# Root module for the application eg. <module 'django.contrib.admin' | |||||
# from 'django/contrib/admin/__init__.pyc'>. | |||||
self.module = app_module | |||||
# The following attributes could be defined at the class level in a | |||||
# subclass, hence the test-and-set pattern. | |||||
# Last component of the Python path to the application eg. 'admin'. | |||||
# This value must be unique across a Django project. | |||||
if not hasattr(self, 'label'): | |||||
self.label = app_name.rpartition(".")[2] | |||||
# Human-readable name for the application eg. "Admin". | |||||
if not hasattr(self, 'verbose_name'): | |||||
self.verbose_name = self.label.title() | |||||
# Filesystem path to the application directory eg. | |||||
# u'/usr/lib/python2.7/dist-packages/django/contrib/admin'. Unicode on | |||||
# Python 2 and a str on Python 3. | |||||
if not hasattr(self, 'path'): | |||||
self.path = self._path_from_module(app_module) | |||||
# Module containing models eg. <module 'django.contrib.admin.models' | |||||
# from 'django/contrib/admin/models.pyc'>. Set by import_models(). | |||||
# None if the application doesn't have a models module. | |||||
self.models_module = None | |||||
# Mapping of lower case model names to model classes. Initially set to | |||||
# None to prevent accidental access before import_models() runs. | |||||
self.models = None | |||||
def __repr__(self): | |||||
return '<%s: %s>' % (self.__class__.__name__, self.label) | |||||
def _path_from_module(self, module): | |||||
"""Attempt to determine app's filesystem path from its module.""" | |||||
# See #21874 for extended discussion of the behavior of this method in | |||||
# various cases. | |||||
# Convert paths to list because Python 3's _NamespacePath does not | |||||
# support indexing. | |||||
paths = list(getattr(module, '__path__', [])) | |||||
if len(paths) != 1: | |||||
filename = getattr(module, '__file__', None) | |||||
if filename is not None: | |||||
paths = [os.path.dirname(filename)] | |||||
else: | |||||
# For unknown reasons, sometimes the list returned by __path__ | |||||
# contains duplicates that must be removed (#25246). | |||||
paths = list(set(paths)) | |||||
if len(paths) > 1: | |||||
raise ImproperlyConfigured( | |||||
"The app module %r has multiple filesystem locations (%r); " | |||||
"you must configure this app with an AppConfig subclass " | |||||
"with a 'path' class attribute." % (module, paths)) | |||||
elif not paths: | |||||
raise ImproperlyConfigured( | |||||
"The app module %r has no filesystem location, " | |||||
"you must configure this app with an AppConfig subclass " | |||||
"with a 'path' class attribute." % (module,)) | |||||
return upath(paths[0]) | |||||
@classmethod | |||||
def create(cls, entry): | |||||
""" | |||||
Factory that creates an app config from an entry in INSTALLED_APPS. | |||||
""" | |||||
try: | |||||
# If import_module succeeds, entry is a path to an app module, | |||||
# which may specify an app config class with default_app_config. | |||||
# Otherwise, entry is a path to an app config class or an error. | |||||
module = import_module(entry) | |||||
except ImportError: | |||||
# Track that importing as an app module failed. If importing as an | |||||
# app config class fails too, we'll trigger the ImportError again. | |||||
module = None | |||||
mod_path, _, cls_name = entry.rpartition('.') | |||||
# Raise the original exception when entry cannot be a path to an | |||||
# app config class. | |||||
if not mod_path: | |||||
raise | |||||
else: | |||||
try: | |||||
# If this works, the app module specifies an app config class. | |||||
entry = module.default_app_config | |||||
except AttributeError: | |||||
# Otherwise, it simply uses the default app config class. | |||||
return cls(entry, module) | |||||
else: | |||||
mod_path, _, cls_name = entry.rpartition('.') | |||||
# If we're reaching this point, we must attempt to load the app config | |||||
# class located at <mod_path>.<cls_name> | |||||
mod = import_module(mod_path) | |||||
try: | |||||
cls = getattr(mod, cls_name) | |||||
except AttributeError: | |||||
if module is None: | |||||
# If importing as an app module failed, that error probably | |||||
# contains the most informative traceback. Trigger it again. | |||||
import_module(entry) | |||||
else: | |||||
raise | |||||
# Check for obvious errors. (This check prevents duck typing, but | |||||
# it could be removed if it became a problem in practice.) | |||||
if not issubclass(cls, AppConfig): | |||||
raise ImproperlyConfigured( | |||||
"'%s' isn't a subclass of AppConfig." % entry) | |||||
# Obtain app name here rather than in AppClass.__init__ to keep | |||||
# all error checking for entries in INSTALLED_APPS in one place. | |||||
try: | |||||
app_name = cls.name | |||||
except AttributeError: | |||||
raise ImproperlyConfigured( | |||||
"'%s' must supply a name attribute." % entry) | |||||
# Ensure app_name points to a valid module. | |||||
app_module = import_module(app_name) | |||||
# Entry is a path to an app config class. | |||||
return cls(app_name, app_module) | |||||
def check_models_ready(self): | |||||
""" | |||||
Raises an exception if models haven't been imported yet. | |||||
""" | |||||
if self.models is None: | |||||
raise AppRegistryNotReady( | |||||
"Models for app '%s' haven't been imported yet." % self.label) | |||||
def get_model(self, model_name): | |||||
""" | |||||
Returns the model with the given case-insensitive model_name. | |||||
Raises LookupError if no model exists with this name. | |||||
""" | |||||
self.check_models_ready() | |||||
try: | |||||
return self.models[model_name.lower()] | |||||
except KeyError: | |||||
raise LookupError( | |||||
"App '%s' doesn't have a '%s' model." % (self.label, model_name)) | |||||
def get_models(self, include_auto_created=False, | |||||
include_deferred=False, include_swapped=False): | |||||
""" | |||||
Returns an iterable of models. | |||||
By default, the following models aren't included: | |||||
- auto-created models for many-to-many relations without | |||||
an explicit intermediate table, | |||||
- models created to satisfy deferred attribute queries, | |||||
- models that have been swapped out. | |||||
Set the corresponding keyword argument to True to include such models. | |||||
Keyword arguments aren't documented; they're a private API. | |||||
""" | |||||
self.check_models_ready() | |||||
for model in self.models.values(): | |||||
if model._deferred and not include_deferred: | |||||
continue | |||||
if model._meta.auto_created and not include_auto_created: | |||||
continue | |||||
if model._meta.swapped and not include_swapped: | |||||
continue | |||||
yield model | |||||
def import_models(self, all_models): | |||||
# Dictionary of models for this app, primarily maintained in the | |||||
# 'all_models' attribute of the Apps this AppConfig is attached to. | |||||
# Injected as a parameter because it gets populated when models are | |||||
# imported, which might happen before populate() imports models. | |||||
self.models = all_models | |||||
if module_has_submodule(self.module, MODELS_MODULE_NAME): | |||||
models_module_name = '%s.%s' % (self.name, MODELS_MODULE_NAME) | |||||
self.models_module = import_module(models_module_name) | |||||
def ready(self): | |||||
""" | |||||
Override this method in subclasses to run code when Django starts. | |||||
""" |
@@ -0,0 +1,408 @@ | |||||
import sys | |||||
import threading | |||||
import warnings | |||||
from collections import Counter, OrderedDict, defaultdict | |||||
from functools import partial | |||||
from django.core.exceptions import AppRegistryNotReady, ImproperlyConfigured | |||||
from django.utils import lru_cache | |||||
from .config import AppConfig | |||||
class Apps(object): | |||||
""" | |||||
A registry that stores the configuration of installed applications. | |||||
It also keeps track of models eg. to provide reverse-relations. | |||||
""" | |||||
def __init__(self, installed_apps=()): | |||||
# installed_apps is set to None when creating the master registry | |||||
# because it cannot be populated at that point. Other registries must | |||||
# provide a list of installed apps and are populated immediately. | |||||
if installed_apps is None and hasattr(sys.modules[__name__], 'apps'): | |||||
raise RuntimeError("You must supply an installed_apps argument.") | |||||
# Mapping of app labels => model names => model classes. Every time a | |||||
# model is imported, ModelBase.__new__ calls apps.register_model which | |||||
# creates an entry in all_models. All imported models are registered, | |||||
# regardless of whether they're defined in an installed application | |||||
# and whether the registry has been populated. Since it isn't possible | |||||
# to reimport a module safely (it could reexecute initialization code) | |||||
# all_models is never overridden or reset. | |||||
self.all_models = defaultdict(OrderedDict) | |||||
# Mapping of labels to AppConfig instances for installed apps. | |||||
self.app_configs = OrderedDict() | |||||
# Stack of app_configs. Used to store the current state in | |||||
# set_available_apps and set_installed_apps. | |||||
self.stored_app_configs = [] | |||||
# Whether the registry is populated. | |||||
self.apps_ready = self.models_ready = self.ready = False | |||||
# Lock for thread-safe population. | |||||
self._lock = threading.Lock() | |||||
# Maps ("app_label", "modelname") tuples to lists of functions to be | |||||
# called when the corresponding model is ready. Used by this class's | |||||
# `lazy_model_operation()` and `do_pending_operations()` methods. | |||||
self._pending_operations = defaultdict(list) | |||||
# Populate apps and models, unless it's the master registry. | |||||
if installed_apps is not None: | |||||
self.populate(installed_apps) | |||||
def populate(self, installed_apps=None): | |||||
""" | |||||
Loads application configurations and models. | |||||
This method imports each application module and then each model module. | |||||
It is thread safe and idempotent, but not reentrant. | |||||
""" | |||||
if self.ready: | |||||
return | |||||
# populate() might be called by two threads in parallel on servers | |||||
# that create threads before initializing the WSGI callable. | |||||
with self._lock: | |||||
if self.ready: | |||||
return | |||||
# app_config should be pristine, otherwise the code below won't | |||||
# guarantee that the order matches the order in INSTALLED_APPS. | |||||
if self.app_configs: | |||||
raise RuntimeError("populate() isn't reentrant") | |||||
# Load app configs and app modules. | |||||
for entry in installed_apps: | |||||
if isinstance(entry, AppConfig): | |||||
app_config = entry | |||||
else: | |||||
app_config = AppConfig.create(entry) | |||||
if app_config.label in self.app_configs: | |||||
raise ImproperlyConfigured( | |||||
"Application labels aren't unique, " | |||||
"duplicates: %s" % app_config.label) | |||||
self.app_configs[app_config.label] = app_config | |||||
# Check for duplicate app names. | |||||
counts = Counter( | |||||
app_config.name for app_config in self.app_configs.values()) | |||||
duplicates = [ | |||||
name for name, count in counts.most_common() if count > 1] | |||||
if duplicates: | |||||
raise ImproperlyConfigured( | |||||
"Application names aren't unique, " | |||||
"duplicates: %s" % ", ".join(duplicates)) | |||||
self.apps_ready = True | |||||
# Load models. | |||||
for app_config in self.app_configs.values(): | |||||
all_models = self.all_models[app_config.label] | |||||
app_config.import_models(all_models) | |||||
self.clear_cache() | |||||
self.models_ready = True | |||||
for app_config in self.get_app_configs(): | |||||
app_config.ready() | |||||
self.ready = True | |||||
def check_apps_ready(self): | |||||
""" | |||||
Raises an exception if all apps haven't been imported yet. | |||||
""" | |||||
if not self.apps_ready: | |||||
raise AppRegistryNotReady("Apps aren't loaded yet.") | |||||
def check_models_ready(self): | |||||
""" | |||||
Raises an exception if all models haven't been imported yet. | |||||
""" | |||||
if not self.models_ready: | |||||
raise AppRegistryNotReady("Models aren't loaded yet.") | |||||
def get_app_configs(self): | |||||
""" | |||||
Imports applications and returns an iterable of app configs. | |||||
""" | |||||
self.check_apps_ready() | |||||
return self.app_configs.values() | |||||
def get_app_config(self, app_label): | |||||
""" | |||||
Imports applications and returns an app config for the given label. | |||||
Raises LookupError if no application exists with this label. | |||||
""" | |||||
self.check_apps_ready() | |||||
try: | |||||
return self.app_configs[app_label] | |||||
except KeyError: | |||||
message = "No installed app with label '%s'." % app_label | |||||
for app_config in self.get_app_configs(): | |||||
if app_config.name == app_label: | |||||
message += " Did you mean '%s'?" % app_config.label | |||||
break | |||||
raise LookupError(message) | |||||
# This method is performance-critical at least for Django's test suite. | |||||
@lru_cache.lru_cache(maxsize=None) | |||||
def get_models(self, include_auto_created=False, | |||||
include_deferred=False, include_swapped=False): | |||||
""" | |||||
Returns a list of all installed models. | |||||
By default, the following models aren't included: | |||||
- auto-created models for many-to-many relations without | |||||
an explicit intermediate table, | |||||
- models created to satisfy deferred attribute queries, | |||||
- models that have been swapped out. | |||||
Set the corresponding keyword argument to True to include such models. | |||||
""" | |||||
self.check_models_ready() | |||||
result = [] | |||||
for app_config in self.app_configs.values(): | |||||
result.extend(list(app_config.get_models( | |||||
include_auto_created, include_deferred, include_swapped))) | |||||
return result | |||||
def get_model(self, app_label, model_name=None): | |||||
""" | |||||
Returns the model matching the given app_label and model_name. | |||||
As a shortcut, this function also accepts a single argument in the | |||||
form <app_label>.<model_name>. | |||||
model_name is case-insensitive. | |||||
Raises LookupError if no application exists with this label, or no | |||||
model exists with this name in the application. Raises ValueError if | |||||
called with a single argument that doesn't contain exactly one dot. | |||||
""" | |||||
self.check_models_ready() | |||||
if model_name is None: | |||||
app_label, model_name = app_label.split('.') | |||||
return self.get_app_config(app_label).get_model(model_name.lower()) | |||||
def register_model(self, app_label, model): | |||||
# Since this method is called when models are imported, it cannot | |||||
# perform imports because of the risk of import loops. It mustn't | |||||
# call get_app_config(). | |||||
model_name = model._meta.model_name | |||||
app_models = self.all_models[app_label] | |||||
if model_name in app_models: | |||||
if (model.__name__ == app_models[model_name].__name__ and | |||||
model.__module__ == app_models[model_name].__module__): | |||||
warnings.warn( | |||||
"Model '%s.%s' was already registered. " | |||||
"Reloading models is not advised as it can lead to inconsistencies, " | |||||
"most notably with related models." % (app_label, model_name), | |||||
RuntimeWarning, stacklevel=2) | |||||
else: | |||||
raise RuntimeError( | |||||
"Conflicting '%s' models in application '%s': %s and %s." % | |||||
(model_name, app_label, app_models[model_name], model)) | |||||
app_models[model_name] = model | |||||
self.do_pending_operations(model) | |||||
self.clear_cache() | |||||
def is_installed(self, app_name): | |||||
""" | |||||
Checks whether an application with this name exists in the registry. | |||||
app_name is the full name of the app eg. 'django.contrib.admin'. | |||||
""" | |||||
self.check_apps_ready() | |||||
return any(ac.name == app_name for ac in self.app_configs.values()) | |||||
def get_containing_app_config(self, object_name): | |||||
""" | |||||
Look for an app config containing a given object. | |||||
object_name is the dotted Python path to the object. | |||||
Returns the app config for the inner application in case of nesting. | |||||
Returns None if the object isn't in any registered app config. | |||||
""" | |||||
self.check_apps_ready() | |||||
candidates = [] | |||||
for app_config in self.app_configs.values(): | |||||
if object_name.startswith(app_config.name): | |||||
subpath = object_name[len(app_config.name):] | |||||
if subpath == '' or subpath[0] == '.': | |||||
candidates.append(app_config) | |||||
if candidates: | |||||
return sorted(candidates, key=lambda ac: -len(ac.name))[0] | |||||
def get_registered_model(self, app_label, model_name): | |||||
""" | |||||
Similar to get_model(), but doesn't require that an app exists with | |||||
the given app_label. | |||||
It's safe to call this method at import time, even while the registry | |||||
is being populated. | |||||
""" | |||||
model = self.all_models[app_label].get(model_name.lower()) | |||||
if model is None: | |||||
raise LookupError( | |||||
"Model '%s.%s' not registered." % (app_label, model_name)) | |||||
return model | |||||
@lru_cache.lru_cache(maxsize=None) | |||||
def get_swappable_settings_name(self, to_string): | |||||
""" | |||||
For a given model string (e.g. "auth.User"), return the name of the | |||||
corresponding settings name if it refers to a swappable model. If the | |||||
referred model is not swappable, return None. | |||||
This method is decorated with lru_cache because it's performance | |||||
critical when it comes to migrations. Since the swappable settings don't | |||||
change after Django has loaded the settings, there is no reason to get | |||||
the respective settings attribute over and over again. | |||||
""" | |||||
for model in self.get_models(include_swapped=True): | |||||
swapped = model._meta.swapped | |||||
# Is this model swapped out for the model given by to_string? | |||||
if swapped and swapped == to_string: | |||||
return model._meta.swappable | |||||
# Is this model swappable and the one given by to_string? | |||||
if model._meta.swappable and model._meta.label == to_string: | |||||
return model._meta.swappable | |||||
return None | |||||
def set_available_apps(self, available): | |||||
""" | |||||
Restricts the set of installed apps used by get_app_config[s]. | |||||
available must be an iterable of application names. | |||||
set_available_apps() must be balanced with unset_available_apps(). | |||||
Primarily used for performance optimization in TransactionTestCase. | |||||
This method is safe is the sense that it doesn't trigger any imports. | |||||
""" | |||||
available = set(available) | |||||
installed = set(app_config.name for app_config in self.get_app_configs()) | |||||
if not available.issubset(installed): | |||||
raise ValueError("Available apps isn't a subset of installed " | |||||
"apps, extra apps: %s" % ", ".join(available - installed)) | |||||
self.stored_app_configs.append(self.app_configs) | |||||
self.app_configs = OrderedDict( | |||||
(label, app_config) | |||||
for label, app_config in self.app_configs.items() | |||||
if app_config.name in available) | |||||
self.clear_cache() | |||||
def unset_available_apps(self): | |||||
""" | |||||
Cancels a previous call to set_available_apps(). | |||||
""" | |||||
self.app_configs = self.stored_app_configs.pop() | |||||
self.clear_cache() | |||||
def set_installed_apps(self, installed): | |||||
""" | |||||
Enables a different set of installed apps for get_app_config[s]. | |||||
installed must be an iterable in the same format as INSTALLED_APPS. | |||||
set_installed_apps() must be balanced with unset_installed_apps(), | |||||
even if it exits with an exception. | |||||
Primarily used as a receiver of the setting_changed signal in tests. | |||||
This method may trigger new imports, which may add new models to the | |||||
registry of all imported models. They will stay in the registry even | |||||
after unset_installed_apps(). Since it isn't possible to replay | |||||
imports safely (eg. that could lead to registering listeners twice), | |||||
models are registered when they're imported and never removed. | |||||
""" | |||||
if not self.ready: | |||||
raise AppRegistryNotReady("App registry isn't ready yet.") | |||||
self.stored_app_configs.append(self.app_configs) | |||||
self.app_configs = OrderedDict() | |||||
self.apps_ready = self.models_ready = self.ready = False | |||||
self.clear_cache() | |||||
self.populate(installed) | |||||
def unset_installed_apps(self): | |||||
""" | |||||
Cancels a previous call to set_installed_apps(). | |||||
""" | |||||
self.app_configs = self.stored_app_configs.pop() | |||||
self.apps_ready = self.models_ready = self.ready = True | |||||
self.clear_cache() | |||||
def clear_cache(self): | |||||
""" | |||||
Clears all internal caches, for methods that alter the app registry. | |||||
This is mostly used in tests. | |||||
""" | |||||
# Call expire cache on each model. This will purge | |||||
# the relation tree and the fields cache. | |||||
self.get_models.cache_clear() | |||||
if self.ready: | |||||
# Circumvent self.get_models() to prevent that the cache is refilled. | |||||
# This particularly prevents that an empty value is cached while cloning. | |||||
for app_config in self.app_configs.values(): | |||||
for model in app_config.get_models(include_auto_created=True): | |||||
model._meta._expire_cache() | |||||
def lazy_model_operation(self, function, *model_keys): | |||||
""" | |||||
Take a function and a number of ("app_label", "modelname") tuples, and | |||||
when all the corresponding models have been imported and registered, | |||||
call the function with the model classes as its arguments. | |||||
The function passed to this method must accept exactly n models as | |||||
arguments, where n=len(model_keys). | |||||
""" | |||||
# If this function depends on more than one model, we recursively turn | |||||
# it into a chain of functions that accept a single model argument and | |||||
# pass each in turn to lazy_model_operation. | |||||
model_key, more_models = model_keys[0], model_keys[1:] | |||||
if more_models: | |||||
supplied_fn = function | |||||
def function(model): | |||||
next_function = partial(supplied_fn, model) | |||||
# Annotate the function with its field for retrieval in | |||||
# migrations.state.StateApps. | |||||
if getattr(supplied_fn, 'keywords', None): | |||||
next_function.field = supplied_fn.keywords.get('field') | |||||
self.lazy_model_operation(next_function, *more_models) | |||||
# If the model is already loaded, pass it to the function immediately. | |||||
# Otherwise, delay execution until the class is prepared. | |||||
try: | |||||
model_class = self.get_registered_model(*model_key) | |||||
except LookupError: | |||||
self._pending_operations[model_key].append(function) | |||||
else: | |||||
function(model_class) | |||||
def do_pending_operations(self, model): | |||||
""" | |||||
Take a newly-prepared model and pass it to each function waiting for | |||||
it. This is called at the very end of `Apps.register_model()`. | |||||
""" | |||||
key = model._meta.app_label, model._meta.model_name | |||||
for function in self._pending_operations.pop(key, []): | |||||
function(model) | |||||
apps = Apps(installed_apps=None) |
@@ -0,0 +1,5 @@ | |||||
#!/usr/bin/env python | |||||
from django.core import management | |||||
if __name__ == "__main__": | |||||
management.execute_from_command_line() |
@@ -0,0 +1,198 @@ | |||||
""" | |||||
Settings and configuration for Django. | |||||
Values will be read from the module specified by the DJANGO_SETTINGS_MODULE environment | |||||
variable, and then from django.conf.global_settings; see the global settings file for | |||||
a list of all possible variables. | |||||
""" | |||||
import importlib | |||||
import os | |||||
import time | |||||
import warnings | |||||
from django.conf import global_settings | |||||
from django.core.exceptions import ImproperlyConfigured | |||||
from django.utils.deprecation import RemovedInDjango110Warning | |||||
from django.utils.functional import LazyObject, empty | |||||
ENVIRONMENT_VARIABLE = "DJANGO_SETTINGS_MODULE" | |||||
class LazySettings(LazyObject): | |||||
""" | |||||
A lazy proxy for either global Django settings or a custom settings object. | |||||
The user can manually configure settings prior to using them. Otherwise, | |||||
Django uses the settings module pointed to by DJANGO_SETTINGS_MODULE. | |||||
""" | |||||
def _setup(self, name=None): | |||||
""" | |||||
Load the settings module pointed to by the environment variable. This | |||||
is used the first time we need any settings at all, if the user has not | |||||
previously configured the settings manually. | |||||
""" | |||||
settings_module = os.environ.get(ENVIRONMENT_VARIABLE) | |||||
if not settings_module: | |||||
desc = ("setting %s" % name) if name else "settings" | |||||
raise ImproperlyConfigured( | |||||
"Requested %s, but settings are not configured. " | |||||
"You must either define the environment variable %s " | |||||
"or call settings.configure() before accessing settings." | |||||
% (desc, ENVIRONMENT_VARIABLE)) | |||||
self._wrapped = Settings(settings_module) | |||||
def __repr__(self): | |||||
# Hardcode the class name as otherwise it yields 'Settings'. | |||||
if self._wrapped is empty: | |||||
return '<LazySettings [Unevaluated]>' | |||||
return '<LazySettings "%(settings_module)s">' % { | |||||
'settings_module': self._wrapped.SETTINGS_MODULE, | |||||
} | |||||
def __getattr__(self, name): | |||||
if self._wrapped is empty: | |||||
self._setup(name) | |||||
return getattr(self._wrapped, name) | |||||
def configure(self, default_settings=global_settings, **options): | |||||
""" | |||||
Called to manually configure the settings. The 'default_settings' | |||||
parameter sets where to retrieve any unspecified values from (its | |||||
argument must support attribute access (__getattr__)). | |||||
""" | |||||
if self._wrapped is not empty: | |||||
raise RuntimeError('Settings already configured.') | |||||
holder = UserSettingsHolder(default_settings) | |||||
for name, value in options.items(): | |||||
setattr(holder, name, value) | |||||
self._wrapped = holder | |||||
@property | |||||
def configured(self): | |||||
""" | |||||
Returns True if the settings have already been configured. | |||||
""" | |||||
return self._wrapped is not empty | |||||
class BaseSettings(object): | |||||
""" | |||||
Common logic for settings whether set by a module or by the user. | |||||
""" | |||||
def __setattr__(self, name, value): | |||||
if name in ("MEDIA_URL", "STATIC_URL") and value and not value.endswith('/'): | |||||
raise ImproperlyConfigured("If set, %s must end with a slash" % name) | |||||
object.__setattr__(self, name, value) | |||||
class Settings(BaseSettings): | |||||
def __init__(self, settings_module): | |||||
# update this dict from global settings (but only for ALL_CAPS settings) | |||||
for setting in dir(global_settings): | |||||
if setting.isupper(): | |||||
setattr(self, setting, getattr(global_settings, setting)) | |||||
# store the settings module in case someone later cares | |||||
self.SETTINGS_MODULE = settings_module | |||||
mod = importlib.import_module(self.SETTINGS_MODULE) | |||||
tuple_settings = ( | |||||
"ALLOWED_INCLUDE_ROOTS", | |||||
"INSTALLED_APPS", | |||||
"TEMPLATE_DIRS", | |||||
"LOCALE_PATHS", | |||||
) | |||||
self._explicit_settings = set() | |||||
for setting in dir(mod): | |||||
if setting.isupper(): | |||||
setting_value = getattr(mod, setting) | |||||
if (setting in tuple_settings and | |||||
not isinstance(setting_value, (list, tuple))): | |||||
raise ImproperlyConfigured("The %s setting must be a list or a tuple. " | |||||
"Please fix your settings." % setting) | |||||
setattr(self, setting, setting_value) | |||||
self._explicit_settings.add(setting) | |||||
if not self.SECRET_KEY: | |||||
raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.") | |||||
if ('django.contrib.auth.middleware.AuthenticationMiddleware' in self.MIDDLEWARE_CLASSES and | |||||
'django.contrib.auth.middleware.SessionAuthenticationMiddleware' not in self.MIDDLEWARE_CLASSES): | |||||
warnings.warn( | |||||
"Session verification will become mandatory in Django 1.10. " | |||||
"Please add 'django.contrib.auth.middleware.SessionAuthenticationMiddleware' " | |||||
"to your MIDDLEWARE_CLASSES setting when you are ready to opt-in after " | |||||
"reading the upgrade considerations in the 1.8 release notes.", | |||||
RemovedInDjango110Warning | |||||
) | |||||
if hasattr(time, 'tzset') and self.TIME_ZONE: | |||||
# When we can, attempt to validate the timezone. If we can't find | |||||
# this file, no check happens and it's harmless. | |||||
zoneinfo_root = '/usr/share/zoneinfo' | |||||
if (os.path.exists(zoneinfo_root) and not | |||||
os.path.exists(os.path.join(zoneinfo_root, *(self.TIME_ZONE.split('/'))))): | |||||
raise ValueError("Incorrect timezone setting: %s" % self.TIME_ZONE) | |||||
# Move the time zone info into os.environ. See ticket #2315 for why | |||||
# we don't do this unconditionally (breaks Windows). | |||||
os.environ['TZ'] = self.TIME_ZONE | |||||
time.tzset() | |||||
def is_overridden(self, setting): | |||||
return setting in self._explicit_settings | |||||
def __repr__(self): | |||||
return '<%(cls)s "%(settings_module)s">' % { | |||||
'cls': self.__class__.__name__, | |||||
'settings_module': self.SETTINGS_MODULE, | |||||
} | |||||
class UserSettingsHolder(BaseSettings): | |||||
""" | |||||
Holder for user configured settings. | |||||
""" | |||||
# SETTINGS_MODULE doesn't make much sense in the manually configured | |||||
# (standalone) case. | |||||
SETTINGS_MODULE = None | |||||
def __init__(self, default_settings): | |||||
""" | |||||
Requests for configuration variables not in this class are satisfied | |||||
from the module specified in default_settings (if possible). | |||||
""" | |||||
self.__dict__['_deleted'] = set() | |||||
self.default_settings = default_settings | |||||
def __getattr__(self, name): | |||||
if name in self._deleted: | |||||
raise AttributeError | |||||
return getattr(self.default_settings, name) | |||||
def __setattr__(self, name, value): | |||||
self._deleted.discard(name) | |||||
super(UserSettingsHolder, self).__setattr__(name, value) | |||||
def __delattr__(self, name): | |||||
self._deleted.add(name) | |||||
if hasattr(self, name): | |||||
super(UserSettingsHolder, self).__delattr__(name) | |||||
def __dir__(self): | |||||
return list(self.__dict__) + dir(self.default_settings) | |||||
def is_overridden(self, setting): | |||||
deleted = (setting in self._deleted) | |||||
set_locally = (setting in self.__dict__) | |||||
set_on_default = getattr(self.default_settings, 'is_overridden', lambda s: False)(setting) | |||||
return (deleted or set_locally or set_on_default) | |||||
def __repr__(self): | |||||
return '<%(cls)s>' % { | |||||
'cls': self.__class__.__name__, | |||||
} | |||||
settings = LazySettings() |
@@ -0,0 +1,3 @@ | |||||
from django.contrib import admin | |||||
# Register your models here. |
@@ -0,0 +1,5 @@ | |||||
{{ unicode_literals }}from django.apps import AppConfig | |||||
class {{ camel_case_app_name }}Config(AppConfig): | |||||
name = '{{ app_name }}' |
@@ -0,0 +1,3 @@ | |||||
{{ unicode_literals }}from django.db import models | |||||
# Create your models here. |
@@ -0,0 +1,3 @@ | |||||
from django.test import TestCase | |||||
# Create your tests here. |
@@ -0,0 +1,3 @@ | |||||
from django.shortcuts import render | |||||
# Create your views here. |
@@ -0,0 +1,651 @@ | |||||
# Default Django settings. Override these with settings in the module | |||||
# pointed-to by the DJANGO_SETTINGS_MODULE environment variable. | |||||
# This is defined here as a do-nothing function because we can't import | |||||
# django.utils.translation -- that module depends on the settings. | |||||
gettext_noop = lambda s: s | |||||
#################### | |||||
# CORE # | |||||
#################### | |||||
DEBUG = False | |||||
TEMPLATE_DEBUG = False | |||||
# Whether the framework should propagate raw exceptions rather than catching | |||||
# them. This is useful under some testing situations and should never be used | |||||
# on a live site. | |||||
DEBUG_PROPAGATE_EXCEPTIONS = False | |||||
# Whether to use the "Etag" header. This saves bandwidth but slows down performance. | |||||
USE_ETAGS = False | |||||
# People who get code error notifications. | |||||
# In the format [('Full Name', 'email@example.com'), ('Full Name', 'anotheremail@example.com')] | |||||
ADMINS = [] | |||||
# List of IP addresses, as strings, that: | |||||
# * See debug comments, when DEBUG is true | |||||
# * Receive x-headers | |||||
INTERNAL_IPS = [] | |||||
# Hosts/domain names that are valid for this site. | |||||
# "*" matches anything, ".example.com" matches example.com and all subdomains | |||||
ALLOWED_HOSTS = [] | |||||
# Local time zone for this installation. All choices can be found here: | |||||
# https://en.wikipedia.org/wiki/List_of_tz_zones_by_name (although not all | |||||
# systems may support all possibilities). When USE_TZ is True, this is | |||||
# interpreted as the default user time zone. | |||||
TIME_ZONE = 'America/Chicago' | |||||
# If you set this to True, Django will use timezone-aware datetimes. | |||||
USE_TZ = False | |||||
# Language code for this installation. All choices can be found here: | |||||
# http://www.i18nguy.com/unicode/language-identifiers.html | |||||
LANGUAGE_CODE = 'en-us' | |||||
# Languages we provide translations for, out of the box. | |||||
LANGUAGES = [ | |||||
('af', gettext_noop('Afrikaans')), | |||||
('ar', gettext_noop('Arabic')), | |||||
('ast', gettext_noop('Asturian')), | |||||
('az', gettext_noop('Azerbaijani')), | |||||
('bg', gettext_noop('Bulgarian')), | |||||
('be', gettext_noop('Belarusian')), | |||||
('bn', gettext_noop('Bengali')), | |||||
('br', gettext_noop('Breton')), | |||||
('bs', gettext_noop('Bosnian')), | |||||
('ca', gettext_noop('Catalan')), | |||||
('cs', gettext_noop('Czech')), | |||||
('cy', gettext_noop('Welsh')), | |||||
('da', gettext_noop('Danish')), | |||||
('de', gettext_noop('German')), | |||||
('el', gettext_noop('Greek')), | |||||
('en', gettext_noop('English')), | |||||
('en-au', gettext_noop('Australian English')), | |||||
('en-gb', gettext_noop('British English')), | |||||
('eo', gettext_noop('Esperanto')), | |||||
('es', gettext_noop('Spanish')), | |||||
('es-ar', gettext_noop('Argentinian Spanish')), | |||||
('es-co', gettext_noop('Colombian Spanish')), | |||||
('es-mx', gettext_noop('Mexican Spanish')), | |||||
('es-ni', gettext_noop('Nicaraguan Spanish')), | |||||
('es-ve', gettext_noop('Venezuelan Spanish')), | |||||
('et', gettext_noop('Estonian')), | |||||
('eu', gettext_noop('Basque')), | |||||
('fa', gettext_noop('Persian')), | |||||
('fi', gettext_noop('Finnish')), | |||||
('fr', gettext_noop('French')), | |||||
('fy', gettext_noop('Frisian')), | |||||
('ga', gettext_noop('Irish')), | |||||
('gd', gettext_noop('Scottish Gaelic')), | |||||
('gl', gettext_noop('Galician')), | |||||
('he', gettext_noop('Hebrew')), | |||||
('hi', gettext_noop('Hindi')), | |||||
('hr', gettext_noop('Croatian')), | |||||
('hu', gettext_noop('Hungarian')), | |||||
('ia', gettext_noop('Interlingua')), | |||||
('id', gettext_noop('Indonesian')), | |||||
('io', gettext_noop('Ido')), | |||||
('is', gettext_noop('Icelandic')), | |||||
('it', gettext_noop('Italian')), | |||||
('ja', gettext_noop('Japanese')), | |||||
('ka', gettext_noop('Georgian')), | |||||
('kk', gettext_noop('Kazakh')), | |||||
('km', gettext_noop('Khmer')), | |||||
('kn', gettext_noop('Kannada')), | |||||
('ko', gettext_noop('Korean')), | |||||
('lb', gettext_noop('Luxembourgish')), | |||||
('lt', gettext_noop('Lithuanian')), | |||||
('lv', gettext_noop('Latvian')), | |||||
('mk', gettext_noop('Macedonian')), | |||||
('ml', gettext_noop('Malayalam')), | |||||
('mn', gettext_noop('Mongolian')), | |||||
('mr', gettext_noop('Marathi')), | |||||
('my', gettext_noop('Burmese')), | |||||
('nb', gettext_noop('Norwegian Bokmal')), | |||||
('ne', gettext_noop('Nepali')), | |||||
('nl', gettext_noop('Dutch')), | |||||
('nn', gettext_noop('Norwegian Nynorsk')), | |||||
('os', gettext_noop('Ossetic')), | |||||
('pa', gettext_noop('Punjabi')), | |||||
('pl', gettext_noop('Polish')), | |||||
('pt', gettext_noop('Portuguese')), | |||||
('pt-br', gettext_noop('Brazilian Portuguese')), | |||||
('ro', gettext_noop('Romanian')), | |||||
('ru', gettext_noop('Russian')), | |||||
('sk', gettext_noop('Slovak')), | |||||
('sl', gettext_noop('Slovenian')), | |||||
('sq', gettext_noop('Albanian')), | |||||
('sr', gettext_noop('Serbian')), | |||||
('sr-latn', gettext_noop('Serbian Latin')), | |||||
('sv', gettext_noop('Swedish')), | |||||
('sw', gettext_noop('Swahili')), | |||||
('ta', gettext_noop('Tamil')), | |||||
('te', gettext_noop('Telugu')), | |||||
('th', gettext_noop('Thai')), | |||||
('tr', gettext_noop('Turkish')), | |||||
('tt', gettext_noop('Tatar')), | |||||
('udm', gettext_noop('Udmurt')), | |||||
('uk', gettext_noop('Ukrainian')), | |||||
('ur', gettext_noop('Urdu')), | |||||
('vi', gettext_noop('Vietnamese')), | |||||
('zh-hans', gettext_noop('Simplified Chinese')), | |||||
('zh-hant', gettext_noop('Traditional Chinese')), | |||||
] | |||||
# Languages using BiDi (right-to-left) layout | |||||
LANGUAGES_BIDI = ["he", "ar", "fa", "ur"] | |||||
# If you set this to False, Django will make some optimizations so as not | |||||
# to load the internationalization machinery. | |||||
USE_I18N = True | |||||
LOCALE_PATHS = [] | |||||
# Settings for language cookie | |||||
LANGUAGE_COOKIE_NAME = 'django_language' | |||||
LANGUAGE_COOKIE_AGE = None | |||||
LANGUAGE_COOKIE_DOMAIN = None | |||||
LANGUAGE_COOKIE_PATH = '/' | |||||
# If you set this to True, Django will format dates, numbers and calendars | |||||
# according to user current locale. | |||||
USE_L10N = False | |||||
# Not-necessarily-technical managers of the site. They get broken link | |||||
# notifications and other various emails. | |||||
MANAGERS = ADMINS | |||||
# Default content type and charset to use for all HttpResponse objects, if a | |||||
# MIME type isn't manually specified. These are used to construct the | |||||
# Content-Type header. | |||||
DEFAULT_CONTENT_TYPE = 'text/html' | |||||
DEFAULT_CHARSET = 'utf-8' | |||||
# Encoding of files read from disk (template and initial SQL files). | |||||
FILE_CHARSET = 'utf-8' | |||||
# Email address that error messages come from. | |||||
SERVER_EMAIL = 'root@localhost' | |||||
# Database connection info. If left empty, will default to the dummy backend. | |||||
DATABASES = {} | |||||
# Classes used to implement DB routing behavior. | |||||
DATABASE_ROUTERS = [] | |||||
# The email backend to use. For possible shortcuts see django.core.mail. | |||||
# The default is to use the SMTP backend. | |||||
# Third-party backends can be specified by providing a Python path | |||||
# to a module that defines an EmailBackend class. | |||||
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' | |||||
# Host for sending email. | |||||
EMAIL_HOST = 'localhost' | |||||
# Port for sending email. | |||||
EMAIL_PORT = 25 | |||||
# Optional SMTP authentication information for EMAIL_HOST. | |||||
EMAIL_HOST_USER = '' | |||||
EMAIL_HOST_PASSWORD = '' | |||||
EMAIL_USE_TLS = False | |||||
EMAIL_USE_SSL = False | |||||
EMAIL_SSL_CERTFILE = None | |||||
EMAIL_SSL_KEYFILE = None | |||||
EMAIL_TIMEOUT = None | |||||
# List of strings representing installed apps. | |||||
INSTALLED_APPS = [] | |||||
# List of locations of the template source files, in search order. | |||||
TEMPLATE_DIRS = [] | |||||
# List of callables that know how to import templates from various sources. | |||||
# See the comments in django/core/template/loader.py for interface | |||||
# documentation. | |||||
TEMPLATE_LOADERS = [ | |||||
'django.template.loaders.filesystem.Loader', | |||||
'django.template.loaders.app_directories.Loader', | |||||
] | |||||
# List of processors used by RequestContext to populate the context. | |||||
# Each one should be a callable that takes the request object as its | |||||
# only parameter and returns a dictionary to add to the context. | |||||
TEMPLATE_CONTEXT_PROCESSORS = [ | |||||
'django.contrib.auth.context_processors.auth', | |||||
'django.template.context_processors.debug', | |||||
'django.template.context_processors.i18n', | |||||
'django.template.context_processors.media', | |||||
'django.template.context_processors.static', | |||||
'django.template.context_processors.tz', | |||||
# 'django.template.context_processors.request', | |||||
'django.contrib.messages.context_processors.messages', | |||||
] | |||||
# Output to use in template system for invalid (e.g. misspelled) variables. | |||||
TEMPLATE_STRING_IF_INVALID = '' | |||||
TEMPLATES = [] | |||||
# Default email address to use for various automated correspondence from | |||||
# the site managers. | |||||
DEFAULT_FROM_EMAIL = 'webmaster@localhost' | |||||
# Subject-line prefix for email messages send with django.core.mail.mail_admins | |||||
# or ...mail_managers. Make sure to include the trailing space. | |||||
EMAIL_SUBJECT_PREFIX = '[Django] ' | |||||
# Whether to append trailing slashes to URLs. | |||||
APPEND_SLASH = True | |||||
# Whether to prepend the "www." subdomain to URLs that don't have it. | |||||
PREPEND_WWW = False | |||||
# Override the server-derived value of SCRIPT_NAME | |||||
FORCE_SCRIPT_NAME = None | |||||
# List of compiled regular expression objects representing User-Agent strings | |||||
# that are not allowed to visit any page, systemwide. Use this for bad | |||||
# robots/crawlers. Here are a few examples: | |||||
# import re | |||||
# DISALLOWED_USER_AGENTS = [ | |||||
# re.compile(r'^NaverBot.*'), | |||||
# re.compile(r'^EmailSiphon.*'), | |||||
# re.compile(r'^SiteSucker.*'), | |||||
# re.compile(r'^sohu-search') | |||||
# ] | |||||
DISALLOWED_USER_AGENTS = [] | |||||
ABSOLUTE_URL_OVERRIDES = {} | |||||
# List of strings representing allowed prefixes for the {% ssi %} tag. | |||||
# Example: ['/home/html', '/var/www'] | |||||
ALLOWED_INCLUDE_ROOTS = [] | |||||
# List of compiled regular expression objects representing URLs that need not | |||||
# be reported by BrokenLinkEmailsMiddleware. Here are a few examples: | |||||
# import re | |||||
# IGNORABLE_404_URLS = [ | |||||
# re.compile(r'^/apple-touch-icon.*\.png$'), | |||||
# re.compile(r'^/favicon.ico$), | |||||
# re.compile(r'^/robots.txt$), | |||||
# re.compile(r'^/phpmyadmin/), | |||||
# re.compile(r'\.(cgi|php|pl)$'), | |||||
# ] | |||||
IGNORABLE_404_URLS = [] | |||||
# A secret key for this particular Django installation. Used in secret-key | |||||
# hashing algorithms. Set this in your settings, or Django will complain | |||||
# loudly. | |||||
SECRET_KEY = '' | |||||
# Default file storage mechanism that holds media. | |||||
DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage' | |||||
# Absolute filesystem path to the directory that will hold user-uploaded files. | |||||
# Example: "/var/www/example.com/media/" | |||||
MEDIA_ROOT = '' | |||||
# URL that handles the media served from MEDIA_ROOT. | |||||
# Examples: "http://example.com/media/", "http://media.example.com/" | |||||
MEDIA_URL = '' | |||||
# Absolute path to the directory static files should be collected to. | |||||
# Example: "/var/www/example.com/static/" | |||||
STATIC_ROOT = None | |||||
# URL that handles the static files served from STATIC_ROOT. | |||||
# Example: "http://example.com/static/", "http://static.example.com/" | |||||
STATIC_URL = None | |||||
# List of upload handler classes to be applied in order. | |||||
FILE_UPLOAD_HANDLERS = [ | |||||
'django.core.files.uploadhandler.MemoryFileUploadHandler', | |||||
'django.core.files.uploadhandler.TemporaryFileUploadHandler', | |||||
] | |||||
# Maximum size, in bytes, of a request before it will be streamed to the | |||||
# file system instead of into memory. | |||||
FILE_UPLOAD_MAX_MEMORY_SIZE = 2621440 # i.e. 2.5 MB | |||||
# Directory in which upload streamed files will be temporarily saved. A value of | |||||
# `None` will make Django use the operating system's default temporary directory | |||||
# (i.e. "/tmp" on *nix systems). | |||||
FILE_UPLOAD_TEMP_DIR = None | |||||
# The numeric mode to set newly-uploaded files to. The value should be a mode | |||||
# you'd pass directly to os.chmod; see https://docs.python.org/3/library/os.html#files-and-directories. | |||||
FILE_UPLOAD_PERMISSIONS = None | |||||
# The numeric mode to assign to newly-created directories, when uploading files. | |||||
# The value should be a mode as you'd pass to os.chmod; | |||||
# see https://docs.python.org/3/library/os.html#files-and-directories. | |||||
FILE_UPLOAD_DIRECTORY_PERMISSIONS = None | |||||
# Python module path where user will place custom format definition. | |||||
# The directory where this setting is pointing should contain subdirectories | |||||
# named as the locales, containing a formats.py file | |||||
# (i.e. "myproject.locale" for myproject/locale/en/formats.py etc. use) | |||||
FORMAT_MODULE_PATH = None | |||||
# Default formatting for date objects. See all available format strings here: | |||||
# http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date | |||||
DATE_FORMAT = 'N j, Y' | |||||
# Default formatting for datetime objects. See all available format strings here: | |||||
# http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date | |||||
DATETIME_FORMAT = 'N j, Y, P' | |||||
# Default formatting for time objects. See all available format strings here: | |||||
# http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date | |||||
TIME_FORMAT = 'P' | |||||
# Default formatting for date objects when only the year and month are relevant. | |||||
# See all available format strings here: | |||||
# http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date | |||||
YEAR_MONTH_FORMAT = 'F Y' | |||||
# Default formatting for date objects when only the month and day are relevant. | |||||
# See all available format strings here: | |||||
# http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date | |||||
MONTH_DAY_FORMAT = 'F j' | |||||
# Default short formatting for date objects. See all available format strings here: | |||||
# http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date | |||||
SHORT_DATE_FORMAT = 'm/d/Y' | |||||
# Default short formatting for datetime objects. | |||||
# See all available format strings here: | |||||
# http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date | |||||
SHORT_DATETIME_FORMAT = 'm/d/Y P' | |||||
# Default formats to be used when parsing dates from input boxes, in order | |||||
# See all available format string here: | |||||
# http://docs.python.org/library/datetime.html#strftime-behavior | |||||
# * Note that these format strings are different from the ones to display dates | |||||
DATE_INPUT_FORMATS = [ | |||||
'%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06' | |||||
'%b %d %Y', '%b %d, %Y', # 'Oct 25 2006', 'Oct 25, 2006' | |||||
'%d %b %Y', '%d %b, %Y', # '25 Oct 2006', '25 Oct, 2006' | |||||
'%B %d %Y', '%B %d, %Y', # 'October 25 2006', 'October 25, 2006' | |||||
'%d %B %Y', '%d %B, %Y', # '25 October 2006', '25 October, 2006' | |||||
] | |||||
# Default formats to be used when parsing times from input boxes, in order | |||||
# See all available format string here: | |||||
# http://docs.python.org/library/datetime.html#strftime-behavior | |||||
# * Note that these format strings are different from the ones to display dates | |||||
TIME_INPUT_FORMATS = [ | |||||
'%H:%M:%S', # '14:30:59' | |||||
'%H:%M:%S.%f', # '14:30:59.000200' | |||||
'%H:%M', # '14:30' | |||||
] | |||||
# Default formats to be used when parsing dates and times from input boxes, | |||||
# in order | |||||
# See all available format string here: | |||||
# http://docs.python.org/library/datetime.html#strftime-behavior | |||||
# * Note that these format strings are different from the ones to display dates | |||||
DATETIME_INPUT_FORMATS = [ | |||||
'%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59' | |||||
'%Y-%m-%d %H:%M:%S.%f', # '2006-10-25 14:30:59.000200' | |||||
'%Y-%m-%d %H:%M', # '2006-10-25 14:30' | |||||
'%Y-%m-%d', # '2006-10-25' | |||||
'%m/%d/%Y %H:%M:%S', # '10/25/2006 14:30:59' | |||||
'%m/%d/%Y %H:%M:%S.%f', # '10/25/2006 14:30:59.000200' | |||||
'%m/%d/%Y %H:%M', # '10/25/2006 14:30' | |||||
'%m/%d/%Y', # '10/25/2006' | |||||
'%m/%d/%y %H:%M:%S', # '10/25/06 14:30:59' | |||||
'%m/%d/%y %H:%M:%S.%f', # '10/25/06 14:30:59.000200' | |||||
'%m/%d/%y %H:%M', # '10/25/06 14:30' | |||||
'%m/%d/%y', # '10/25/06' | |||||
] | |||||
# First day of week, to be used on calendars | |||||
# 0 means Sunday, 1 means Monday... | |||||
FIRST_DAY_OF_WEEK = 0 | |||||
# Decimal separator symbol | |||||
DECIMAL_SEPARATOR = '.' | |||||
# Boolean that sets whether to add thousand separator when formatting numbers | |||||
USE_THOUSAND_SEPARATOR = False | |||||
# Number of digits that will be together, when splitting them by | |||||
# THOUSAND_SEPARATOR. 0 means no grouping, 3 means splitting by thousands... | |||||
NUMBER_GROUPING = 0 | |||||
# Thousand separator symbol | |||||
THOUSAND_SEPARATOR = ',' | |||||
# The tablespaces to use for each model when not specified otherwise. | |||||
DEFAULT_TABLESPACE = '' | |||||
DEFAULT_INDEX_TABLESPACE = '' | |||||
# Default X-Frame-Options header value | |||||
X_FRAME_OPTIONS = 'SAMEORIGIN' | |||||
USE_X_FORWARDED_HOST = False | |||||
USE_X_FORWARDED_PORT = False | |||||
# The Python dotted path to the WSGI application that Django's internal server | |||||
# (runserver) will use. If `None`, the return value of | |||||
# 'django.core.wsgi.get_wsgi_application' is used, thus preserving the same | |||||
# behavior as previous versions of Django. Otherwise this should point to an | |||||
# actual WSGI application object. | |||||
WSGI_APPLICATION = None | |||||
# If your Django app is behind a proxy that sets a header to specify secure | |||||
# connections, AND that proxy ensures that user-submitted headers with the | |||||
# same name are ignored (so that people can't spoof it), set this value to | |||||
# a tuple of (header_name, header_value). For any requests that come in with | |||||
# that header/value, request.is_secure() will return True. | |||||
# WARNING! Only set this if you fully understand what you're doing. Otherwise, | |||||
# you may be opening yourself up to a security risk. | |||||
SECURE_PROXY_SSL_HEADER = None | |||||
############## | |||||
# MIDDLEWARE # | |||||
############## | |||||
# List of middleware classes to use. Order is important; in the request phase, | |||||
# this middleware classes will be applied in the order given, and in the | |||||
# response phase the middleware will be applied in reverse order. | |||||
MIDDLEWARE_CLASSES = [ | |||||
'django.middleware.common.CommonMiddleware', | |||||
'django.middleware.csrf.CsrfViewMiddleware', | |||||
] | |||||
############ | |||||
# SESSIONS # | |||||
############ | |||||
# Cache to store session data if using the cache session backend. | |||||
SESSION_CACHE_ALIAS = 'default' | |||||
# Cookie name. This can be whatever you want. | |||||
SESSION_COOKIE_NAME = 'sessionid' | |||||
# Age of cookie, in seconds (default: 2 weeks). | |||||
SESSION_COOKIE_AGE = 60 * 60 * 24 * 7 * 2 | |||||
# A string like ".example.com", or None for standard domain cookie. | |||||
SESSION_COOKIE_DOMAIN = None | |||||
# Whether the session cookie should be secure (https:// only). | |||||
SESSION_COOKIE_SECURE = False | |||||
# The path of the session cookie. | |||||
SESSION_COOKIE_PATH = '/' | |||||
# Whether to use the non-RFC standard httpOnly flag (IE, FF3+, others) | |||||
SESSION_COOKIE_HTTPONLY = True | |||||
# Whether to save the session data on every request. | |||||
SESSION_SAVE_EVERY_REQUEST = False | |||||
# Whether a user's session cookie expires when the Web browser is closed. | |||||
SESSION_EXPIRE_AT_BROWSER_CLOSE = False | |||||
# The module to store session data | |||||
SESSION_ENGINE = 'django.contrib.sessions.backends.db' | |||||
# Directory to store session files if using the file session module. If None, | |||||
# the backend will use a sensible default. | |||||
SESSION_FILE_PATH = None | |||||
# class to serialize session data | |||||
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer' | |||||
######### | |||||
# CACHE # | |||||
######### | |||||
# The cache backends to use. | |||||
CACHES = { | |||||
'default': { | |||||
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', | |||||
} | |||||
} | |||||
CACHE_MIDDLEWARE_KEY_PREFIX = '' | |||||
CACHE_MIDDLEWARE_SECONDS = 600 | |||||
CACHE_MIDDLEWARE_ALIAS = 'default' | |||||
################## | |||||
# AUTHENTICATION # | |||||
################## | |||||
AUTH_USER_MODEL = 'auth.User' | |||||
AUTHENTICATION_BACKENDS = ['django.contrib.auth.backends.ModelBackend'] | |||||
LOGIN_URL = '/accounts/login/' | |||||
LOGOUT_URL = '/accounts/logout/' | |||||
LOGIN_REDIRECT_URL = '/accounts/profile/' | |||||
# The number of days a password reset link is valid for | |||||
PASSWORD_RESET_TIMEOUT_DAYS = 3 | |||||
# the first hasher in this list is the preferred algorithm. any | |||||
# password using different algorithms will be converted automatically | |||||
# upon login | |||||
PASSWORD_HASHERS = [ | |||||
'django.contrib.auth.hashers.PBKDF2PasswordHasher', | |||||
'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher', | |||||
'django.contrib.auth.hashers.BCryptSHA256PasswordHasher', | |||||
'django.contrib.auth.hashers.BCryptPasswordHasher', | |||||
'django.contrib.auth.hashers.SHA1PasswordHasher', | |||||
'django.contrib.auth.hashers.MD5PasswordHasher', | |||||
'django.contrib.auth.hashers.UnsaltedSHA1PasswordHasher', | |||||
'django.contrib.auth.hashers.UnsaltedMD5PasswordHasher', | |||||
'django.contrib.auth.hashers.CryptPasswordHasher', | |||||
] | |||||
AUTH_PASSWORD_VALIDATORS = [] | |||||
########### | |||||
# SIGNING # | |||||
########### | |||||
SIGNING_BACKEND = 'django.core.signing.TimestampSigner' | |||||
######## | |||||
# CSRF # | |||||
######## | |||||
# Dotted path to callable to be used as view when a request is | |||||
# rejected by the CSRF middleware. | |||||
CSRF_FAILURE_VIEW = 'django.views.csrf.csrf_failure' | |||||
# Settings for CSRF cookie. | |||||
CSRF_COOKIE_NAME = 'csrftoken' | |||||
CSRF_COOKIE_AGE = 60 * 60 * 24 * 7 * 52 | |||||
CSRF_COOKIE_DOMAIN = None | |||||
CSRF_COOKIE_PATH = '/' | |||||
CSRF_COOKIE_SECURE = False | |||||
CSRF_COOKIE_HTTPONLY = False | |||||
CSRF_HEADER_NAME = 'HTTP_X_CSRFTOKEN' | |||||
CSRF_TRUSTED_ORIGINS = [] | |||||
############ | |||||
# MESSAGES # | |||||
############ | |||||
# Class to use as messages backend | |||||
MESSAGE_STORAGE = 'django.contrib.messages.storage.fallback.FallbackStorage' | |||||
# Default values of MESSAGE_LEVEL and MESSAGE_TAGS are defined within | |||||
# django.contrib.messages to avoid imports in this settings file. | |||||
########### | |||||
# LOGGING # | |||||
########### | |||||
# The callable to use to configure logging | |||||
LOGGING_CONFIG = 'logging.config.dictConfig' | |||||
# Custom logging configuration. | |||||
LOGGING = {} | |||||
# Default exception reporter filter class used in case none has been | |||||
# specifically assigned to the HttpRequest instance. | |||||
DEFAULT_EXCEPTION_REPORTER_FILTER = 'django.views.debug.SafeExceptionReporterFilter' | |||||
########### | |||||
# TESTING # | |||||
########### | |||||
# The name of the class to use to run the test suite | |||||
TEST_RUNNER = 'django.test.runner.DiscoverRunner' | |||||
# Apps that don't need to be serialized at test database creation time | |||||
# (only apps with migrations are to start with) | |||||
TEST_NON_SERIALIZED_APPS = [] | |||||
############ | |||||
# FIXTURES # | |||||
############ | |||||
# The list of directories to search for fixtures | |||||
FIXTURE_DIRS = [] | |||||
############### | |||||
# STATICFILES # | |||||
############### | |||||
# A list of locations of additional static files | |||||
STATICFILES_DIRS = [] | |||||
# The default file storage backend used during the build process | |||||
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage' | |||||
# List of finder classes that know how to find static files in | |||||
# various locations. | |||||
STATICFILES_FINDERS = [ | |||||
'django.contrib.staticfiles.finders.FileSystemFinder', | |||||
'django.contrib.staticfiles.finders.AppDirectoriesFinder', | |||||
# 'django.contrib.staticfiles.finders.DefaultStorageFinder', | |||||
] | |||||
############## | |||||
# MIGRATIONS # | |||||
############## | |||||
# Migration module overrides for apps, by app label. | |||||
MIGRATION_MODULES = {} | |||||
################# | |||||
# SYSTEM CHECKS # | |||||
################# | |||||
# List of all issues generated by system checks that should be silenced. Light | |||||
# issues like warnings, infos or debugs will not generate a message. Silencing | |||||
# serious issues like errors and criticals does not result in hiding the | |||||
# message, but Django will not stop you from e.g. running server. | |||||
SILENCED_SYSTEM_CHECKS = [] | |||||
####################### | |||||
# SECURITY MIDDLEWARE # | |||||
####################### | |||||
SECURE_BROWSER_XSS_FILTER = False | |||||
SECURE_CONTENT_TYPE_NOSNIFF = False | |||||
SECURE_HSTS_INCLUDE_SUBDOMAINS = False | |||||
SECURE_HSTS_SECONDS = 0 | |||||
SECURE_REDIRECT_EXEMPT = [] | |||||
SECURE_SSL_HOST = None | |||||
SECURE_SSL_REDIRECT = False |
@@ -0,0 +1,554 @@ | |||||
# -*- encoding: utf-8 -*- | |||||
from __future__ import unicode_literals | |||||
""" | |||||
LANG_INFO is a dictionary structure to provide meta information about languages. | |||||
About name_local: capitalize it as if your language name was appearing | |||||
inside a sentence in your language. | |||||
The 'fallback' key can be used to specify a special fallback logic which doesn't | |||||
follow the traditional 'fr-ca' -> 'fr' fallback logic. | |||||
""" | |||||
LANG_INFO = { | |||||
'af': { | |||||
'bidi': False, | |||||
'code': 'af', | |||||
'name': 'Afrikaans', | |||||
'name_local': 'Afrikaans', | |||||
}, | |||||
'ar': { | |||||
'bidi': True, | |||||
'code': 'ar', | |||||
'name': 'Arabic', | |||||
'name_local': 'العربيّة', | |||||
}, | |||||
'ast': { | |||||
'bidi': False, | |||||
'code': 'ast', | |||||
'name': 'Asturian', | |||||
'name_local': 'asturianu', | |||||
}, | |||||
'az': { | |||||
'bidi': True, | |||||
'code': 'az', | |||||
'name': 'Azerbaijani', | |||||
'name_local': 'Azərbaycanca', | |||||
}, | |||||
'be': { | |||||
'bidi': False, | |||||
'code': 'be', | |||||
'name': 'Belarusian', | |||||
'name_local': 'беларуская', | |||||
}, | |||||
'bg': { | |||||
'bidi': False, | |||||
'code': 'bg', | |||||
'name': 'Bulgarian', | |||||
'name_local': 'български', | |||||
}, | |||||
'bn': { | |||||
'bidi': False, | |||||
'code': 'bn', | |||||
'name': 'Bengali', | |||||
'name_local': 'বাংলা', | |||||
}, | |||||
'br': { | |||||
'bidi': False, | |||||
'code': 'br', | |||||
'name': 'Breton', | |||||
'name_local': 'brezhoneg', | |||||
}, | |||||
'bs': { | |||||
'bidi': False, | |||||
'code': 'bs', | |||||
'name': 'Bosnian', | |||||
'name_local': 'bosanski', | |||||
}, | |||||
'ca': { | |||||
'bidi': False, | |||||
'code': 'ca', | |||||
'name': 'Catalan', | |||||
'name_local': 'català', | |||||
}, | |||||
'cs': { | |||||
'bidi': False, | |||||
'code': 'cs', | |||||
'name': 'Czech', | |||||
'name_local': 'česky', | |||||
}, | |||||
'cy': { | |||||
'bidi': False, | |||||
'code': 'cy', | |||||
'name': 'Welsh', | |||||
'name_local': 'Cymraeg', | |||||
}, | |||||
'da': { | |||||
'bidi': False, | |||||
'code': 'da', | |||||
'name': 'Danish', | |||||
'name_local': 'dansk', | |||||
}, | |||||
'de': { | |||||
'bidi': False, | |||||
'code': 'de', | |||||
'name': 'German', | |||||
'name_local': 'Deutsch', | |||||
}, | |||||
'el': { | |||||
'bidi': False, | |||||
'code': 'el', | |||||
'name': 'Greek', | |||||
'name_local': 'Ελληνικά', | |||||
}, | |||||
'en': { | |||||
'bidi': False, | |||||
'code': 'en', | |||||
'name': 'English', | |||||
'name_local': 'English', | |||||
}, | |||||
'en-au': { | |||||
'bidi': False, | |||||
'code': 'en-au', | |||||
'name': 'Australian English', | |||||
'name_local': 'Australian English', | |||||
}, | |||||
'en-gb': { | |||||
'bidi': False, | |||||
'code': 'en-gb', | |||||
'name': 'British English', | |||||
'name_local': 'British English', | |||||
}, | |||||
'eo': { | |||||
'bidi': False, | |||||
'code': 'eo', | |||||
'name': 'Esperanto', | |||||
'name_local': 'Esperanto', | |||||
}, | |||||
'es': { | |||||
'bidi': False, | |||||
'code': 'es', | |||||
'name': 'Spanish', | |||||
'name_local': 'español', | |||||
}, | |||||
'es-ar': { | |||||
'bidi': False, | |||||
'code': 'es-ar', | |||||
'name': 'Argentinian Spanish', | |||||
'name_local': 'español de Argentina', | |||||
}, | |||||
'es-co': { | |||||
'bidi': False, | |||||
'code': 'es-co', | |||||
'name': 'Colombian Spanish', | |||||
'name_local': 'español de Colombia', | |||||
}, | |||||
'es-mx': { | |||||
'bidi': False, | |||||
'code': 'es-mx', | |||||
'name': 'Mexican Spanish', | |||||
'name_local': 'español de Mexico', | |||||
}, | |||||
'es-ni': { | |||||
'bidi': False, | |||||
'code': 'es-ni', | |||||
'name': 'Nicaraguan Spanish', | |||||
'name_local': 'español de Nicaragua', | |||||
}, | |||||
'es-ve': { | |||||
'bidi': False, | |||||
'code': 'es-ve', | |||||
'name': 'Venezuelan Spanish', | |||||
'name_local': 'español de Venezuela', | |||||
}, | |||||
'et': { | |||||
'bidi': False, | |||||
'code': 'et', | |||||
'name': 'Estonian', | |||||
'name_local': 'eesti', | |||||
}, | |||||
'eu': { | |||||
'bidi': False, | |||||
'code': 'eu', | |||||
'name': 'Basque', | |||||
'name_local': 'Basque', | |||||
}, | |||||
'fa': { | |||||
'bidi': True, | |||||
'code': 'fa', | |||||
'name': 'Persian', | |||||
'name_local': 'فارسی', | |||||
}, | |||||
'fi': { | |||||
'bidi': False, | |||||
'code': 'fi', | |||||
'name': 'Finnish', | |||||
'name_local': 'suomi', | |||||
}, | |||||
'fr': { | |||||
'bidi': False, | |||||
'code': 'fr', | |||||
'name': 'French', | |||||
'name_local': 'français', | |||||
}, | |||||
'fy': { | |||||
'bidi': False, | |||||
'code': 'fy', | |||||
'name': 'Frisian', | |||||
'name_local': 'frysk', | |||||
}, | |||||
'ga': { | |||||
'bidi': False, | |||||
'code': 'ga', | |||||
'name': 'Irish', | |||||
'name_local': 'Gaeilge', | |||||
}, | |||||
'gd': { | |||||
'bidi': False, | |||||
'code': 'gd', | |||||
'name': 'Scottish Gaelic', | |||||
'name_local': 'Gàidhlig', | |||||
}, | |||||
'gl': { | |||||
'bidi': False, | |||||
'code': 'gl', | |||||
'name': 'Galician', | |||||
'name_local': 'galego', | |||||
}, | |||||
'he': { | |||||
'bidi': True, | |||||
'code': 'he', | |||||
'name': 'Hebrew', | |||||
'name_local': 'עברית', | |||||
}, | |||||
'hi': { | |||||
'bidi': False, | |||||
'code': 'hi', | |||||
'name': 'Hindi', | |||||
'name_local': 'Hindi', | |||||
}, | |||||
'hr': { | |||||
'bidi': False, | |||||
'code': 'hr', | |||||
'name': 'Croatian', | |||||
'name_local': 'Hrvatski', | |||||
}, | |||||
'hu': { | |||||
'bidi': False, | |||||
'code': 'hu', | |||||
'name': 'Hungarian', | |||||
'name_local': 'Magyar', | |||||
}, | |||||
'ia': { | |||||
'bidi': False, | |||||
'code': 'ia', | |||||
'name': 'Interlingua', | |||||
'name_local': 'Interlingua', | |||||
}, | |||||
'io': { | |||||
'bidi': False, | |||||
'code': 'io', | |||||
'name': 'Ido', | |||||
'name_local': 'ido', | |||||
}, | |||||
'id': { | |||||
'bidi': False, | |||||
'code': 'id', | |||||
'name': 'Indonesian', | |||||
'name_local': 'Bahasa Indonesia', | |||||
}, | |||||
'is': { | |||||
'bidi': False, | |||||
'code': 'is', | |||||
'name': 'Icelandic', | |||||
'name_local': 'Íslenska', | |||||
}, | |||||
'it': { | |||||
'bidi': False, | |||||
'code': 'it', | |||||
'name': 'Italian', | |||||
'name_local': 'italiano', | |||||
}, | |||||
'ja': { | |||||
'bidi': False, | |||||
'code': 'ja', | |||||
'name': 'Japanese', | |||||
'name_local': '日本語', | |||||
}, | |||||
'ka': { | |||||
'bidi': False, | |||||
'code': 'ka', | |||||
'name': 'Georgian', | |||||
'name_local': 'ქართული', | |||||
}, | |||||
'kk': { | |||||
'bidi': False, | |||||
'code': 'kk', | |||||
'name': 'Kazakh', | |||||
'name_local': 'Қазақ', | |||||
}, | |||||
'km': { | |||||
'bidi': False, | |||||
'code': 'km', | |||||
'name': 'Khmer', | |||||
'name_local': 'Khmer', | |||||
}, | |||||
'kn': { | |||||
'bidi': False, | |||||
'code': 'kn', | |||||
'name': 'Kannada', | |||||
'name_local': 'Kannada', | |||||
}, | |||||
'ko': { | |||||
'bidi': False, | |||||
'code': 'ko', | |||||
'name': 'Korean', | |||||
'name_local': '한국어', | |||||
}, | |||||
'lb': { | |||||
'bidi': False, | |||||
'code': 'lb', | |||||
'name': 'Luxembourgish', | |||||
'name_local': 'Lëtzebuergesch', | |||||
}, | |||||
'lt': { | |||||
'bidi': False, | |||||
'code': 'lt', | |||||
'name': 'Lithuanian', | |||||
'name_local': 'Lietuviškai', | |||||
}, | |||||
'lv': { | |||||
'bidi': False, | |||||
'code': 'lv', | |||||
'name': 'Latvian', | |||||
'name_local': 'latviešu', | |||||
}, | |||||
'mk': { | |||||
'bidi': False, | |||||
'code': 'mk', | |||||
'name': 'Macedonian', | |||||
'name_local': 'Македонски', | |||||
}, | |||||
'ml': { | |||||
'bidi': False, | |||||
'code': 'ml', | |||||
'name': 'Malayalam', | |||||
'name_local': 'Malayalam', | |||||
}, | |||||
'mn': { | |||||
'bidi': False, | |||||
'code': 'mn', | |||||
'name': 'Mongolian', | |||||
'name_local': 'Mongolian', | |||||
}, | |||||
'mr': { | |||||
'bidi': False, | |||||
'code': 'mr', | |||||
'name': 'Marathi', | |||||
'name_local': 'मराठी', | |||||
}, | |||||
'my': { | |||||
'bidi': False, | |||||
'code': 'my', | |||||
'name': 'Burmese', | |||||
'name_local': 'မြန်မာဘာသာ', | |||||
}, | |||||
'nb': { | |||||
'bidi': False, | |||||
'code': 'nb', | |||||
'name': 'Norwegian Bokmal', | |||||
'name_local': 'norsk (bokmål)', | |||||
}, | |||||
'ne': { | |||||
'bidi': False, | |||||
'code': 'ne', | |||||
'name': 'Nepali', | |||||
'name_local': 'नेपाली', | |||||
}, | |||||
'nl': { | |||||
'bidi': False, | |||||
'code': 'nl', | |||||
'name': 'Dutch', | |||||
'name_local': 'Nederlands', | |||||
}, | |||||
'nn': { | |||||
'bidi': False, | |||||
'code': 'nn', | |||||
'name': 'Norwegian Nynorsk', | |||||
'name_local': 'norsk (nynorsk)', | |||||
}, | |||||
'no': { | |||||
'bidi': False, | |||||
'code': 'no', | |||||
'name': 'Norwegian', | |||||
'name_local': 'norsk', | |||||
}, | |||||
'os': { | |||||
'bidi': False, | |||||
'code': 'os', | |||||
'name': 'Ossetic', | |||||
'name_local': 'Ирон', | |||||
}, | |||||
'pa': { | |||||
'bidi': False, | |||||
'code': 'pa', | |||||
'name': 'Punjabi', | |||||
'name_local': 'Punjabi', | |||||
}, | |||||
'pl': { | |||||
'bidi': False, | |||||
'code': 'pl', | |||||
'name': 'Polish', | |||||
'name_local': 'polski', | |||||
}, | |||||
'pt': { | |||||
'bidi': False, | |||||
'code': 'pt', | |||||
'name': 'Portuguese', | |||||
'name_local': 'Português', | |||||
}, | |||||
'pt-br': { | |||||
'bidi': False, | |||||
'code': 'pt-br', | |||||
'name': 'Brazilian Portuguese', | |||||
'name_local': 'Português Brasileiro', | |||||
}, | |||||
'ro': { | |||||
'bidi': False, | |||||
'code': 'ro', | |||||
'name': 'Romanian', | |||||
'name_local': 'Română', | |||||
}, | |||||
'ru': { | |||||
'bidi': False, | |||||
'code': 'ru', | |||||
'name': 'Russian', | |||||
'name_local': 'Русский', | |||||
}, | |||||
'sk': { | |||||
'bidi': False, | |||||
'code': 'sk', | |||||
'name': 'Slovak', | |||||
'name_local': 'Slovensky', | |||||
}, | |||||
'sl': { | |||||
'bidi': False, | |||||
'code': 'sl', | |||||
'name': 'Slovenian', | |||||
'name_local': 'Slovenščina', | |||||
}, | |||||
'sq': { | |||||
'bidi': False, | |||||
'code': 'sq', | |||||
'name': 'Albanian', | |||||
'name_local': 'shqip', | |||||
}, | |||||
'sr': { | |||||
'bidi': False, | |||||
'code': 'sr', | |||||
'name': 'Serbian', | |||||
'name_local': 'српски', | |||||
}, | |||||
'sr-latn': { | |||||
'bidi': False, | |||||
'code': 'sr-latn', | |||||
'name': 'Serbian Latin', | |||||
'name_local': 'srpski (latinica)', | |||||
}, | |||||
'sv': { | |||||
'bidi': False, | |||||
'code': 'sv', | |||||
'name': 'Swedish', | |||||
'name_local': 'svenska', | |||||
}, | |||||
'sw': { | |||||
'bidi': False, | |||||
'code': 'sw', | |||||
'name': 'Swahili', | |||||
'name_local': 'Kiswahili', | |||||
}, | |||||
'ta': { | |||||
'bidi': False, | |||||
'code': 'ta', | |||||
'name': 'Tamil', | |||||
'name_local': 'தமிழ்', | |||||
}, | |||||
'te': { | |||||
'bidi': False, | |||||
'code': 'te', | |||||
'name': 'Telugu', | |||||
'name_local': 'తెలుగు', | |||||
}, | |||||
'th': { | |||||
'bidi': False, | |||||
'code': 'th', | |||||
'name': 'Thai', | |||||
'name_local': 'ภาษาไทย', | |||||
}, | |||||
'tr': { | |||||
'bidi': False, | |||||
'code': 'tr', | |||||
'name': 'Turkish', | |||||
'name_local': 'Türkçe', | |||||
}, | |||||
'tt': { | |||||
'bidi': False, | |||||
'code': 'tt', | |||||
'name': 'Tatar', | |||||
'name_local': 'Татарча', | |||||
}, | |||||
'udm': { | |||||
'bidi': False, | |||||
'code': 'udm', | |||||
'name': 'Udmurt', | |||||
'name_local': 'Удмурт', | |||||
}, | |||||
'uk': { | |||||
'bidi': False, | |||||
'code': 'uk', | |||||
'name': 'Ukrainian', | |||||
'name_local': 'Українська', | |||||
}, | |||||
'ur': { | |||||
'bidi': True, | |||||
'code': 'ur', | |||||
'name': 'Urdu', | |||||
'name_local': 'اردو', | |||||
}, | |||||
'vi': { | |||||
'bidi': False, | |||||
'code': 'vi', | |||||
'name': 'Vietnamese', | |||||
'name_local': 'Tiếng Việt', | |||||
}, | |||||
'zh-cn': { | |||||
'fallback': ['zh-hans'], | |||||
}, | |||||
'zh-hans': { | |||||
'bidi': False, | |||||
'code': 'zh-hans', | |||||
'name': 'Simplified Chinese', | |||||
'name_local': '简体中文', | |||||
}, | |||||
'zh-hant': { | |||||
'bidi': False, | |||||
'code': 'zh-hant', | |||||
'name': 'Traditional Chinese', | |||||
'name_local': '繁體中文', | |||||
}, | |||||
'zh-hk': { | |||||
'fallback': ['zh-hant'], | |||||
}, | |||||
'zh-mo': { | |||||
'fallback': ['zh-hant'], | |||||
}, | |||||
'zh-my': { | |||||
'fallback': ['zh-hans'], | |||||
}, | |||||
'zh-sg': { | |||||
'fallback': ['zh-hans'], | |||||
}, | |||||
'zh-tw': { | |||||
'fallback': ['zh-hant'], | |||||
}, | |||||
} |
@@ -0,0 +1,24 @@ | |||||
# -*- encoding: utf-8 -*- | |||||
# This file is distributed under the same license as the Django package. | |||||
# | |||||
from __future__ import unicode_literals | |||||
# The *_FORMAT strings use the Django date format syntax, | |||||
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date | |||||
DATE_FORMAT = 'j F، Y' | |||||
TIME_FORMAT = 'g:i A' | |||||
# DATETIME_FORMAT = | |||||
YEAR_MONTH_FORMAT = 'F Y' | |||||
MONTH_DAY_FORMAT = 'j F' | |||||
SHORT_DATE_FORMAT = 'd/m/Y' | |||||
# SHORT_DATETIME_FORMAT = | |||||
# FIRST_DAY_OF_WEEK = | |||||
# The *_INPUT_FORMATS strings use the Python strftime format syntax, | |||||
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior | |||||
# DATE_INPUT_FORMATS = | |||||
# TIME_INPUT_FORMATS = | |||||
# DATETIME_INPUT_FORMATS = | |||||
DECIMAL_SEPARATOR = ',' | |||||
THOUSAND_SEPARATOR = '.' | |||||
# NUMBER_GROUPING = |
@@ -0,0 +1,35 @@ | |||||
# -*- encoding: utf-8 -*- | |||||
# This file is distributed under the same license as the Django package. | |||||
# | |||||
from __future__ import unicode_literals | |||||
# The *_FORMAT strings use the Django date format syntax, | |||||
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date | |||||
DATE_FORMAT = 'j E Y г.' | |||||
TIME_FORMAT = 'G:i' | |||||
DATETIME_FORMAT = 'j E Y г. G:i' | |||||
YEAR_MONTH_FORMAT = 'F Y г.' | |||||
MONTH_DAY_FORMAT = 'j F' | |||||
SHORT_DATE_FORMAT = 'd.m.Y' | |||||
SHORT_DATETIME_FORMAT = 'd.m.Y H:i' | |||||
FIRST_DAY_OF_WEEK = 1 # Monday | |||||
# The *_INPUT_FORMATS strings use the Python strftime format syntax, | |||||
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior | |||||
DATE_INPUT_FORMATS = [ | |||||
'%d.%m.%Y', # '25.10.2006' | |||||
'%d.%m.%y', # '25.10.06' | |||||
] | |||||
DATETIME_INPUT_FORMATS = [ | |||||
'%d.%m.%Y %H:%M:%S', # '25.10.2006 14:30:59' | |||||
'%d.%m.%Y %H:%M:%S.%f', # '25.10.2006 14:30:59.000200' | |||||
'%d.%m.%Y %H:%M', # '25.10.2006 14:30' | |||||
'%d.%m.%Y', # '25.10.2006' | |||||
'%d.%m.%y %H:%M:%S', # '25.10.06 14:30:59' | |||||
'%d.%m.%y %H:%M:%S.%f', # '25.10.06 14:30:59.000200' | |||||
'%d.%m.%y %H:%M', # '25.10.06 14:30' | |||||
'%d.%m.%y', # '25.10.06' | |||||
] | |||||
DECIMAL_SEPARATOR = ',' | |||||
THOUSAND_SEPARATOR = '\xa0' # non-breaking space | |||||
NUMBER_GROUPING = 3 |
@@ -0,0 +1,24 @@ | |||||
# -*- encoding: utf-8 -*- | |||||
# This file is distributed under the same license as the Django package. | |||||
# | |||||
from __future__ import unicode_literals | |||||
# The *_FORMAT strings use the Django date format syntax, | |||||
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date | |||||
DATE_FORMAT = 'd F Y' | |||||
TIME_FORMAT = 'H:i' | |||||
# DATETIME_FORMAT = | |||||
# YEAR_MONTH_FORMAT = | |||||
MONTH_DAY_FORMAT = 'j F' | |||||
SHORT_DATE_FORMAT = 'd.m.Y' | |||||
# SHORT_DATETIME_FORMAT = | |||||
# FIRST_DAY_OF_WEEK = | |||||
# The *_INPUT_FORMATS strings use the Python strftime format syntax, | |||||
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior | |||||
# DATE_INPUT_FORMATS = | |||||
# TIME_INPUT_FORMATS = | |||||
# DATETIME_INPUT_FORMATS = | |||||
DECIMAL_SEPARATOR = ',' | |||||
THOUSAND_SEPARATOR = ' ' # Non-breaking space | |||||
# NUMBER_GROUPING = |
@@ -0,0 +1,24 @@ | |||||
# -*- encoding: utf-8 -*- | |||||
# This file is distributed under the same license as the Django package. | |||||
# | |||||
from __future__ import unicode_literals | |||||
# The *_FORMAT strings use the Django date format syntax, | |||||
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date | |||||
DATE_FORMAT = 'j F, Y' | |||||
TIME_FORMAT = 'g:i A' | |||||
# DATETIME_FORMAT = | |||||
YEAR_MONTH_FORMAT = 'F Y' | |||||
MONTH_DAY_FORMAT = 'j F' | |||||
SHORT_DATE_FORMAT = 'j M, Y' | |||||
# SHORT_DATETIME_FORMAT = | |||||
# FIRST_DAY_OF_WEEK = | |||||
# The *_INPUT_FORMATS strings use the Python strftime format syntax, | |||||
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior | |||||
# DATE_INPUT_FORMATS = | |||||
# TIME_INPUT_FORMATS = | |||||
# DATETIME_INPUT_FORMATS = | |||||
DECIMAL_SEPARATOR = '.' | |||||
THOUSAND_SEPARATOR = ',' | |||||
# NUMBER_GROUPING = |