django-admin.py startproject tango_my_django
mkdir -p tango_my_django/static/css
mkdir -p tango_my_django/static/js
tango_my_django/tango_my_django/settings.py
STATIC_PATH = os.path.join(PROJECT_PATH,'static')
STATIC_URL = '/static/'
STATICFILES_DIRS = (
STATIC_PATH,
)
mkdir -p tango_my_django/templates/rango
tango_my_django/tango_my_django/settings.py
TEMPLATE_PATH = os.path.join(PROJECT_PATH, 'templates')
TEMPLATE_DIRS = (TEMPLATE_PATH,)
tango_my_django/templates/rango/index.html
<!DOCTYPE html>
{% load static %}
<html>
<head>
....
tango_my_django/manage.py startapp tango_my_django/rango
tango_my_django/settings.py
INSTALLED_APPS = ( ..., ..., 'rango', )
tango_my_django/tango_my_django/urls.py
# Include tango_my_django/rango/urls.py
urlpatterns = patterns('', url(r'^mainApp/', include('mainApp.urls')),)
tango_my_django/rango/urls.py
from django.conf.urls import url, patterns
from mainApp import views
urlpatterns = patterns('', url(r'^$', views.index, name='index'),)
tango_my_django/rango/views.py
from django.conf.http import HttpResponse
def index(request):
return HttpResponse("hello rango")
tango_my_django/rango/views.py
from django.shortcuts import render_to_response
from django.template import RequestContext
def index(request):
context = RequestContext(request)
context_dict = {'boldmessage' : 'I come from context_dict'}
return render_to_response('mainApp/index.html', context_dict, context)