Ver código fonte

Include location helper in docs, and use it more in settings

Two people on the mailing list tripped over the location helper, so it's
now included right next to where it is used.

The helper is now also used in a few more spots in the settings.
master
Maik Hoepfel 11 anos atrás
pai
commit
48e7f5993e

+ 5
- 0
docs/source/internals/getting_started.rst Ver arquivo

@@ -147,7 +147,12 @@ Modify your ``TEMPLATE_DIRS`` to include the main Oscar template directory:
147 147
 
148 148
 .. code-block:: django
149 149
 
150
+    import os
150 151
     from oscar import OSCAR_MAIN_TEMPLATE_DIR
152
+
153
+    location = lambda x: os.path.join(
154
+        os.path.dirname(os.path.realpath(__file__)), x)
155
+
151 156
     TEMPLATE_DIRS = (
152 157
         location('templates'),
153 158
         OSCAR_MAIN_TEMPLATE_DIR,

+ 0
- 1
sites/demo/settings.py Ver arquivo

@@ -12,7 +12,6 @@ Notes:
12 12
 import os
13 13
 
14 14
 # Django settings for oscar project.
15
-PROJECT_DIR = os.path.dirname(__file__)
16 15
 location = lambda x: os.path.join(
17 16
     os.path.dirname(os.path.realpath(__file__)), x)
18 17
 

+ 2
- 4
sites/sandbox/settings.py Ver arquivo

@@ -1,8 +1,6 @@
1 1
 import os
2
-import sys
3 2
 
4 3
 # Path helper
5
-PROJECT_DIR = os.path.dirname(__file__)
6 4
 location = lambda x: os.path.join(
7 5
     os.path.dirname(os.path.realpath(__file__)), x)
8 6
 
@@ -28,7 +26,7 @@ MANAGERS = ADMINS
28 26
 DATABASES = {
29 27
     'default': {
30 28
         'ENGINE': 'django.db.backends.sqlite3',
31
-        'NAME': os.path.join(os.path.dirname(__file__), 'db.sqlite'),
29
+        'NAME': location('db.sqlite'),
32 30
         'USER': '',
33 31
         'PASSWORD': '',
34 32
         'HOST': '',
@@ -327,7 +325,7 @@ APPEND_SLASH = True
327 325
 HAYSTACK_CONNECTIONS = {
328 326
     'default': {
329 327
         'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',
330
-        'PATH': os.path.join(os.path.dirname(__file__), 'whoosh_index'),
328
+        'PATH': location('whoosh_index'),
331 329
     },
332 330
 }
333 331
 

+ 2
- 3
sites/us/settings.py Ver arquivo

@@ -1,7 +1,6 @@
1 1
 import os
2 2
 
3 3
 # Path helper
4
-PROJECT_DIR = os.path.dirname(__file__)
5 4
 location = lambda x: os.path.join(
6 5
     os.path.dirname(os.path.realpath(__file__)), x)
7 6
 
@@ -21,7 +20,7 @@ MANAGERS = ADMINS
21 20
 DATABASES = {
22 21
     'default': {
23 22
         'ENGINE': 'django.db.backends.sqlite3',
24
-        'NAME': os.path.join(os.path.dirname(__file__), 'db.sqlite'),
23
+        'NAME': location('db.sqlite'),
25 24
         'USER': '',
26 25
         'PASSWORD': '',
27 26
         'HOST': '',
@@ -303,7 +302,7 @@ APPEND_SLASH = True
303 302
 HAYSTACK_CONNECTIONS = {
304 303
     'default': {
305 304
         'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',
306
-        'PATH': os.path.join(os.path.dirname(__file__), 'whoosh_index'),
305
+        'PATH': location('whoosh_index'),
307 306
     },
308 307
 }
309 308
 

Carregando…
Cancelar
Salvar