Commits

hardwood  committed b0c3cb9

Setup for independent use of lab app

  • Participants
  • Parent commits 5e25420

Comments (0)

Files changed (3)

+from www.settings import *
+
+PROJECT_DIRNAME = PROJECT_ROOT.split(os.sep)[-1]+'.lab'
+
+# Package/module name to import the root urlpatterns from for the project.
+ROOT_URLCONF = "%s.urls" % PROJECT_DIRNAME
+
+# Set to e.g. 'rick.gerk.in' in production.  
+ALLOWED_HOSTS = ["lab.gerk.in"]
+
+################
+# APPLICATIONS #
+################
+
+import os,sys
+sys.path.append(PROJECT_ROOT)
+
+TEMPLATE_CONTEXT_PROCESSORS = (
+    "django.contrib.auth.context_processors.auth",
+    "django.contrib.messages.context_processors.messages",
+    "django.core.context_processors.debug",
+    "django.core.context_processors.i18n",
+    "django.core.context_processors.static",
+    "django.core.context_processors.media",
+    "django.core.context_processors.request",
+    'social_auth.context_processors.social_auth_by_name_backends',
+    'social_auth.context_processors.social_auth_backends',
+    'social_auth.context_processors.social_auth_by_type_backends',
+    )
+
+MIDDLEWARE_CLASSES = (
+    "django.contrib.sessions.middleware.SessionMiddleware",
+    "django.contrib.auth.middleware.AuthenticationMiddleware",
+    "django.contrib.redirects.middleware.RedirectFallbackMiddleware",
+    "django.middleware.common.CommonMiddleware",
+    "django.middleware.transaction.TransactionMiddleware",
+    "django.middleware.csrf.CsrfViewMiddleware", # Comment this out to get djnote to work.                           
+    "django.contrib.messages.middleware.MessageMiddleware",
+    )
+
+INSTALLED_APPS = (
+    "django.contrib.admin",
+    "django.contrib.auth",
+    "django.contrib.contenttypes",
+    "django.contrib.messages",
+    "django.contrib.redirects",
+    "django.contrib.sessions",
+    "django.contrib.sites",
+    "django.contrib.sitemaps",
+    "django.contrib.staticfiles",
+    'django_jinja',
+    'social_auth',
+    )
+
+MY_APPS = (
+    "lab",
+)
+
+INSTALLED_APPS += MY_APPS
+
+#from mezzanine.utils.conf import set_dynamic_settings
+#set_dynamic_settings(globals())
+
+try:
+    from local_settings import *
+except ImportError:
+    pass
+
+#from pprint import pprint
+#pprint(globals())
 # Installed libraries.  
 from tastypie.api import Api
 from django.conf.urls import patterns, include, url
+from django.conf.urls.defaults import * # Used to make sure that 404 and 500 errors get handled by django defaults and not mezzanine templates. 
+from django.contrib import admin
+#from django.contrib.auth.views import login,logout,logout_then_login
 
+admin.autodiscover()
 # Local libraries.  
 import lab.api
+handler500 = 'www.lab.views.error500'
 
 # Override tastypie.serializers.Serializer.to_html so that 'format=json' is not needed.  
 # json will be the new default, and a request for html will be passed to the json serializer.  
 
 urlpatterns = patterns("",
     url(r'^api/', include(v1_api.urls)),
+    url('^admin/', include(admin.site.urls)),
 )
-    
+    
 # Create your views here.
 
-'''
 from __future__ import division
 from django.http import HttpResponse,HttpResponseRedirect,Http404
 from django.shortcuts import render,render_to_response
 from django.contrib.auth.decorators import login_required
 from django.core.exceptions import ObjectDoesNotExist
 import urllib2,re,json,pickle
-import BeautifulSoup as bs
-import models as m
-import scratch as s
-from copy import copy
-from numpy import sqrt,zeros,ones
-'''
+#import BeautifulSoup as bs
+#import models as m
+#import scratch as s
+#from copy import copy
+#from numpy import sqrt,zeros,ones
 
 from pylab import *
 from gspread.httpsession import HTTPError
 
+def error500(request):
+    return HttpResponse("Error 500")
+
 def get_worksheets():
 	import gspread
 	# Login with your Google account.