settings.rst 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638
  1. ==============================
  2. Configuring Django for Wagtail
  3. ==============================
  4. To install Wagtail completely from scratch, create a new Django project and an app within that project. For instructions on these tasks, see `Writing your first Django app <https://docs.djangoproject.com/en/dev/intro/tutorial01/>`_. Your project directory will look like the following::
  5. myproject/
  6. myproject/
  7. __init__.py
  8. settings.py
  9. urls.py
  10. wsgi.py
  11. myapp/
  12. __init__.py
  13. models.py
  14. tests.py
  15. admin.py
  16. views.py
  17. manage.py
  18. From your app directory, you can safely remove ``admin.py`` and ``views.py``, since Wagtail will provide this functionality for your models. Configuring Django to load Wagtail involves adding modules and variables to ``settings.py`` and URL configuration to ``urls.py``. For a more complete view of what's defined in these files, see `Django Settings <https://docs.djangoproject.com/en/dev/topics/settings/>`__ and `Django URL Dispatcher <https://docs.djangoproject.com/en/dev/topics/http/urls/>`_.
  19. What follows is a settings reference which skips many boilerplate Django settings. If you just want to get your Wagtail install up quickly without fussing with settings at the moment, see :ref:`complete_example_config`.
  20. Middleware (``settings.py``)
  21. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  22. .. code-block:: python
  23. MIDDLEWARE_CLASSES = [
  24. 'django.contrib.sessions.middleware.SessionMiddleware',
  25. 'django.middleware.common.CommonMiddleware',
  26. 'django.middleware.csrf.CsrfViewMiddleware',
  27. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  28. 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
  29. 'django.contrib.messages.middleware.MessageMiddleware',
  30. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  31. 'django.middleware.security.SecurityMiddleware',
  32. 'wagtail.wagtailcore.middleware.SiteMiddleware',
  33. 'wagtail.wagtailredirects.middleware.RedirectMiddleware',
  34. ]
  35. Wagtail requires several common Django middleware modules to work and cover basic security. Wagtail provides its own middleware to cover these tasks:
  36. ``SiteMiddleware``
  37. Wagtail routes pre-defined hosts to pages within the Wagtail tree using this middleware.
  38. ``RedirectMiddleware``
  39. Wagtail provides a simple interface for adding arbitrary redirects to your site and this module makes it happen.
  40. Apps (``settings.py``)
  41. ~~~~~~~~~~~~~~~~~~~~~~
  42. .. code-block:: python
  43. INSTALLED_APPS = [
  44. 'myapp', # your own app
  45. 'wagtail.wagtailforms',
  46. 'wagtail.wagtailredirects',
  47. 'wagtail.wagtailembeds',
  48. 'wagtail.wagtailsites',
  49. 'wagtail.wagtailusers',
  50. 'wagtail.wagtailsnippets',
  51. 'wagtail.wagtaildocs',
  52. 'wagtail.wagtailimages',
  53. 'wagtail.wagtailsearch',
  54. 'wagtail.wagtailadmin',
  55. 'wagtail.wagtailcore',
  56. 'taggit',
  57. 'modelcluster',
  58. 'django.contrib.auth',
  59. 'django.contrib.contenttypes',
  60. 'django.contrib.sessions',
  61. 'django.contrib.messages',
  62. 'django.contrib.staticfiles',
  63. ]
  64. Wagtail requires several Django app modules, third-party apps, and defines several apps of its own. Wagtail was built to be modular, so many Wagtail apps can be omitted to suit your needs. Your own app (here ``myapp``) is where you define your models, templates, static assets, template tags, and other custom functionality for your site.
  65. Wagtail Apps
  66. ------------
  67. ``wagtailcore``
  68. The core functionality of Wagtail, such as the ``Page`` class, the Wagtail tree, and model fields.
  69. ``wagtailadmin``
  70. The administration interface for Wagtail, including page edit handlers.
  71. ``wagtaildocs``
  72. The Wagtail document content type.
  73. ``wagtailsnippets``
  74. Editing interface for non-Page models and objects. See :ref:`Snippets`.
  75. ``wagtailusers``
  76. User editing interface.
  77. ``wagtailimages``
  78. The Wagtail image content type.
  79. ``wagtailembeds``
  80. Module governing oEmbed and Embedly content in Wagtail rich text fields. See :ref:`inserting_videos`.
  81. ``wagtailsearch``
  82. Search framework for Page content. See :ref:`search`.
  83. ``wagtailredirects``
  84. Admin interface for creating arbitrary redirects on your site.
  85. ``wagtailforms``
  86. Models for creating forms on your pages and viewing submissions. See :ref:`form_builder`.
  87. Third-Party Apps
  88. ----------------
  89. ``taggit``
  90. Tagging framework for Django. This is used internally within Wagtail for image and document tagging and is available for your own models as well. See :ref:`tagging` for a Wagtail model recipe or the `Taggit Documentation`_.
  91. .. _Taggit Documentation: http://django-taggit.readthedocs.org/en/latest/index.html
  92. ``modelcluster``
  93. Extension of Django ForeignKey relation functionality, which is used in Wagtail pages for on-the-fly related object creation. For more information, see :ref:`inline_panels` or `the django-modelcluster github project page`_.
  94. .. _the django-modelcluster github project page: https://github.com/torchbox/django-modelcluster
  95. Settings Variables (``settings.py``)
  96. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  97. Wagtail makes use of the following settings, in addition to `Django's core settings <https://docs.djangoproject.com/en/dev/ref/settings/>`__:
  98. Site Name
  99. ---------
  100. .. code-block:: python
  101. WAGTAIL_SITE_NAME = 'Stark Industries Skunkworks'
  102. This is the human-readable name of your Wagtail install which welcomes users upon login to the Wagtail admin.
  103. .. _append_slash:
  104. Append Slash
  105. ------------
  106. .. code-block:: python
  107. # Don't add a trailing slash to Wagtail-served URLs
  108. WAGTAIL_APPEND_SLASH = False
  109. Similar to Django's ``APPEND_SLASH``, this setting controls how Wagtail will handle requests that don't end in a trailing slash.
  110. When ``WAGTAIL_APPEND_SLASH`` is ``True`` (default), requests to Wagtail pages which omit a trailing slash will be redirected by Django's `CommonMiddleware`_ to a URL with a trailing slash.
  111. When ``WAGTAIL_APPEND_SLASH`` is ``False``, requests to Wagtail pages will be served both with and without trailing slashes. Page links generated by Wagtail, however, will not include trailing slashes.
  112. .. note::
  113. If you use the ``False`` setting, keep in mind that serving your pages both with and without slashes may affect search engines' ability to index your site. See `this Google Webmaster Blog post`_ for more details.
  114. .. _commonmiddleware: https://docs.djangoproject.com/en/dev/ref/middleware/#module-django.middleware.common
  115. .. _this Google Webmaster Blog post: https://webmasters.googleblog.com/2010/04/to-slash-or-not-to-slash.html
  116. Search
  117. ------
  118. .. code-block:: python
  119. # Override the search results template for wagtailsearch
  120. WAGTAILSEARCH_RESULTS_TEMPLATE = 'myapp/search_results.html'
  121. WAGTAILSEARCH_RESULTS_TEMPLATE_AJAX = 'myapp/includes/search_listing.html'
  122. # Replace the search backend
  123. WAGTAILSEARCH_BACKENDS = {
  124. 'default': {
  125. 'BACKEND': 'wagtail.wagtailsearch.backends.elasticsearch2',
  126. 'INDEX': 'myapp'
  127. }
  128. }
  129. The search settings customise the search results templates as well as choosing a custom backend for search. For a full explanation, see :ref:`search`.
  130. Embeds
  131. ------
  132. Wagtail uses the oEmbed standard with a large but not comprehensive number of "providers" (Youtube, Vimeo, etc.). You can also use a different embed backend by providing an Embedly key or replacing the embed backend by writing your own embed finder function.
  133. .. code-block:: python
  134. WAGTAILEMBEDS_EMBED_FINDER = 'myapp.embeds.my_embed_finder_function'
  135. Use a custom embed finder function, which takes a URL and returns a dict with metadata and embeddable HTML. Refer to the ``wagtail.wagtailemebds.embeds`` module source for more information and examples.
  136. .. code-block:: python
  137. # not a working key, get your own!
  138. WAGTAILEMBEDS_EMBEDLY_KEY = '253e433d59dc4d2xa266e9e0de0cb830'
  139. Providing an API key for the Embedly service will use that as a embed backend, with a more extensive list of providers, as well as analytics and other features. For more information, see `Embedly`_.
  140. .. _Embedly: http://embed.ly/
  141. To use Embedly, you must also install their Python module:
  142. .. code-block:: sh
  143. pip install embedly
  144. Images
  145. ------
  146. .. code-block:: python
  147. WAGTAILIMAGES_IMAGE_MODEL = 'myapp.MyImage'
  148. This setting lets you provide your own image model for use in Wagtail, which might extend the built-in ``AbstractImage`` class or replace it entirely.
  149. Maximum Upload size for Images
  150. ------------------------------
  151. .. code-block:: python
  152. WAGTAILIMAGES_MAX_UPLOAD_SIZE = 20 * 1024 * 1024 # i.e. 20MB
  153. This setting lets you override the maximum upload size for images (in bytes). If omitted, Wagtail will fall back to using its 10MB default value.
  154. Password Management
  155. -------------------
  156. .. code-block:: python
  157. WAGTAIL_PASSWORD_MANAGEMENT_ENABLED = True
  158. This specifies whether users are allowed to change their passwords (enabled by default).
  159. .. code-block:: python
  160. WAGTAIL_PASSWORD_RESET_ENABLED = True
  161. This specifies whether users are allowed to reset their passwords. Defaults to the same as ``WAGTAIL_PASSWORD_MANAGEMENT_ENABLED``.
  162. Email Notifications
  163. -------------------
  164. .. code-block:: python
  165. WAGTAILADMIN_NOTIFICATION_FROM_EMAIL = 'wagtail@myhost.io'
  166. Wagtail sends email notifications when content is submitted for moderation, and when the content is accepted or rejected. This setting lets you pick which email address these automatic notifications will come from. If omitted, Django will fall back to using the ``DEFAULT_FROM_EMAIL`` variable if set, and ``webmaster@localhost`` if not.
  167. .. _email_notifications_format:
  168. Email Notifications format
  169. --------------------------
  170. .. code-block:: python
  171. WAGTAILADMIN_NOTIFICATION_USE_HTML = True
  172. Notification emails are sent in `text/plain` by default, change this to use HTML formatting.
  173. .. _update_notifications:
  174. Wagtail update notifications
  175. ----------------------------
  176. .. code-block:: python
  177. WAGTAIL_ENABLE_UPDATE_CHECK = True
  178. For admins only, Wagtail performs a check on the dashboard to see if newer releases are available. This also provides the Wagtail team with the hostname of your Wagtail site. If you'd rather not receive update notifications, or if you'd like your site to remain unknown, you can disable it with this setting.
  179. Private Pages
  180. -------------
  181. .. code-block:: python
  182. PASSWORD_REQUIRED_TEMPLATE = 'myapp/password_required.html'
  183. This is the path to the Django template which will be used to display the "password required" form when a user accesses a private page. For more details, see the :ref:`private_pages` documentation.
  184. Case-Insensitive Tags
  185. ---------------------
  186. .. code-block:: python
  187. TAGGIT_CASE_INSENSITIVE = True
  188. Tags are case-sensitive by default ('music' and 'Music' are treated as distinct tags). In many cases the reverse behaviour is preferable.
  189. Unicode Page Slugs
  190. ------------------
  191. .. code-block:: python
  192. WAGTAIL_ALLOW_UNICODE_SLUGS = True
  193. By default, page slugs can contain any alphanumeric characters, including non-Latin alphabets (except on Django 1.8, where only ASCII characters are supported). Set this to False to limit slugs to ASCII characters.
  194. Custom User Edit Forms
  195. ----------------------
  196. See :doc:`/advanced_topics/customisation/custom_user_models`.
  197. .. code-block:: python
  198. WAGTAIL_USER_EDIT_FORM = 'users.forms.CustomUserEditForm'
  199. Allows the default ``UserEditForm`` class to be overridden with a custom form when
  200. a custom user model is being used and extra fields are required in the user edit form.
  201. .. code-block:: python
  202. WAGTAIL_USER_CREATION_FORM = 'users.forms.CustomUserCreationForm'
  203. Allows the default ``UserCreationForm`` class to be overridden with a custom form when
  204. a custom user model is being used and extra fields are required in the user creation form.
  205. .. code-block:: python
  206. WAGTAIL_USER_CUSTOM_FIELDS = ['country']
  207. A list of the extra custom fields to be appended to the default list.
  208. Usage for images, documents and snippets
  209. ----------------------------------------
  210. .. code-block:: python
  211. WAGTAIL_USAGE_COUNT_ENABLED = True
  212. When enabled Wagtail shows where a particular image, document or snippet is being used on your site (disabled by default). A link will appear on the edit page showing you which pages they have been used on.
  213. .. note::
  214. The usage count only applies to direct (database) references. Using documents, images and snippets within StreamFields or rich text fields will not be taken into account.
  215. URL Patterns
  216. ~~~~~~~~~~~~
  217. .. code-block:: python
  218. from django.contrib import admin
  219. from wagtail.wagtailcore import urls as wagtail_urls
  220. from wagtail.wagtailadmin import urls as wagtailadmin_urls
  221. from wagtail.wagtaildocs import urls as wagtaildocs_urls
  222. from wagtail.wagtailsearch import urls as wagtailsearch_urls
  223. urlpatterns = [
  224. url(r'^django-admin/', include(admin.site.urls)),
  225. url(r'^admin/', include(wagtailadmin_urls)),
  226. url(r'^search/', include(wagtailsearch_urls)),
  227. url(r'^documents/', include(wagtaildocs_urls)),
  228. # Optional URL for including your own vanilla Django urls/views
  229. url(r'', include('myapp.urls')),
  230. # For anything not caught by a more specific rule above, hand over to
  231. # Wagtail's serving mechanism
  232. url(r'', include(wagtail_urls)),
  233. ]
  234. This block of code for your project's ``urls.py`` does a few things:
  235. * Load the vanilla Django admin interface to ``/django-admin/``
  236. * Load the Wagtail admin and its various apps
  237. * Dispatch any vanilla Django apps you're using other than Wagtail which require their own URL configuration (this is optional, since Wagtail might be all you need)
  238. * Lets Wagtail handle any further URL dispatching.
  239. That's not everything you might want to include in your project's URL configuration, but it's what's necessary for Wagtail to flourish.
  240. .. _complete_example_config:
  241. Ready to Use Example Configuration Files
  242. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  243. These two files should reside in your project directory (``myproject/myproject/``).
  244. ``settings.py``
  245. ---------------
  246. .. code-block:: python
  247. import os
  248. PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  249. BASE_DIR = os.path.dirname(PROJECT_DIR)
  250. DEBUG = True
  251. # Application definition
  252. INSTALLED_APPS = [
  253. 'myapp',
  254. 'wagtail.wagtailforms',
  255. 'wagtail.wagtailredirects',
  256. 'wagtail.wagtailembeds',
  257. 'wagtail.wagtailsites',
  258. 'wagtail.wagtailusers',
  259. 'wagtail.wagtailsnippets',
  260. 'wagtail.wagtaildocs',
  261. 'wagtail.wagtailimages',
  262. 'wagtail.wagtailsearch',
  263. 'wagtail.wagtailadmin',
  264. 'wagtail.wagtailcore',
  265. 'taggit',
  266. 'modelcluster',
  267. 'django.contrib.auth',
  268. 'django.contrib.contenttypes',
  269. 'django.contrib.sessions',
  270. 'django.contrib.messages',
  271. 'django.contrib.staticfiles',
  272. ]
  273. MIDDLEWARE_CLASSES = [
  274. 'django.contrib.sessions.middleware.SessionMiddleware',
  275. 'django.middleware.common.CommonMiddleware',
  276. 'django.middleware.csrf.CsrfViewMiddleware',
  277. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  278. 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
  279. 'django.contrib.messages.middleware.MessageMiddleware',
  280. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  281. 'django.middleware.security.SecurityMiddleware',
  282. 'wagtail.wagtailcore.middleware.SiteMiddleware',
  283. 'wagtail.wagtailredirects.middleware.RedirectMiddleware',
  284. ]
  285. ROOT_URLCONF = 'myproject.urls'
  286. TEMPLATES = [
  287. {
  288. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  289. 'DIRS': [
  290. os.path.join(PROJECT_DIR, 'templates'),
  291. ],
  292. 'APP_DIRS': True,
  293. 'OPTIONS': {
  294. 'context_processors': [
  295. 'django.template.context_processors.debug',
  296. 'django.template.context_processors.request',
  297. 'django.contrib.auth.context_processors.auth',
  298. 'django.contrib.messages.context_processors.messages',
  299. ],
  300. },
  301. },
  302. ]
  303. WSGI_APPLICATION = 'wagtaildemo.wsgi.application'
  304. # Database
  305. DATABASES = {
  306. 'default': {
  307. 'ENGINE': 'django.db.backends.postgresql_psycopg2',
  308. 'NAME': 'myprojectdb',
  309. 'USER': 'postgres',
  310. 'PASSWORD': '',
  311. 'HOST': '', # Set to empty string for localhost.
  312. 'PORT': '', # Set to empty string for default.
  313. 'CONN_MAX_AGE': 600, # number of seconds database connections should persist for
  314. }
  315. }
  316. # Internationalization
  317. LANGUAGE_CODE = 'en-us'
  318. TIME_ZONE = 'UTC'
  319. USE_I18N = True
  320. USE_L10N = True
  321. USE_TZ = True
  322. # Static files (CSS, JavaScript, Images)
  323. STATICFILES_FINDERS = [
  324. 'django.contrib.staticfiles.finders.FileSystemFinder',
  325. 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
  326. ]
  327. STATICFILES_DIRS = [
  328. os.path.join(PROJECT_DIR, 'static'),
  329. ]
  330. STATIC_ROOT = os.path.join(BASE_DIR, 'static')
  331. STATIC_URL = '/static/'
  332. MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
  333. MEDIA_URL = '/media/'
  334. ADMINS = [
  335. # ('Your Name', 'your_email@example.com'),
  336. ]
  337. MANAGERS = ADMINS
  338. # Default to dummy email backend. Configure dev/production/local backend
  339. # as per https://docs.djangoproject.com/en/dev/topics/email/#email-backends
  340. EMAIL_BACKEND = 'django.core.mail.backends.dummy.EmailBackend'
  341. # Hosts/domain names that are valid for this site; required if DEBUG is False
  342. ALLOWED_HOSTS = []
  343. # Make this unique, and don't share it with anybody.
  344. SECRET_KEY = 'change-me'
  345. EMAIL_SUBJECT_PREFIX = '[Wagtail] '
  346. INTERNAL_IPS = ('127.0.0.1', '10.0.2.2')
  347. # A sample logging configuration. The only tangible logging
  348. # performed by this configuration is to send an email to
  349. # the site admins on every HTTP 500 error when DEBUG=False.
  350. # See http://docs.djangoproject.com/en/dev/topics/logging for
  351. # more details on how to customize your logging configuration.
  352. LOGGING = {
  353. 'version': 1,
  354. 'disable_existing_loggers': False,
  355. 'filters': {
  356. 'require_debug_false': {
  357. '()': 'django.utils.log.RequireDebugFalse'
  358. }
  359. },
  360. 'handlers': {
  361. 'mail_admins': {
  362. 'level': 'ERROR',
  363. 'filters': ['require_debug_false'],
  364. 'class': 'django.utils.log.AdminEmailHandler'
  365. }
  366. },
  367. 'loggers': {
  368. 'django.request': {
  369. 'handlers': ['mail_admins'],
  370. 'level': 'ERROR',
  371. 'propagate': True,
  372. },
  373. }
  374. }
  375. # WAGTAIL SETTINGS
  376. # This is the human-readable name of your Wagtail install
  377. # which welcomes users upon login to the Wagtail admin.
  378. WAGTAIL_SITE_NAME = 'My Project'
  379. # Override the search results template for wagtailsearch
  380. # WAGTAILSEARCH_RESULTS_TEMPLATE = 'myapp/search_results.html'
  381. # WAGTAILSEARCH_RESULTS_TEMPLATE_AJAX = 'myapp/includes/search_listing.html'
  382. # Replace the search backend
  383. #WAGTAILSEARCH_BACKENDS = {
  384. # 'default': {
  385. # 'BACKEND': 'wagtail.wagtailsearch.backends.elasticsearch2',
  386. # 'INDEX': 'myapp'
  387. # }
  388. #}
  389. # Wagtail email notifications from address
  390. # WAGTAILADMIN_NOTIFICATION_FROM_EMAIL = 'wagtail@myhost.io'
  391. # Wagtail email notification format
  392. # WAGTAILADMIN_NOTIFICATION_USE_HTML = True
  393. # If you want to use Embedly for embeds, supply a key
  394. # (this key doesn't work, get your own!)
  395. # WAGTAILEMBEDS_EMBEDLY_KEY = '253e433d59dc4d2xa266e9e0de0cb830'
  396. # Reverse the default case-sensitive handling of tags
  397. TAGGIT_CASE_INSENSITIVE = True
  398. ``urls.py``
  399. -----------
  400. .. code-block:: python
  401. from django.conf.urls import patterns, include, url
  402. from django.conf.urls.static import static
  403. from django.views.generic.base import RedirectView
  404. from django.contrib import admin
  405. from django.conf import settings
  406. import os.path
  407. from wagtail.wagtailcore import urls as wagtail_urls
  408. from wagtail.wagtailadmin import urls as wagtailadmin_urls
  409. from wagtail.wagtaildocs import urls as wagtaildocs_urls
  410. from wagtail.wagtailsearch import urls as wagtailsearch__urls
  411. urlpatterns = patterns('',
  412. url(r'^django-admin/', include(admin.site.urls)),
  413. url(r'^admin/', include(wagtailadmin_urls)),
  414. url(r'^search/', include(wagtailsearch_urls)),
  415. url(r'^documents/', include(wagtaildocs_urls)),
  416. # For anything not caught by a more specific rule above, hand over to
  417. # Wagtail's serving mechanism
  418. url(r'', include(wagtail_urls)),
  419. )
  420. if settings.DEBUG:
  421. from django.contrib.staticfiles.urls import staticfiles_urlpatterns
  422. urlpatterns += staticfiles_urlpatterns() # tell gunicorn where static files are in dev mode
  423. urlpatterns += static(settings.MEDIA_URL + 'images/', document_root=os.path.join(settings.MEDIA_ROOT, 'images'))
  424. urlpatterns += patterns('',
  425. (r'^favicon\.ico$', RedirectView.as_view(url=settings.STATIC_URL + 'myapp/images/favicon.ico'))
  426. )