From 4ada78aa74c13177c8c335a253663c80f7fa559b Mon Sep 17 00:00:00 2001 From: Allecks Date: Tue, 4 Oct 2022 14:24:20 +0300 Subject: [PATCH] init --- samplesite/bboard/__init__.py | 0 samplesite/bboard/admin.py | 3 + samplesite/bboard/apps.py | 6 + samplesite/bboard/migrations/0001_initial.py | 24 ++++ samplesite/bboard/migrations/__init__.py | 0 samplesite/bboard/models.py | 8 ++ samplesite/bboard/tests.py | 3 + samplesite/bboard/urls.py | 6 + samplesite/bboard/views.py | 9 ++ samplesite/db.sqlite3 | Bin 0 -> 139264 bytes samplesite/manage.py | 22 ++++ samplesite/samplesite/__init__.py | 0 samplesite/samplesite/asgi.py | 16 +++ samplesite/samplesite/settings.py | 124 +++++++++++++++++++ samplesite/samplesite/urls.py | 7 ++ samplesite/samplesite/wsgi.py | 16 +++ 16 files changed, 244 insertions(+) create mode 100644 samplesite/bboard/__init__.py create mode 100644 samplesite/bboard/admin.py create mode 100644 samplesite/bboard/apps.py create mode 100644 samplesite/bboard/migrations/0001_initial.py create mode 100644 samplesite/bboard/migrations/__init__.py create mode 100644 samplesite/bboard/models.py create mode 100644 samplesite/bboard/tests.py create mode 100644 samplesite/bboard/urls.py create mode 100644 samplesite/bboard/views.py create mode 100644 samplesite/db.sqlite3 create mode 100644 samplesite/manage.py create mode 100644 samplesite/samplesite/__init__.py create mode 100644 samplesite/samplesite/asgi.py create mode 100644 samplesite/samplesite/settings.py create mode 100644 samplesite/samplesite/urls.py create mode 100644 samplesite/samplesite/wsgi.py diff --git a/samplesite/bboard/__init__.py b/samplesite/bboard/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/samplesite/bboard/admin.py b/samplesite/bboard/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/samplesite/bboard/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/samplesite/bboard/apps.py b/samplesite/bboard/apps.py new file mode 100644 index 0000000..308aeac --- /dev/null +++ b/samplesite/bboard/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class BboardConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'bboard' diff --git a/samplesite/bboard/migrations/0001_initial.py b/samplesite/bboard/migrations/0001_initial.py new file mode 100644 index 0000000..8cbdb5c --- /dev/null +++ b/samplesite/bboard/migrations/0001_initial.py @@ -0,0 +1,24 @@ +# Generated by Django 4.1.2 on 2022-10-04 10:04 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Bb', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=50)), + ('content', models.TextField(blank=True, null=True)), + ('price', models.FloatField(blank=True, null=True)), + ('published', models.DateTimeField(auto_now_add=True, db_index=True)), + ], + ), + ] diff --git a/samplesite/bboard/migrations/__init__.py b/samplesite/bboard/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/samplesite/bboard/models.py b/samplesite/bboard/models.py new file mode 100644 index 0000000..a7ac60e --- /dev/null +++ b/samplesite/bboard/models.py @@ -0,0 +1,8 @@ +from turtle import title +from django.db import models + +class Bb (models.Model): + title = models.CharField(max_length=50) + content = models.TextField(null=True, blank=True) + price = models.FloatField(null=True, blank=True) + published = models.DateTimeField(auto_now_add=True, db_index=True) diff --git a/samplesite/bboard/tests.py b/samplesite/bboard/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/samplesite/bboard/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/samplesite/bboard/urls.py b/samplesite/bboard/urls.py new file mode 100644 index 0000000..fd633e9 --- /dev/null +++ b/samplesite/bboard/urls.py @@ -0,0 +1,6 @@ +from django.urls import path +from .views import index + +urlpatterns = [ + path('', index) +] diff --git a/samplesite/bboard/views.py b/samplesite/bboard/views.py new file mode 100644 index 0000000..22e2791 --- /dev/null +++ b/samplesite/bboard/views.py @@ -0,0 +1,9 @@ +from django.http import HttpResponse + +from .models import Bb + +def index(request): + s = 'Список объявлений \r\n\r\n\r\n' + for bb in Bb.objects.order_by('-published'): + s += bb.title + '\r\n' + bb.content + '\r\n\r\n' + return HttpResponse(s, content_type = 'text/plain; charset=utf-8') diff --git a/samplesite/db.sqlite3 b/samplesite/db.sqlite3 new file mode 100644 index 0000000000000000000000000000000000000000..e0df1c8e77f4d7138275bbeb19f96d0ef835bfe1 GIT binary patch literal 139264 zcmeI54{RIPeaCqsrIRd?r$3e%$5wQr?s*lKJ!@t-9I7Tk{HNv1=Q zGD$h{x^AKDBwhckYqk~GfVErE0UK6eZqhbw({w|Nq5Ffb)X)ytpAOhCpjd(aL4mfw zx&r&XcSqjwc#;J#O*83Bz~{U7e((2wzt8)_d%t%lo`39gsiDhD)!K^IkYk=vk05y7 zA_y zS~t#1MdMPXlT198Pzp*xU8|I?I>jeWoXce|LNyeYq%6LN)*`1F>l|p_g<8JrZw(Rav zb~}^X1<2Yf(qORZ%?RsA}3T)mCme4j;Z`%`Ufwpm>@cI)Y zVlbN(Za&b^@?~S3^3l%^mJxMpZgJ-LO(!m7A3UA2&nHenhLt7~xkL@Rtk>klvlryW zi>FV^kDgmNlRbAyek6BE&R)E5c43iJp2;mu*#y!Z(OK2%^{1;f>XFy9TH&%*I}(Ye z!<}wPousVQ8)~__T&jfRqSnwGr4`+tU#hG1HR>3wlZNDcwOY34vQ#z&So&j%rQZDR zrdpOtHL7NF$+jU|O6V(EschAhN?0{fd1h!sTUzQhl5(^{qjZg|blT56RsQNkyQWe@kv!esuru=pC(=0`USAv(gPDwQGi9}}(U+{zWekj- z)FGFa?-9DAZeVD6-8(Z;x13@(P(O<~ra3ww24`l3=2H%!oH_SQ+zi|u!RqdV>E8Yv zj)?=olQUa(3xl}PFZlT&-9@v1p7neC#o+9$aO2l4e=LgJDeH2;#WO4Sb#O0XbB~(S zc}uW$gBGu7mE~&Jm$zxs?Z2El-_O>}q}Xf;H&6M*U^ON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ff --git a/samplesite/manage.py b/samplesite/manage.py new file mode 100644 index 0000000..4cd0e4f --- /dev/null +++ b/samplesite/manage.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +"""Django's command-line utility for administrative tasks.""" +import os +import sys + + +def main(): + """Run administrative tasks.""" + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'samplesite.settings') + try: + from django.core.management import execute_from_command_line + except ImportError as exc: + 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?" + ) from exc + execute_from_command_line(sys.argv) + + +if __name__ == '__main__': + main() diff --git a/samplesite/samplesite/__init__.py b/samplesite/samplesite/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/samplesite/samplesite/asgi.py b/samplesite/samplesite/asgi.py new file mode 100644 index 0000000..d76cb99 --- /dev/null +++ b/samplesite/samplesite/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for samplesite project. + +It exposes the ASGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/4.1/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'samplesite.settings') + +application = get_asgi_application() diff --git a/samplesite/samplesite/settings.py b/samplesite/samplesite/settings.py new file mode 100644 index 0000000..4f76ea5 --- /dev/null +++ b/samplesite/samplesite/settings.py @@ -0,0 +1,124 @@ +""" +Django settings for samplesite project. + +Generated by 'django-admin startproject' using Django 4.1.2. + +For more information on this file, see +https://docs.djangoproject.com/en/4.1/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/4.1/ref/settings/ +""" + +from pathlib import Path + +# Build paths inside the project like this: BASE_DIR / 'subdir'. +BASE_DIR = Path(__file__).resolve().parent.parent + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'django-insecure-3+qi7evx8fs*##g$1=+6ss*@^y)5i+hixz@bcrm1_g%78m++3=' + +# 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', + 'bboard.apps.BboardConfig', +] + +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 = 'samplesite.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 = 'samplesite.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/4.1/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': BASE_DIR / 'db.sqlite3', + } +} + + +# Password validation +# https://docs.djangoproject.com/en/4.1/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/4.1/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/4.1/howto/static-files/ + +STATIC_URL = 'static/' + +# Default primary key field type +# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field + +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' diff --git a/samplesite/samplesite/urls.py b/samplesite/samplesite/urls.py new file mode 100644 index 0000000..969d9fc --- /dev/null +++ b/samplesite/samplesite/urls.py @@ -0,0 +1,7 @@ +from django.contrib import admin +from django.urls import path, include + +urlpatterns = [ + path('admin/', admin.site.urls), + path('bboard/', include('bboard.urls')), +] diff --git a/samplesite/samplesite/wsgi.py b/samplesite/samplesite/wsgi.py new file mode 100644 index 0000000..fdf2eaa --- /dev/null +++ b/samplesite/samplesite/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for samplesite 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/4.1/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'samplesite.settings') + +application = get_wsgi_application()