├── blog ├── __init__.py ├── __pycache__ │ ├── __init__.cpython-37.pyc │ ├── admin.cpython-37.pyc │ ├── forms.cpython-37.pyc │ ├── models.cpython-37.pyc │ ├── urls.cpython-37.pyc │ └── views.cpython-37.pyc ├── admin.py ├── apps.py ├── forms.py ├── migrations │ ├── 0001_initial.py │ ├── 0002_post_pub_date.py │ ├── 0003_auto_20200416_1020.py │ ├── 0004_post_timestamp.py │ ├── __init__.py │ └── __pycache__ │ │ ├── 0001_initial.cpython-37.pyc │ │ ├── 0002_post_pub_date.cpython-37.pyc │ │ ├── 0003_auto_20200416_1020.cpython-37.pyc │ │ ├── 0004_post_timestamp.cpython-37.pyc │ │ └── __init__.cpython-37.pyc ├── models.py ├── templates │ ├── add_post.html │ ├── article_details.html │ ├── base.html │ ├── delete_post.html │ ├── edit_post.html │ └── home.html ├── tests.py ├── urls.py └── views.py ├── db.sqlite3 ├── manage.py ├── members ├── __init__.py ├── __pycache__ │ ├── __init__.cpython-37.pyc │ ├── admin.cpython-37.pyc │ ├── models.cpython-37.pyc │ ├── urls.cpython-37.pyc │ └── views.cpython-37.pyc ├── admin.py ├── apps.py ├── migrations │ ├── __init__.py │ └── __pycache__ │ │ └── __init__.cpython-37.pyc ├── models.py ├── templates │ └── registration │ │ ├── login.html │ │ └── register.html ├── tests.py ├── urls.py └── views.py └── simpleblog ├── __init__.py ├── __pycache__ ├── __init__.cpython-37.pyc ├── settings.cpython-37.pyc ├── urls.cpython-37.pyc └── wsgi.cpython-37.pyc ├── asgi.py ├── settings.py ├── urls.py └── wsgi.py /blog/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/blog/__init__.py -------------------------------------------------------------------------------- /blog/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/blog/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /blog/__pycache__/admin.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/blog/__pycache__/admin.cpython-37.pyc -------------------------------------------------------------------------------- /blog/__pycache__/forms.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/blog/__pycache__/forms.cpython-37.pyc -------------------------------------------------------------------------------- /blog/__pycache__/models.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/blog/__pycache__/models.cpython-37.pyc -------------------------------------------------------------------------------- /blog/__pycache__/urls.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/blog/__pycache__/urls.cpython-37.pyc -------------------------------------------------------------------------------- /blog/__pycache__/views.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/blog/__pycache__/views.cpython-37.pyc -------------------------------------------------------------------------------- /blog/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from .models import Post 3 | 4 | admin.site.register(Post) -------------------------------------------------------------------------------- /blog/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class BlogConfig(AppConfig): 5 | name = 'blog' 6 | -------------------------------------------------------------------------------- /blog/forms.py: -------------------------------------------------------------------------------- 1 | from django import forms 2 | from .models import Post 3 | 4 | 5 | class PostForm(forms.ModelForm): 6 | class Meta: 7 | model = Post 8 | fields = ('title', 'author', 'body') 9 | widgets = { 10 | 'title': forms.TextInput(attrs={'class': 'form-control'}), 11 | 'author': forms.Select(attrs={'class': 'form-control'}), 12 | 'body': forms.Textarea(attrs={'class': 'form-control', 'placeholder': "Body"}), 13 | } 14 | 15 | -------------------------------------------------------------------------------- /blog/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.0.5 on 2020-04-02 16:02 2 | 3 | from django.conf import settings 4 | from django.db import migrations, models 5 | import django.db.models.deletion 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | initial = True 11 | 12 | dependencies = [ 13 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), 14 | ] 15 | 16 | operations = [ 17 | migrations.CreateModel( 18 | name='Post', 19 | fields=[ 20 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 21 | ('title', models.CharField(max_length=255)), 22 | ('body', models.TextField()), 23 | ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), 24 | ], 25 | ), 26 | ] 27 | -------------------------------------------------------------------------------- /blog/migrations/0002_post_pub_date.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.0.5 on 2020-04-16 17:09 2 | 3 | from django.db import migrations, models 4 | import django.utils.timezone 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('blog', '0001_initial'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='post', 16 | name='pub_date', 17 | field=models.DateField(default=django.utils.timezone.now), 18 | preserve_default=False, 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /blog/migrations/0003_auto_20200416_1020.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.0.5 on 2020-04-16 17:20 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('blog', '0002_post_pub_date'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='post', 15 | name='pub_date', 16 | field=models.DateField(auto_now_add=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /blog/migrations/0004_post_timestamp.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.0.5 on 2020-04-16 17:30 2 | 3 | from django.db import migrations, models 4 | import django.utils.timezone 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('blog', '0003_auto_20200416_1020'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='post', 16 | name='timestamp', 17 | field=models.DateField(auto_now_add=True, default=django.utils.timezone.now), 18 | preserve_default=False, 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /blog/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/blog/migrations/__init__.py -------------------------------------------------------------------------------- /blog/migrations/__pycache__/0001_initial.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/blog/migrations/__pycache__/0001_initial.cpython-37.pyc -------------------------------------------------------------------------------- /blog/migrations/__pycache__/0002_post_pub_date.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/blog/migrations/__pycache__/0002_post_pub_date.cpython-37.pyc -------------------------------------------------------------------------------- /blog/migrations/__pycache__/0003_auto_20200416_1020.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/blog/migrations/__pycache__/0003_auto_20200416_1020.cpython-37.pyc -------------------------------------------------------------------------------- /blog/migrations/__pycache__/0004_post_timestamp.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/blog/migrations/__pycache__/0004_post_timestamp.cpython-37.pyc -------------------------------------------------------------------------------- /blog/migrations/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/blog/migrations/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /blog/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | from django.contrib.auth.models import User 3 | from django.urls import reverse 4 | from datetime import datetime, date 5 | 6 | class Post(models.Model): 7 | title = models.CharField(max_length=255) 8 | author = models.ForeignKey(User, on_delete=models.CASCADE) 9 | body = models.TextField() 10 | pub_date = models.DateField(auto_now_add=True) 11 | timestamp = models.DateField(auto_now_add=True) 12 | 13 | def __str__(self): 14 | return self.title + ' | ' + str(self.author) 15 | def get_absolute_url(self): 16 | return reverse('home') 17 | -------------------------------------------------------------------------------- /blog/templates/add_post.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | 4 | {% block content %} 5 | 6 | {% if user.is_authenticated %} 7 |

Add Post...

8 | 9 |
10 | {% csrf_token %} 11 | {{ form.as_p }} 12 | 13 | 14 |

15 | {% else %} 16 | You are not authorized to view this page... 17 | 18 | {% endif %} 19 | 20 | {% endblock %} 21 | -------------------------------------------------------------------------------- /blog/templates/article_details.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | 4 | {% block content %} 5 | 6 | 7 |

{{post.title}}

8 | By: {{ post.author }} - Edit Post
- {{ post.pub_date }} - {{ post.timestamp }}

9 | {{ post.body }} 10 | 11 | {% endblock %} -------------------------------------------------------------------------------- /blog/templates/base.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Hello, world! 12 | 13 | 14 |
52 | 53 |
54 | 55 |
56 | {% if messages %} 57 | {% for message in messages %} 58 |
59 | {{ message|safe }} 60 |
61 | {% endfor %} 62 | {% endif %} 63 | 64 | 65 | {% if messages %} 66 | {% for message in messages %} 67 | 73 | {% endfor%} 74 | 75 | {% endif %} 76 | 77 | 78 | {% block content %} 79 | 80 | {% endblock %} 81 |
82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /blog/templates/delete_post.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | 4 | {% block content %} 5 |

Delete Post...

6 | 7 |

Delete: {{ post.title}}

8 |
9 | {% csrf_token %} 10 | Are you sure?!
11 | 12 |
13 |

14 | 15 | 16 | {% endblock %} 17 | -------------------------------------------------------------------------------- /blog/templates/edit_post.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | 4 | {% block content %} 5 |

Edit Post...

6 | 7 |
8 | {% csrf_token %} 9 | {{ form.as_p }} 10 | 11 | 12 |

13 | 14 | 15 | {% endblock %} 16 | -------------------------------------------------------------------------------- /blog/templates/home.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | 4 | {% block content %} 5 | 6 | 7 |

Posts

8 | 18 | 19 | {% endblock %} 20 | 21 | -------------------------------------------------------------------------------- /blog/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /blog/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | #from . import views 3 | from .views import HomeView, ArticleDetail, AddPostView, EditPostView, DeletePostView 4 | 5 | urlpatterns = [ 6 | #path('', views.home, name='home'), 7 | path('', HomeView.as_view(), name='home'), 8 | path('article//', ArticleDetail.as_view(), name='article-detail'), 9 | path('add_post/', AddPostView.as_view(), name='add_post'), 10 | path('article/edit//', EditPostView.as_view(), name='edit_post'), 11 | path('article//remove', DeletePostView.as_view(), name='delete_post'), 12 | ] 13 | 14 | -------------------------------------------------------------------------------- /blog/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | from django.views.generic import ListView, DetailView, CreateView, UpdateView, DeleteView 3 | from .models import Post 4 | from .forms import PostForm 5 | from django.urls import reverse_lazy 6 | 7 | #def home(request): 8 | # return render(request, 'home.html', {}) 9 | 10 | 11 | class HomeView(ListView): 12 | model = Post 13 | template_name = 'home.html' 14 | ordering = ['-pub_date'] 15 | success_message = 'List successfully saved!!!!' 16 | 17 | class ArticleDetail(DetailView): 18 | model = Post 19 | template_name = 'article_details.html' 20 | 21 | class AddPostView(CreateView): 22 | model = Post 23 | form_class = PostForm 24 | template_name = 'add_post.html' 25 | #fields = '__all__' 26 | #fields = ('title', 'body') 27 | 28 | class EditPostView(UpdateView): 29 | model = Post 30 | template_name = 'edit_post.html' 31 | fields = ['title', 'body'] 32 | 33 | class DeletePostView(DeleteView): 34 | model = Post 35 | template_name = 'delete_post.html' 36 | success_url = reverse_lazy('home') 37 | 38 | -------------------------------------------------------------------------------- /db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/db.sqlite3 -------------------------------------------------------------------------------- /manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Django's command-line utility for administrative tasks.""" 3 | import os 4 | import sys 5 | 6 | 7 | def main(): 8 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'simpleblog.settings') 9 | try: 10 | from django.core.management import execute_from_command_line 11 | except ImportError as exc: 12 | raise ImportError( 13 | "Couldn't import Django. Are you sure it's installed and " 14 | "available on your PYTHONPATH environment variable? Did you " 15 | "forget to activate a virtual environment?" 16 | ) from exc 17 | execute_from_command_line(sys.argv) 18 | 19 | 20 | if __name__ == '__main__': 21 | main() 22 | -------------------------------------------------------------------------------- /members/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/members/__init__.py -------------------------------------------------------------------------------- /members/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/members/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /members/__pycache__/admin.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/members/__pycache__/admin.cpython-37.pyc -------------------------------------------------------------------------------- /members/__pycache__/models.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/members/__pycache__/models.cpython-37.pyc -------------------------------------------------------------------------------- /members/__pycache__/urls.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/members/__pycache__/urls.cpython-37.pyc -------------------------------------------------------------------------------- /members/__pycache__/views.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/members/__pycache__/views.cpython-37.pyc -------------------------------------------------------------------------------- /members/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /members/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class MembersConfig(AppConfig): 5 | name = 'members' 6 | -------------------------------------------------------------------------------- /members/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/members/migrations/__init__.py -------------------------------------------------------------------------------- /members/migrations/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/members/migrations/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /members/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /members/templates/registration/login.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | 4 | {% block content %} 5 |

Login...

6 | 7 | 8 | {% csrf_token %} 9 | {{ form.as_p }} 10 | 11 | 12 |

13 | 14 | 15 | {% endblock %} 16 | -------------------------------------------------------------------------------- /members/templates/registration/register.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | 4 | {% block content %} 5 |

Register...

6 | 7 | 8 | {% csrf_token %} 9 | {{ form.as_p }} 10 | 11 | 12 |

13 | 14 | 15 | {% endblock %} 16 | -------------------------------------------------------------------------------- /members/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /members/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | from .views import UserRegisterView 3 | urlpatterns = [ 4 | path('register/', UserRegisterView.as_view(), name='register'), 5 | 6 | 7 | ] 8 | -------------------------------------------------------------------------------- /members/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | from django.views import generic 3 | from django.contrib.auth.forms import UserCreationForm 4 | from django.urls import reverse_lazy 5 | 6 | 7 | class UserRegisterView(generic.CreateView): 8 | form_class = UserCreationForm 9 | template_name = 'registration/register.html' 10 | success_url = reverse_lazy('login') 11 | -------------------------------------------------------------------------------- /simpleblog/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/simpleblog/__init__.py -------------------------------------------------------------------------------- /simpleblog/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/simpleblog/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /simpleblog/__pycache__/settings.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/simpleblog/__pycache__/settings.cpython-37.pyc -------------------------------------------------------------------------------- /simpleblog/__pycache__/urls.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/simpleblog/__pycache__/urls.cpython-37.pyc -------------------------------------------------------------------------------- /simpleblog/__pycache__/wsgi.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/simpleblog/__pycache__/wsgi.cpython-37.pyc -------------------------------------------------------------------------------- /simpleblog/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for simpleblog project. 3 | 4 | It exposes the ASGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.asgi import get_asgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'simpleblog.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /simpleblog/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for simpleblog project. 3 | 4 | Generated by 'django-admin startproject' using Django 3.0.5. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.0/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/3.0/ref/settings/ 11 | """ 12 | 13 | import os 14 | 15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = '_x0oof2u+c43ggecjbex$)-$tq&&2)-yhj%t-767u!a!!d6+fp' 24 | 25 | # SECURITY WARNING: don't run with debug turned on in production! 26 | DEBUG = True 27 | 28 | ALLOWED_HOSTS = [] 29 | 30 | 31 | # Application definition 32 | 33 | INSTALLED_APPS = [ 34 | 'django.contrib.admin', 35 | 'django.contrib.auth', 36 | 'django.contrib.contenttypes', 37 | 'django.contrib.sessions', 38 | 'django.contrib.messages', 39 | 'django.contrib.staticfiles', 40 | 'blog', 41 | 'members', 42 | ] 43 | 44 | MIDDLEWARE = [ 45 | 'django.middleware.security.SecurityMiddleware', 46 | 'django.contrib.sessions.middleware.SessionMiddleware', 47 | 'django.contrib.messages.middleware.MessageMiddleware', 48 | 'django.middleware.common.CommonMiddleware', 49 | 'django.middleware.csrf.CsrfViewMiddleware', 50 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 51 | 'django.contrib.messages.middleware.MessageMiddleware', 52 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 53 | ] 54 | 55 | ROOT_URLCONF = 'simpleblog.urls' 56 | 57 | TEMPLATES = [ 58 | { 59 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 60 | 'DIRS': [], 61 | 'APP_DIRS': True, 62 | 'OPTIONS': { 63 | 'context_processors': [ 64 | 'django.template.context_processors.debug', 65 | 'django.template.context_processors.request', 66 | 'django.contrib.auth.context_processors.auth', 67 | 'django.contrib.messages.context_processors.messages', 68 | ], 69 | }, 70 | }, 71 | ] 72 | 73 | WSGI_APPLICATION = 'simpleblog.wsgi.application' 74 | 75 | 76 | # Database 77 | # https://docs.djangoproject.com/en/3.0/ref/settings/#databases 78 | 79 | DATABASES = { 80 | 'default': { 81 | 'ENGINE': 'django.db.backends.sqlite3', 82 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 83 | } 84 | } 85 | 86 | 87 | # Password validation 88 | # https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators 89 | 90 | AUTH_PASSWORD_VALIDATORS = [ 91 | { 92 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 93 | }, 94 | { 95 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 96 | }, 97 | { 98 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 99 | }, 100 | { 101 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 102 | }, 103 | ] 104 | 105 | 106 | # Internationalization 107 | # https://docs.djangoproject.com/en/3.0/topics/i18n/ 108 | 109 | LANGUAGE_CODE = 'en-us' 110 | 111 | TIME_ZONE = 'UTC' 112 | 113 | USE_I18N = True 114 | 115 | USE_L10N = True 116 | 117 | USE_TZ = True 118 | 119 | 120 | # Static files (CSS, JavaScript, Images) 121 | # https://docs.djangoproject.com/en/3.0/howto/static-files/ 122 | 123 | STATIC_URL = '/static/' 124 | 125 | 126 | LOGIN_REDIRECT_URL = 'home' 127 | LOGOUT_REDIRECT_URL = 'home' -------------------------------------------------------------------------------- /simpleblog/urls.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from django.urls import path, include 3 | 4 | urlpatterns = [ 5 | path('admin/', admin.site.urls), 6 | path('', include('blog.urls')), 7 | path('members/', include('django.contrib.auth.urls')), 8 | path('members/', include('members.urls')), 9 | ] 10 | -------------------------------------------------------------------------------- /simpleblog/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for simpleblog project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'simpleblog.settings') 15 | 16 | application = get_wsgi_application() 17 | --------------------------------------------------------------------------------