Kaynağa Gözat

Adding basic views

David Leonard 10 yıl önce
ebeveyn
işleme
7bd3db3841

+ 9 - 1
hackathon_starter/hackathon/views.py

@@ -1,3 +1,11 @@
+from django.http import HttpResponse
+from django.template import RequestContext, loader
 from django.shortcuts import render
 
-# Create your views here.
+
+def index(request):
+	context = {'hello': 'world'}
+	return render(request, 'hackathon/index.html', context)
+
+def test(request):
+	return HttpResponse('meow')

+ 4 - 0
hackathon_starter/hackathon_starter/settings.py

@@ -36,6 +36,7 @@ INSTALLED_APPS = (
     'django.contrib.sessions',
     'django.contrib.messages',
     'django.contrib.staticfiles',
+    'hackathon',
 )
 
 MIDDLEWARE_CLASSES = (
@@ -81,3 +82,6 @@ USE_TZ = True
 # https://docs.djangoproject.com/en/1.7/howto/static-files/
 
 STATIC_URL = '/static/'
+
+TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')]
+

+ 2 - 5
hackathon_starter/hackathon_starter/urls.py

@@ -2,9 +2,6 @@ from django.conf.urls import patterns, include, url
 from django.contrib import admin
 
 urlpatterns = patterns('',
-    # Examples:
-    # url(r'^$', 'hackathon_starter.views.home', name='home'),
-    # url(r'^blog/', include('blog.urls')),
-
+    url(r'^hackathon/', include('hackathon.urls')),
     url(r'^admin/', include(admin.site.urls)),
-)
+)