Commits

Ales Zoulek committed c7c1292

testing app

Comments (0)

Files changed (8)

ng_proxy_test/content/admin.py

+from ng_proxy_test.content.models import Article
+from django.contrib import admin
+
+
+admin.site.register(Article)
+
+
+

ng_proxy_test/content/models.py

+from django.db import models
+
+
+class Article(models.Model):
+    name = models.CharField(max_length='255')
+    text = models.TextField()

ng_proxy_test/content/templates/detail.html

+<html>
+<body>
+
+<h1><a href="/">Example SSI site</a></h1>
+
+<h2>{{article.name}}</h2>
+<div>{{article.text}}</div>
+
+</body>
+</html>
+

ng_proxy_test/content/templates/homepage.html

+<html>
+<body>
+
+<h1>Example SSI site</h1>
+
+<ul>
+{% for article in articles %}
+<li><a href="/article/{{article.pk}}/">{{ article.name }}</a></li>
+{% endfor %}
+</ul>
+
+</body>
+</html>

ng_proxy_test/content/urls.py

+from django.conf.urls.defaults import patterns, url
+
+urlpatterns = patterns('ng_proxy_test.content.views',
+    url(r'^$', 'homepage', name='homepage'),
+    url(r'^article/(?P<pk>\d+)/$', 'detail', name='detail'),
+)
+

ng_proxy_test/content/views.py

+from django.shortcuts import render_to_response
+
+from ng_proxy_test.content.models import Article
+
+
+
+def homepage(request):
+    return render_to_response(
+        'homepage.html',
+        {
+            'articles': Article.objects.all().order_by('id'),
+        },
+    )
+
+def detail(request, pk):
+    return render_to_response(
+        'detail.html',
+        {
+            'article': Article.objects.get(pk=pk)
+        },
+    )

ng_proxy_test/settings.py

 DATABASES = {
     'default': {
         'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
-        'NAME': os.path(os.join(ng_proxy_test.__file__, 'sqlite3.db')),                      # Or path to database file if using sqlite3.
+        'NAME': os.path.join(os.path.dirname(ng_proxy_test.__file__), 'sqlite3.db'),                      # Or path to database file if using sqlite3.
         'USER': '',                      # Not used with sqlite3.
         'PASSWORD': '',                  # Not used with sqlite3.
         'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
     'django.contrib.messages',
     'django.contrib.staticfiles',
     # Uncomment the next line to enable the admin:
-    # 'django.contrib.admin',
+    'django.contrib.admin',
     # Uncomment the next line to enable admin documentation:
     # 'django.contrib.admindocs',
     'ng_proxy_test.content',

ng_proxy_test/urls.py

 from django.conf.urls.defaults import patterns, include, url
 
 # Uncomment the next two lines to enable the admin:
-# from django.contrib import admin
-# admin.autodiscover()
+from django.contrib import admin
+admin.autodiscover()
 
 urlpatterns = patterns('',
     # Examples:
     # url(r'^$', 'ng_proxy_test.views.home', name='home'),
-    # url(r'^ng_proxy_test/', include('ng_proxy_test.foo.urls')),
+    url(r'^admin/', include(admin.site.urls)),
+    url(r'', include('ng_proxy_test.content.urls')),
 
     # Uncomment the admin/doc line below to enable admin documentation:
     # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
 
     # Uncomment the next line to enable the admin:
-    # url(r'^admin/', include(admin.site.urls)),
 )