Browse Source

End of Page 123.

Steve Thielemann 7 years ago
commit
89488754de
33 changed files with 414 additions and 0 deletions
  1. BIN
      django_site/db.sqlite3
  2. 0 0
      django_site/django_site/__init__.py
  3. BIN
      django_site/django_site/__pycache__/__init__.cpython-35.pyc
  4. BIN
      django_site/django_site/__pycache__/settings.cpython-35.pyc
  5. BIN
      django_site/django_site/__pycache__/urls.cpython-35.pyc
  6. BIN
      django_site/django_site/__pycache__/wsgi.cpython-35.pyc
  7. 121 0
      django_site/django_site/settings.py
  8. 120 0
      django_site/django_site/settings.py~
  9. 23 0
      django_site/django_site/urls.py
  10. 23 0
      django_site/django_site/urls.py~
  11. 16 0
      django_site/django_site/wsgi.py
  12. 22 0
      django_site/manage.py
  13. 0 0
      django_site/pages/__init__.py
  14. BIN
      django_site/pages/__pycache__/__init__.cpython-35.pyc
  15. BIN
      django_site/pages/__pycache__/admin.cpython-35.pyc
  16. BIN
      django_site/pages/__pycache__/apps.cpython-35.pyc
  17. BIN
      django_site/pages/__pycache__/models.cpython-35.pyc
  18. BIN
      django_site/pages/__pycache__/urls.cpython-35.pyc
  19. BIN
      django_site/pages/__pycache__/views.cpython-35.pyc
  20. 16 0
      django_site/pages/admin.py
  21. 3 0
      django_site/pages/admin.py~
  22. 5 0
      django_site/pages/apps.py
  23. 26 0
      django_site/pages/migrations/0001_initial.py
  24. 0 0
      django_site/pages/migrations/__init__.py
  25. BIN
      django_site/pages/migrations/__pycache__/0001_initial.cpython-35.pyc
  26. BIN
      django_site/pages/migrations/__pycache__/__init__.cpython-35.pyc
  27. 14 0
      django_site/pages/models.py
  28. 3 0
      django_site/pages/models.py~
  29. 3 0
      django_site/pages/tests.py
  30. 6 0
      django_site/pages/urls.py
  31. 7 0
      django_site/pages/views.py
  32. 3 0
      django_site/pages/views.py~
  33. 3 0
      requirements.txt

BIN
django_site/db.sqlite3


+ 0 - 0
django_site/django_site/__init__.py


BIN
django_site/django_site/__pycache__/__init__.cpython-35.pyc


BIN
django_site/django_site/__pycache__/settings.cpython-35.pyc


BIN
django_site/django_site/__pycache__/urls.cpython-35.pyc


BIN
django_site/django_site/__pycache__/wsgi.cpython-35.pyc


+ 121 - 0
django_site/django_site/settings.py

@@ -0,0 +1,121 @@
+"""
+Django settings for django_site project.
+
+Generated by 'django-admin startproject' using Django 1.11.6.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/1.11/topics/settings/
+
+For the full list of settings and their values, see
+https://docs.djangoproject.com/en/1.11/ref/settings/
+"""
+
+import os
+
+# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
+BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+
+
+# Quick-start development settings - unsuitable for production
+# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
+
+# SECURITY WARNING: keep the secret key used in production secret!
+SECRET_KEY = 'x$d3uu_w97u1v&&(@w_xl0ds(g$@yf7qmz8tqv_xoev_)tbtna'
+
+# SECURITY WARNING: don't run with debug turned on in production!
+DEBUG = True
+
+ALLOWED_HOSTS = []
+
+
+# Application definition
+
+INSTALLED_APPS = [
+    'pages.apps.PagesConfig',
+    'django.contrib.admin',
+    'django.contrib.auth',
+    'django.contrib.contenttypes',
+    'django.contrib.sessions',
+    'django.contrib.messages',
+    'django.contrib.staticfiles',
+]
+
+MIDDLEWARE = [
+    'django.middleware.security.SecurityMiddleware',
+    'django.contrib.sessions.middleware.SessionMiddleware',
+    'django.middleware.common.CommonMiddleware',
+    'django.middleware.csrf.CsrfViewMiddleware',
+    'django.contrib.auth.middleware.AuthenticationMiddleware',
+    'django.contrib.messages.middleware.MessageMiddleware',
+    'django.middleware.clickjacking.XFrameOptionsMiddleware',
+]
+
+ROOT_URLCONF = 'django_site.urls'
+
+TEMPLATES = [
+    {
+        'BACKEND': 'django.template.backends.django.DjangoTemplates',
+        'DIRS': [],
+        'APP_DIRS': True,
+        'OPTIONS': {
+            'context_processors': [
+                'django.template.context_processors.debug',
+                'django.template.context_processors.request',
+                'django.contrib.auth.context_processors.auth',
+                'django.contrib.messages.context_processors.messages',
+            ],
+        },
+    },
+]
+
+WSGI_APPLICATION = 'django_site.wsgi.application'
+
+
+# Database
+# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
+
+DATABASES = {
+    'default': {
+        'ENGINE': 'django.db.backends.sqlite3',
+        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
+    }
+}
+
+
+# Password validation
+# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
+
+AUTH_PASSWORD_VALIDATORS = [
+    {
+        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
+    },
+    {
+        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
+    },
+    {
+        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
+    },
+    {
+        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
+    },
+]
+
+
+# Internationalization
+# https://docs.djangoproject.com/en/1.11/topics/i18n/
+
+LANGUAGE_CODE = 'en-us'
+
+TIME_ZONE = 'UTC'
+
+USE_I18N = True
+
+USE_L10N = True
+
+USE_TZ = True
+
+
+# Static files (CSS, JavaScript, Images)
+# https://docs.djangoproject.com/en/1.11/howto/static-files/
+
+STATIC_URL = '/static/'

+ 120 - 0
django_site/django_site/settings.py~

@@ -0,0 +1,120 @@
+"""
+Django settings for django_site project.
+
+Generated by 'django-admin startproject' using Django 1.11.6.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/1.11/topics/settings/
+
+For the full list of settings and their values, see
+https://docs.djangoproject.com/en/1.11/ref/settings/
+"""
+
+import os
+
+# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
+BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+
+
+# Quick-start development settings - unsuitable for production
+# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
+
+# SECURITY WARNING: keep the secret key used in production secret!
+SECRET_KEY = 'x$d3uu_w97u1v&&(@w_xl0ds(g$@yf7qmz8tqv_xoev_)tbtna'
+
+# SECURITY WARNING: don't run with debug turned on in production!
+DEBUG = True
+
+ALLOWED_HOSTS = []
+
+
+# Application definition
+
+INSTALLED_APPS = [
+    'django.contrib.admin',
+    'django.contrib.auth',
+    'django.contrib.contenttypes',
+    'django.contrib.sessions',
+    'django.contrib.messages',
+    'django.contrib.staticfiles',
+]
+
+MIDDLEWARE = [
+    'django.middleware.security.SecurityMiddleware',
+    'django.contrib.sessions.middleware.SessionMiddleware',
+    'django.middleware.common.CommonMiddleware',
+    'django.middleware.csrf.CsrfViewMiddleware',
+    'django.contrib.auth.middleware.AuthenticationMiddleware',
+    'django.contrib.messages.middleware.MessageMiddleware',
+    'django.middleware.clickjacking.XFrameOptionsMiddleware',
+]
+
+ROOT_URLCONF = 'django_site.urls'
+
+TEMPLATES = [
+    {
+        'BACKEND': 'django.template.backends.django.DjangoTemplates',
+        'DIRS': [],
+        'APP_DIRS': True,
+        'OPTIONS': {
+            'context_processors': [
+                'django.template.context_processors.debug',
+                'django.template.context_processors.request',
+                'django.contrib.auth.context_processors.auth',
+                'django.contrib.messages.context_processors.messages',
+            ],
+        },
+    },
+]
+
+WSGI_APPLICATION = 'django_site.wsgi.application'
+
+
+# Database
+# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
+
+DATABASES = {
+    'default': {
+        'ENGINE': 'django.db.backends.sqlite3',
+        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
+    }
+}
+
+
+# Password validation
+# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
+
+AUTH_PASSWORD_VALIDATORS = [
+    {
+        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
+    },
+    {
+        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
+    },
+    {
+        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
+    },
+    {
+        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
+    },
+]
+
+
+# Internationalization
+# https://docs.djangoproject.com/en/1.11/topics/i18n/
+
+LANGUAGE_CODE = 'en-us'
+
+TIME_ZONE = 'UTC'
+
+USE_I18N = True
+
+USE_L10N = True
+
+USE_TZ = True
+
+
+# Static files (CSS, JavaScript, Images)
+# https://docs.djangoproject.com/en/1.11/howto/static-files/
+
+STATIC_URL = '/static/'

+ 23 - 0
django_site/django_site/urls.py

@@ -0,0 +1,23 @@
+"""django_site URL Configuration
+
+The `urlpatterns` list routes URLs to views. For more information please see:
+    https://docs.djangoproject.com/en/1.11/topics/http/urls/
+Examples:
+Function views
+    1. Add an import:  from my_app import views
+    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
+Class-based views
+    1. Add an import:  from other_app.views import Home
+    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
+Including another URLconf
+    1. Import the include() function: from django.conf.urls import url, include
+    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
+"""
+from django.conf.urls import include, url
+from django.contrib import admin
+
+
+urlpatterns = [
+    url(r'^admin/', admin.site.urls),
+    url(r'^', include('pages.urls')),
+]

+ 23 - 0
django_site/django_site/urls.py~

@@ -0,0 +1,23 @@
+"""django_site URL Configuration
+
+The `urlpatterns` list routes URLs to views. For more information please see:
+    https://docs.djangoproject.com/en/1.11/topics/http/urls/
+Examples:
+Function views
+    1. Add an import:  from my_app import views
+    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
+Class-based views
+    1. Add an import:  from other_app.views import Home
+    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
+Including another URLconf
+    1. Import the include() function: from django.conf.urls import url, include
+    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
+"""
+from django.conf.urls import url
+from . import views
+from django.contrib import admin
+
+urlpatterns = [
+    url(r'^$', views.index, name='index'),
+    url(r'^admin/', admin.site.urls),
+]

+ 16 - 0
django_site/django_site/wsgi.py

@@ -0,0 +1,16 @@
+"""
+WSGI config for django_site project.
+
+It exposes the WSGI callable as a module-level variable named ``application``.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
+"""
+
+import os
+
+from django.core.wsgi import get_wsgi_application
+
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_site.settings")
+
+application = get_wsgi_application()

+ 22 - 0
django_site/manage.py

@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+import os
+import sys
+
+if __name__ == "__main__":
+    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_site.settings")
+    try:
+        from django.core.management import execute_from_command_line
+    except ImportError:
+        # The above import may fail for some other reason. Ensure that the
+        # issue is really that Django is missing to avoid masking other
+        # exceptions on Python 2.
+        try:
+            import django
+        except ImportError:
+            raise ImportError(
+                "Couldn't import Django. Are you sure it's installed and "
+                "available on your PYTHONPATH environment variable? Did you "
+                "forget to activate a virtual environment?"
+            )
+        raise
+    execute_from_command_line(sys.argv)

+ 0 - 0
django_site/pages/__init__.py


BIN
django_site/pages/__pycache__/__init__.cpython-35.pyc


BIN
django_site/pages/__pycache__/admin.cpython-35.pyc


BIN
django_site/pages/__pycache__/apps.cpython-35.pyc


BIN
django_site/pages/__pycache__/models.cpython-35.pyc


BIN
django_site/pages/__pycache__/urls.cpython-35.pyc


BIN
django_site/pages/__pycache__/views.cpython-35.pyc


+ 16 - 0
django_site/pages/admin.py

@@ -0,0 +1,16 @@
+from django.contrib import admin
+
+# Register your models here.
+
+from .models import Page
+
+# The old admin.site.register(Page) ...
+# admin.site.register(Page)
+
+class PageAdmin(admin.ModelAdmin):
+    list_display = ('title', 'update_date')
+    ordering = ('title',)
+    search_fields = ('title',)
+
+admin.site.register(Page, PageAdmin)
+

+ 3 - 0
django_site/pages/admin.py~

@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.

+ 5 - 0
django_site/pages/apps.py

@@ -0,0 +1,5 @@
+from django.apps import AppConfig
+
+
+class PagesConfig(AppConfig):
+    name = 'pages'

+ 26 - 0
django_site/pages/migrations/0001_initial.py

@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.6 on 2017-10-25 01:57
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    initial = True
+
+    dependencies = [
+    ]
+
+    operations = [
+        migrations.CreateModel(
+            name='Page',
+            fields=[
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('title', models.CharField(max_length=60)),
+                ('permalink', models.CharField(max_length=12, unique=True)),
+                ('update_date', models.DateTimeField(verbose_name='Last Updated')),
+                ('bodytext', models.TextField(blank=True, verbose_name='Page Content')),
+            ],
+        ),
+    ]

+ 0 - 0
django_site/pages/migrations/__init__.py


BIN
django_site/pages/migrations/__pycache__/0001_initial.cpython-35.pyc


BIN
django_site/pages/migrations/__pycache__/__init__.cpython-35.pyc


+ 14 - 0
django_site/pages/models.py

@@ -0,0 +1,14 @@
+from django.db import models
+
+# Create your models here.
+
+class Page(models.Model):
+    title = models.CharField(max_length=60)
+    permalink = models.CharField(max_length=12, unique=True)
+    update_date = models.DateTimeField('Last Updated')
+    bodytext = models.TextField('Page Content', blank=True)
+
+    def __str__(self):
+        return self.title
+    
+    

+ 3 - 0
django_site/pages/models.py~

@@ -0,0 +1,3 @@
+from django.db import models
+
+# Create your models here.

+ 3 - 0
django_site/pages/tests.py

@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.

+ 6 - 0
django_site/pages/urls.py

@@ -0,0 +1,6 @@
+from django.conf.urls import url
+from . import views
+
+urlpatterns = [
+    url(r'^$', views.index, name='index'),
+]

+ 7 - 0
django_site/pages/views.py

@@ -0,0 +1,7 @@
+from django.shortcuts import render
+from django.http import HttpResponse
+
+# Create your views here.
+
+def index(request):
+    return HttpResponse("<h1>The Homepage</h1>")

+ 3 - 0
django_site/pages/views.py~

@@ -0,0 +1,3 @@
+from django.shortcuts import render
+
+# Create your views here.

+ 3 - 0
requirements.txt

@@ -0,0 +1,3 @@
+Django==1.11.6
+pkg-resources==0.0.0
+pytz==2017.2