Commits

Silas Baronda committed 9eb6502

* Fixed some production errors
* Now ready for wsgi support

Comments (0)

Files changed (2)

 # Django settings for library project.
+import os
 
 DEBUG = True
 TEMPLATE_DEBUG = DEBUG
 MANAGERS = ADMINS
 
 DATABASE_ENGINE = 'sqlite3'           # 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
-DATABASE_NAME = './db.sq3'             # Or path to database file if using sqlite3.
+DATABASE_NAME = os.path.join(os.path.dirname(__file__), 'db.sq3')            # Or path to database file if using sqlite3.
 DATABASE_USER = ''             # Not used with sqlite3.
 DATABASE_PASSWORD = ''         # Not used with sqlite3.
 DATABASE_HOST = ''             # Set to empty string for localhost. Not used with sqlite3.
 ROOT_URLCONF = 'library.urls'
 
 TEMPLATE_DIRS = (
-    'templates'
+    os.path.join(os.path.dirname(__file__), 'templates/'),
     # Put strings here, like "/home/html/django_templates".
 )
 
     'django.contrib.sites',
     'django.contrib.admin', 
     'library.books'
-
 )
 from django.conf.urls.defaults import *
 from django.contrib import admin
 from library.books.models import Book
+from django.conf import settings
 
 info_dict = {
     'queryset':  Book.objects.all(),
 
     # Register
     (r'^register/$', 'library.register.views.index'),
+  )
 
-    # static direcory
-    (r'(^|/)(?P<path>.*)$', 'django.views.static.serve', {'document_root': 'static', 'show_indexes': True}),
-    (r'(^|/)static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': 'static', 'show_indexes': True}),
-
-)
+if settings.DEBUG:
+    urlpatterns += patterns('',
+      (r'(^|/)(?P<path>.*)$', 'django.views.static.serve', {'document_root': 'static', 'show_indexes': True}),
+      (r'(^|/)static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': 'static', 'show_indexes': True}),
+    )