From 5e7d09359e5deddb167a26453b701b73eb34d901 Mon Sep 17 00:00:00 2001 From: Sanj Date: Thu, 29 Sep 2011 00:03:51 +0530 Subject: [PATCH] settings, basic first view --- urbstudio/settings.py | 10 ++++++++-- urbstudio/urb/views.py | 4 ++++ urbstudio/urls.py | 12 +++++++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/urbstudio/settings.py b/urbstudio/settings.py index 7274b60..f789976 100644 --- a/urbstudio/settings.py +++ b/urbstudio/settings.py @@ -1,5 +1,10 @@ # Django settings for urbstudio project. +import os +from os.path import join + +PROJECT_ROOT = os.path.dirname(__file__) +LOCAL_DEVELOPMENT = True DEBUG = True TEMPLATE_DEBUG = DEBUG @@ -45,12 +50,12 @@ USE_L10N = True # Absolute filesystem path to the directory that will hold user-uploaded files. # Example: "/home/media/media.lawrence.com/" -MEDIA_ROOT = '' +MEDIA_ROOT = join(PROJECT_ROOT, "static") # URL that handles the media served from MEDIA_ROOT. Make sure to use a # trailing slash if there is a path component (optional in other cases). # Examples: "http://media.lawrence.com", "http://example.com/media/" -MEDIA_URL = '' +MEDIA_URL = '/static/' # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a # trailing slash. @@ -78,6 +83,7 @@ MIDDLEWARE_CLASSES = ( ROOT_URLCONF = 'urbstudio.urls' TEMPLATE_DIRS = ( + join(PROJECT_ROOT, "templates") # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. diff --git a/urbstudio/urb/views.py b/urbstudio/urb/views.py index 60f00ef..ac9e24e 100644 --- a/urbstudio/urb/views.py +++ b/urbstudio/urb/views.py @@ -1 +1,5 @@ # Create your views here. +from django.shortcuts import render_to_response + +def home(request): + return render_to_response("home.html", {}) diff --git a/urbstudio/urls.py b/urbstudio/urls.py index 657ee86..36fed0a 100644 --- a/urbstudio/urls.py +++ b/urbstudio/urls.py @@ -3,14 +3,24 @@ from django.conf.urls.defaults import * # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() +import settings +from os.path import join urlpatterns = patterns('', # Example: # (r'^urbstudio/', include('urbstudio.foo.urls')), - + (r'^home$', 'urb.views.home'), # Uncomment the admin/doc line below to enable admin documentation: # (r'^admin/doc/', include('django.contrib.admindocs.urls')), # Uncomment the next line to enable the admin: (r'^admin/', include(admin.site.urls)), ) + +if settings.LOCAL_DEVELOPMENT: +# + urlpatterns += patterns('', +# + (r'^static/(?P.*)$', 'django.views.static.serve', {'document_root': join(settings.PROJECT_ROOT, "static")}), +# +)