before send to remote

This commit is contained in:
5408 changed files with 652023 additions and 0 deletions

1
example/.env.example Normal file
View File

@@ -0,0 +1 @@
ENVIRON_VAR="Value1"

0
example/__init__.py Normal file
View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

6
example/apps.py Normal file
View File

@@ -0,0 +1,6 @@
from django.apps import AppConfig
class ExampleConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "example"

16
example/asgi.py Normal file
View File

@@ -0,0 +1,16 @@
"""
ASGI config for example 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", "example.settings")
application = get_asgi_application()

154
example/settings.py Normal file
View File

@@ -0,0 +1,154 @@
"""
Django settings for example project.
Generated by 'django-admin startproject' using Django 4.1.
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/
"""
import os
from pathlib import Path
import environ
CSRF_TRUSTED_ORIGINS = ["http://localhost:1337"]
SOME_VAR = os.environ.get("SOME_ENV_VAR")
# print("DEFAULT_DEBUG", SOME_VAR)
env = environ.Env(
# set casting, default value
ENVIRON_VAR=(str, "django.db.backends.postgresql"),
)
# reading .env file
environ.Env.read_env()
# 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 = os.environ.get("SECRET_KEY")
DEBUG = int(os.environ.get("DEBUG", default=0))
# 'DJANGO_ALLOWED_HOSTS' should be a single string of hosts with a space between each.
# For example: 'DJANGO_ALLOWED_HOSTS=localhost 127.0.0.1 [::1]'
ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS", "localhost").split(" ")
# static files
STATIC_URL = "/static/"
STATIC_ROOT = BASE_DIR / "staticfiles"
# mediafiles
MEDIA_URL = "/media/"
MEDIA_ROOT = BASE_DIR / "mediafiles"
STATICFILES_DIRS = [ BASE_DIR / "static"]
# Application definition
INSTALLED_APPS = [
"example.apps.ExampleConfig",
"polls.apps.PollsConfig",
"upload.apps.UploadConfig",
"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 = "example.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 = "example.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",
# }
# }
DATABASES = {
"default": {
"ENGINE": os.environ.get("SQL_ENGINE", "django.db.backends.sqlite3"),
"NAME": os.environ.get("SQL_DATABASE", BASE_DIR / "db.sqlite3"),
"USER": os.environ.get("SQL_USER", "user"),
"PASSWORD": os.environ.get("SQL_PASSWORD", "password"),
"HOST": os.environ.get("SQL_HOST", "localhost"),
"PORT": os.environ.get("SQL_PORT", "5432"),
}
}
# 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 = "Asia/Omsk"
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"

View File

@@ -0,0 +1,257 @@
<!doctype html>
{% load static %}
<html lang="ru">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Example Django</title>
<!-- Bootstrap core CSS -->
<link rel="stylesheet" type="text/css" href="{% static "vendor/css/bootstrap.min.css" %}"/>
<!-- Custom styles for this page -->
<link rel="stylesheet" type="text/css" href="{% static "base/main.css" %}" />
</head>
<body>
<header>
<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
<div class="container-fluid">
<a class="navbar-brand" href="/">Example</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse"
aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarCollapse">
<ul class="navbar-nav mr-auto mb-2 mb-md-0">
<li class="nav-item active">
<a class="nav-link" aria-current="page" href="/">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/polls">Polls</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/upload">Upload</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/admin">Adminka</a>
</li>
</ul>
<!-- <form class="d-flex">
<input class="form-control mr-2" type="search" placeholder="Поиск" aria-label="Search">
<button class="btn btn-outline-success" type="submit">ОК</button>
</form> -->
</div>
</div>
</nav>
</header>
<main>
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<svg class="bd-placeholder-img" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg"
preserveaspectratio="xMidYMid slice" role="img" focusable="false">
<rect width="100%" height="100%" fill="#777"></rect>
</svg>
<div class="container">
<div class="carousel-caption text-left">
<h1>Пример заголовка.</h1>
<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta
gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Зарегистрироваться</a></p>
</div>
</div>
</div>
<div class="carousel-item">
<svg class="bd-placeholder-img" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg"
preserveaspectratio="xMidYMid slice" role="img" focusable="false">
<rect width="100%" height="100%" fill="#777"></rect>
</svg>
<div class="container">
<div class="carousel-caption">
<h1>Another Пример заголовка.</h1>
<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta
gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Подробнее</a></p>
</div>
</div>
</div>
<div class="carousel-item">
<svg class="bd-placeholder-img" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg"
preserveaspectratio="xMidYMid slice" role="img" focusable="false">
<rect width="100%" height="100%" fill="#777"></rect>
</svg>
<div class="container">
<div class="carousel-caption text-right">
<h1>One more for good measure.</h1>
<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta
gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Открыть галерею</a></p>
</div>
</div>
</div>
</div>
<a class="carousel-control-prev" href="#myCarousel" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#myCarousel" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
<!-- Marketing messaging and featurettes
================================================== -->
<!-- Wrap the rest of the page in another container to center all the content. -->
<div class="container marketing">
<!-- Three columns of text below the carousel -->
<div class="row">
<div class="col-lg-4">
<svg class="bd-placeholder-img rounded-circle" width="140" height="140"
xmlns="http://www.w3.org/2000/svg" aria-label="Placeholder: 140x140"
preserveaspectratio="xMidYMid slice" role="img" focusable="false">
<title>Placeholder</title>
<rect width="100%" height="100%" fill="#777"></rect><text x="50%" y="50%" fill="#777"
dy=".3em">140x140</text>
</svg>
<h2>Заголовок</h2>
<p>Donec sed odio dui. Etiam porta sem malesuada magna mollis euismod. Nullam id dolor id nibh
ultricies vehicula ut id elit. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.
Praesent commodo cursus magna.</p>
<p><a class="btn btn-secondary" href="#" role="button">Подробнее &raquo;</a></p>
</div><!-- /.col-lg-4 -->
<div class="col-lg-4">
<svg class="bd-placeholder-img rounded-circle" width="140" height="140"
xmlns="http://www.w3.org/2000/svg" aria-label="Placeholder: 140x140"
preserveaspectratio="xMidYMid slice" role="img" focusable="false">
<title>Placeholder</title>
<rect width="100%" height="100%" fill="#777"></rect><text x="50%" y="50%" fill="#777"
dy=".3em">140x140</text>
</svg>
<h2>Заголовок</h2>
<p>Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.
Cras mattis consectetur purus sit amet fermentum. Fusce dapibus, tellus ac cursus commodo,
tortor mauris condimentum nibh.</p>
<p><a class="btn btn-secondary" href="#" role="button">Подробнее &raquo;</a></p>
</div><!-- /.col-lg-4 -->
<div class="col-lg-4">
<svg class="bd-placeholder-img rounded-circle" width="140" height="140"
xmlns="http://www.w3.org/2000/svg" aria-label="Placeholder: 140x140"
preserveaspectratio="xMidYMid slice" role="img" focusable="false">
<title>Placeholder</title>
<rect width="100%" height="100%" fill="#777"></rect><text x="50%" y="50%" fill="#777"
dy=".3em">140x140</text>
</svg>
<h2>Заголовок</h2>
<p>Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id
ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris
condimentum nibh, ut fermentum massa justo sit amet risus.</p>
<p><a class="btn btn-secondary" href="#" role="button">Подробнее &raquo;</a></p>
</div><!-- /.col-lg-4 -->
</div><!-- /.row -->
<!-- START THE FEATURETTES -->
<hr class="featurette-divider">
<div class="row featurette">
<div class="col-md-7">
<h2 class="featurette-Заголовок">First featurette Заголовок. <span class="text-muted">Itll blow
your mind.</span></h2>
<p class="lead">Donec ullamcorper nulla non metus auctor fringilla. Vestibulum id ligula porta felis
euismod semper. Praesent commodo cursus magna, vel scelerisque nisl consectetur. Fusce dapibus,
tellus ac cursus commodo.</p>
</div>
<div class="col-md-5">
<svg class="bd-placeholder-img bd-placeholder-img-lg featurette-image img-fluid mx-auto" width="500"
height="500" xmlns="http://www.w3.org/2000/svg" aria-label="Placeholder: 500x500"
preserveaspectratio="xMidYMid slice" role="img" focusable="false">
<title>Placeholder</title>
<rect width="100%" height="100%" fill="#eee"></rect><text x="50%" y="50%" fill="#aaa"
dy=".3em">500x500</text>
</svg>
</div>
</div>
<hr class="featurette-divider">
<div class="row featurette">
<div class="col-md-7 order-md-2">
<h2 class="featurette-Заголовок">Oh yeah, its that good. <span class="text-muted">See for
yourself.</span></h2>
<p class="lead">Donec ullamcorper nulla non metus auctor fringilla. Vestibulum id ligula porta felis
euismod semper. Praesent commodo cursus magna, vel scelerisque nisl consectetur. Fusce dapibus,
tellus ac cursus commodo.</p>
</div>
<div class="col-md-5 order-md-1">
<svg class="bd-placeholder-img bd-placeholder-img-lg featurette-image img-fluid mx-auto" width="500"
height="500" xmlns="http://www.w3.org/2000/svg" aria-label="Placeholder: 500x500"
preserveaspectratio="xMidYMid slice" role="img" focusable="false">
<title>Placeholder</title>
<rect width="100%" height="100%" fill="#eee"></rect><text x="50%" y="50%" fill="#aaa"
dy=".3em">500x500</text>
</svg>
</div>
</div>
<hr class="featurette-divider">
<div class="row featurette">
<div class="col-md-7">
<h2 class="featurette-Заголовок">And lastly, this one. <span class="text-muted">Checkmate.</span>
</h2>
<p class="lead">Donec ullamcorper nulla non metus auctor fringilla. Vestibulum id ligula porta felis
euismod semper. Praesent commodo cursus magna, vel scelerisque nisl consectetur. Fusce dapibus,
tellus ac cursus commodo.</p>
</div>
<div class="col-md-5">
<svg class="bd-placeholder-img bd-placeholder-img-lg featurette-image img-fluid mx-auto" width="500"
height="500" xmlns="http://www.w3.org/2000/svg" aria-label="Placeholder: 500x500"
preserveaspectratio="xMidYMid slice" role="img" focusable="false">
<title>Placeholder</title>
<rect width="100%" height="100%" fill="#eee"></rect><text x="50%" y="50%" fill="#aaa"
dy=".3em">500x500</text>
</svg>
</div>
</div>
<hr class="featurette-divider">
<!-- /END THE FEATURETTES -->
</div><!-- /.container -->
<!-- FOOTER -->
<footer class="container">
<p class="float-right"><a href="#">Наверх</a></p>
<p>&copy; 2017-2020 Company, Inc. &middot; <a href="#">Privacy</a> &middot; <a href="#">Terms</a></p>
</footer>
</main>
<script src="{% static "vendor/js/bootstrap.bundle.min.js" %}></script>
</body>
</html>

33
example/urls.py Normal file
View File

@@ -0,0 +1,33 @@
"""example URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/4.1/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.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
from django.views.generic.base import TemplateView
from . import views
app_name = 'example'
urlpatterns = [
path('polls/', include('polls.urls')),
path("upload/", include('upload.urls')),
path("admin/", admin.site.urls),
path("", views.index, name='index'),
]
if bool(settings.DEBUG):
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

9
example/views.py Normal file
View File

@@ -0,0 +1,9 @@
# from django.shortcuts import render
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import get_object_or_404, render
from django.urls import reverse
from django.views import generic
def index(request):
return render(request, 'example/index.html')

16
example/wsgi.py Normal file
View File

@@ -0,0 +1,16 @@
"""
WSGI config for example 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", "example.settings")
application = get_wsgi_application()