settings, basic first view

This commit is contained in:
Sanj 2011-09-29 00:03:51 +05:30
parent 1be55d4cb8
commit 5e7d09359e
3 changed files with 23 additions and 3 deletions

View File

@ -1,5 +1,10 @@
# Django settings for urbstudio project. # Django settings for urbstudio project.
import os
from os.path import join
PROJECT_ROOT = os.path.dirname(__file__)
LOCAL_DEVELOPMENT = True
DEBUG = True DEBUG = True
TEMPLATE_DEBUG = DEBUG TEMPLATE_DEBUG = DEBUG
@ -45,12 +50,12 @@ USE_L10N = True
# Absolute filesystem path to the directory that will hold user-uploaded files. # Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/" # 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 # 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). # trailing slash if there is a path component (optional in other cases).
# Examples: "http://media.lawrence.com", "http://example.com/media/" # 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 # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash. # trailing slash.
@ -78,6 +83,7 @@ MIDDLEWARE_CLASSES = (
ROOT_URLCONF = 'urbstudio.urls' ROOT_URLCONF = 'urbstudio.urls'
TEMPLATE_DIRS = ( TEMPLATE_DIRS = (
join(PROJECT_ROOT, "templates")
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows. # Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths. # Don't forget to use absolute paths, not relative paths.

View File

@ -1 +1,5 @@
# Create your views here. # Create your views here.
from django.shortcuts import render_to_response
def home(request):
return render_to_response("home.html", {})

View File

@ -3,14 +3,24 @@ from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin: # Uncomment the next two lines to enable the admin:
from django.contrib import admin from django.contrib import admin
admin.autodiscover() admin.autodiscover()
import settings
from os.path import join
urlpatterns = patterns('', urlpatterns = patterns('',
# Example: # Example:
# (r'^urbstudio/', include('urbstudio.foo.urls')), # (r'^urbstudio/', include('urbstudio.foo.urls')),
(r'^home$', 'urb.views.home'),
# Uncomment the admin/doc line below to enable admin documentation: # Uncomment the admin/doc line below to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')), # (r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin: # Uncomment the next line to enable the admin:
(r'^admin/', include(admin.site.urls)), (r'^admin/', include(admin.site.urls)),
) )
if settings.LOCAL_DEVELOPMENT:
#
urlpatterns += patterns('',
#
(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': join(settings.PROJECT_ROOT, "static")}),
#
)