Reorder files
This commit is contained in:
parent
8f3b1f817a
commit
d9a41f82bb
16 changed files with 59 additions and 13 deletions
|
@ -6,7 +6,7 @@ import sys
|
|||
|
||||
def main():
|
||||
"""Run administrative tasks."""
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'notesapp.settings')
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings')
|
||||
try:
|
||||
from django.core.management import execute_from_command_line
|
||||
except ImportError as exc:
|
||||
|
|
3
notes/admin.py
Normal file
3
notes/admin.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
6
notes/apps.py
Normal file
6
notes/apps.py
Normal file
|
@ -0,0 +1,6 @@
|
|||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class NotesConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'notes'
|
0
notes/migrations/__init__.py
Normal file
0
notes/migrations/__init__.py
Normal file
3
notes/models.py
Normal file
3
notes/models.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from django.db import models
|
||||
|
||||
# Create your models here.
|
3
notes/tests.py
Normal file
3
notes/tests.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
|
@ -1,4 +1,4 @@
|
|||
"""notesapp URL Configuration
|
||||
"""notes URL Configuration
|
||||
|
||||
The `urlpatterns` list routes URLs to views. For more information please see:
|
||||
https://docs.djangoproject.com/en/3.2/topics/http/urls/
|
||||
|
@ -14,7 +14,8 @@ Including another URLconf
|
|||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||
"""
|
||||
from django.urls import path
|
||||
from notesapp import views
|
||||
|
||||
from notes import views
|
||||
|
||||
urlpatterns = [
|
||||
path('', views.index, name='index'),
|
|
@ -4,10 +4,19 @@ from django.contrib.auth import authenticate, login, logout
|
|||
from django.shortcuts import render, redirect
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
from django.contrib.auth.models import User
|
||||
from django.db import transaction
|
||||
from django.db import transaction, connection
|
||||
|
||||
# from notes.models import Note
|
||||
|
||||
@login_required()
|
||||
def index(request):
|
||||
user = request.user
|
||||
|
||||
# notes = Note.objects.filter(owner=user)
|
||||
# notes_list = [ { 'time' : note.time, 'body' : note.body } for note in notes ]
|
||||
# notes_list.sort(key=lambda note: note['time'])
|
||||
|
||||
# return render(request, 'index.html', { 'notes' : notes_list})
|
||||
return render(request, 'index.html')
|
||||
|
||||
def login_view(request):
|
0
project/__init__.py
Normal file
0
project/__init__.py
Normal file
|
@ -1,5 +1,5 @@
|
|||
"""
|
||||
ASGI config for notesapp project.
|
||||
ASGI config for project project.
|
||||
|
||||
It exposes the ASGI callable as a module-level variable named ``application``.
|
||||
|
||||
|
@ -11,6 +11,6 @@ import os
|
|||
|
||||
from django.core.asgi import get_asgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'notesapp.settings')
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings')
|
||||
|
||||
application = get_asgi_application()
|
|
@ -1,5 +1,5 @@
|
|||
"""
|
||||
Django settings for notesapp project.
|
||||
Django settings for project project.
|
||||
|
||||
Generated by 'django-admin startproject' using Django 3.2.13.
|
||||
|
||||
|
@ -20,7 +20,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
|||
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = 'django-insecure-qv7dimrj38uypn7ai4*58#85#ptpz)5w#jvukdknra$3venf7k'
|
||||
SECRET_KEY = 'django-insecure-)10v6d=(_iu)19nfuzz9jc6#$1lw=-)33s(%nv*#dsa6tibt1!'
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
|
@ -31,6 +31,7 @@ ALLOWED_HOSTS = []
|
|||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'notes.apps.NotesConfig',
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
|
@ -49,12 +50,12 @@ MIDDLEWARE = [
|
|||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'notesapp.urls'
|
||||
ROOT_URLCONF = 'project.urls'
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [ 'notesapp/templates', ],
|
||||
'DIRS': [ 'notes/templates/' ],
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
|
@ -67,7 +68,7 @@ TEMPLATES = [
|
|||
},
|
||||
]
|
||||
|
||||
WSGI_APPLICATION = 'notesapp.wsgi.application'
|
||||
WSGI_APPLICATION = 'project.wsgi.application'
|
||||
|
||||
|
||||
# Database
|
20
project/urls.py
Normal file
20
project/urls.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
"""project URL Configuration
|
||||
|
||||
The `urlpatterns` list routes URLs to views. For more information please see:
|
||||
https://docs.djangoproject.com/en/3.2/topics/http/urls/
|
||||
Examples:
|
||||
Function views
|
||||
1. Add an import: from my_app import views
|
||||
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
||||
Class-based views
|
||||
1. Add an import: from other_app.views import Home
|
||||
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
||||
Including another URLconf
|
||||
1. Import the include() function: from django.urls import include, path
|
||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||
"""
|
||||
from django.urls import path, include
|
||||
|
||||
urlpatterns = [
|
||||
path('', include('notes.urls')),
|
||||
]
|
|
@ -1,5 +1,5 @@
|
|||
"""
|
||||
WSGI config for notesapp project.
|
||||
WSGI config for project project.
|
||||
|
||||
It exposes the WSGI callable as a module-level variable named ``application``.
|
||||
|
||||
|
@ -11,6 +11,6 @@ import os
|
|||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'notesapp.settings')
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings')
|
||||
|
||||
application = get_wsgi_application()
|
Reference in a new issue