mirror of
https://github.com/django/django.git
synced 2025-07-04 17:59:13 +00:00
Merged to trunk r985
git-svn-id: http://code.djangoproject.com/svn/django/branches/new-admin@987 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
commit
3bcc7ea82e
@ -299,7 +299,7 @@ def init():
|
|||||||
cursor = db.db.cursor()
|
cursor = db.db.cursor()
|
||||||
for sql in get_sql_create(core) + get_sql_create(auth) + get_sql_initial_data(core) + get_sql_initial_data(auth):
|
for sql in get_sql_create(core) + get_sql_create(auth) + get_sql_initial_data(core) + get_sql_initial_data(auth):
|
||||||
cursor.execute(sql)
|
cursor.execute(sql)
|
||||||
cursor.execute("INSERT INTO %s (domain, name) VALUES ('mysite.com', 'My Django site')" % core.Site._meta.db_table)
|
cursor.execute("INSERT INTO %s (domain, name) VALUES ('example.com', 'Example site')" % core.Site._meta.db_table)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
sys.stderr.write("Error: The database couldn't be initialized.\n%s\n" % e)
|
sys.stderr.write("Error: The database couldn't be initialized.\n%s\n" % e)
|
||||||
try:
|
try:
|
||||||
|
@ -55,10 +55,7 @@ class LoaderOrigin(Origin):
|
|||||||
def find_template_source(name, dirs=None):
|
def find_template_source(name, dirs=None):
|
||||||
for loader in template_source_loaders:
|
for loader in template_source_loaders:
|
||||||
try:
|
try:
|
||||||
source, display_name = loader(name, dirs)
|
source, display_name = loader(name, dirs)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return (source, LoaderOrigin(display_name, loader, name, dirs))
|
return (source, LoaderOrigin(display_name, loader, name, dirs))
|
||||||
except TemplateDoesNotExist:
|
except TemplateDoesNotExist:
|
||||||
pass
|
pass
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# Wrapper for loading templates from "template" directories in installed app packages.
|
# Wrapper for loading templates from "template" directories in installed app packages.
|
||||||
|
|
||||||
from django.conf.settings import INSTALLED_APPS, TEMPLATE_FILE_EXTENSION
|
from django.conf.settings import INSTALLED_APPS, TEMPLATE_FILE_EXTENSION
|
||||||
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
from django.core.template import TemplateDoesNotExist
|
from django.core.template import TemplateDoesNotExist
|
||||||
import os
|
import os
|
||||||
|
|
||||||
@ -8,8 +9,17 @@ import os
|
|||||||
app_template_dirs = []
|
app_template_dirs = []
|
||||||
for app in INSTALLED_APPS:
|
for app in INSTALLED_APPS:
|
||||||
i = app.rfind('.')
|
i = app.rfind('.')
|
||||||
m, a = app[:i], app[i+1:]
|
if i == -1:
|
||||||
mod = getattr(__import__(m, '', '', [a]), a)
|
m, a = app, None
|
||||||
|
else:
|
||||||
|
m, a = app[:i], app[i+1:]
|
||||||
|
try:
|
||||||
|
if a is None:
|
||||||
|
mod = __import__(m, '', '', [])
|
||||||
|
else:
|
||||||
|
mod = getattr(__import__(m, '', '', [a]), a)
|
||||||
|
except ImportError, e:
|
||||||
|
raise ImproperlyConfigured, 'ImportError %s: %s' % (app, e.args[0])
|
||||||
template_dir = os.path.join(os.path.dirname(mod.__file__), 'templates')
|
template_dir = os.path.join(os.path.dirname(mod.__file__), 'templates')
|
||||||
if os.path.isdir(template_dir):
|
if os.path.isdir(template_dir):
|
||||||
app_template_dirs.append(template_dir)
|
app_template_dirs.append(template_dir)
|
||||||
|
@ -610,6 +610,11 @@ Built-in tag reference
|
|||||||
|
|
||||||
{% ssi /home/html/ljworld.com/includes/right_generic.html parsed %}
|
{% ssi /home/html/ljworld.com/includes/right_generic.html parsed %}
|
||||||
|
|
||||||
|
Note that if you use ``{% ssi %}``, you'll need to define
|
||||||
|
`ALLOWED_INCLUDE_ROOTS`_ in your Django settings, as a security measure.
|
||||||
|
|
||||||
|
.. _ALLOWED_INCLUDE_ROOTS: http://www.djangoproject.com/documentation/settings/#allowed-include-roots
|
||||||
|
|
||||||
``templatetag``
|
``templatetag``
|
||||||
Output one of the bits used to compose template tags.
|
Output one of the bits used to compose template tags.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user