From 74038618af31719ba90a0b4b3ed785f08b1fd534 Mon Sep 17 00:00:00 2001 From: Denis Istratov Date: Sat, 4 Apr 2026 21:42:07 +0300 Subject: [PATCH] hw 2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Проект пересобран под фреймворк django 2. Все html переделаны под шаблоны 3. Прокинуты urls 4. Добавлена пагинация 5. Мелкие улучшения проекта 6. Добавлены Dockerfile и docker compose --- .env.example | 2 + .gitignore | 219 +----------------- Dockerfile | 15 ++ LICENSE | 201 ---------------- README.md | 38 ++- .../js/script.js => application/__init__.py | 0 application/asgi.py | 16 ++ application/settings.py | 130 +++++++++++ application/urls.py | 7 + application/wsgi.py | 16 ++ docker-compose.yml | 11 + manage.py | 22 ++ public/index.html | 137 ----------- public/login.html | 80 ------- public/profile.html | 94 -------- public/question.html | 117 ---------- public/signup.html | 94 -------- questions/__init__.py | 0 questions/admin.py | 3 + questions/apps.py | 6 + questions/migrations/__init__.py | 0 questions/models.py | 3 + .../static/core}/css/bootstrap.min.css | 0 .../static/core}/css/style.css | 0 .../static/core}/img/profile.webp | Bin questions/static/core/js/script.js | 0 questions/templates/core/ask.html | 27 +++ .../templates/core}/base.html | 12 +- questions/templates/core/index.html | 16 ++ .../templates/core/layout/base.html | 47 ++-- questions/templates/core/login.html | 31 +++ .../templates/core/partials/pagination.html | 9 + .../templates/core/partials/question.html | 20 ++ questions/templates/core/profile.html | 35 +++ questions/templates/core/question.html | 66 ++++++ questions/templates/core/signup.html | 46 ++++ questions/tests.py | 3 + questions/urls.py | 12 + questions/views.py | 38 +++ requirements.txt | 2 + 40 files changed, 592 insertions(+), 983 deletions(-) create mode 100644 .env.example create mode 100644 Dockerfile delete mode 100644 LICENSE rename public/static/js/script.js => application/__init__.py (100%) create mode 100644 application/asgi.py create mode 100644 application/settings.py create mode 100644 application/urls.py create mode 100644 application/wsgi.py create mode 100644 docker-compose.yml create mode 100644 manage.py delete mode 100644 public/index.html delete mode 100644 public/login.html delete mode 100644 public/profile.html delete mode 100644 public/question.html delete mode 100644 public/signup.html create mode 100644 questions/__init__.py create mode 100644 questions/admin.py create mode 100644 questions/apps.py create mode 100644 questions/migrations/__init__.py create mode 100644 questions/models.py rename {public/static => questions/static/core}/css/bootstrap.min.css (100%) rename {public/static => questions/static/core}/css/style.css (100%) rename {public/static => questions/static/core}/img/profile.webp (100%) create mode 100644 questions/static/core/js/script.js create mode 100644 questions/templates/core/ask.html rename {public => questions/templates/core}/base.html (92%) create mode 100644 questions/templates/core/index.html rename public/ask.html => questions/templates/core/layout/base.html (57%) create mode 100644 questions/templates/core/login.html create mode 100644 questions/templates/core/partials/pagination.html create mode 100644 questions/templates/core/partials/question.html create mode 100644 questions/templates/core/profile.html create mode 100644 questions/templates/core/question.html create mode 100644 questions/templates/core/signup.html create mode 100644 questions/tests.py create mode 100644 questions/urls.py create mode 100644 questions/views.py create mode 100644 requirements.txt diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..435e057 --- /dev/null +++ b/.env.example @@ -0,0 +1,2 @@ +SECRET_KEY=django-insecure-1234 +DEBUG=True \ No newline at end of file diff --git a/.gitignore b/.gitignore index b0e0e41..5c27490 100644 --- a/.gitignore +++ b/.gitignore @@ -1,213 +1,10 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[codz] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -share/python-wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.nox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -*.py.cover -.hypothesis/ -.pytest_cache/ -cover/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py -db.sqlite3 -db.sqlite3-journal - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -.pybuilder/ -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# IPython -profile_default/ -ipython_config.py - -# pyenv -# For a library or package, you might want to ignore these files since the code is -# intended to run in multiple environments; otherwise, check them in: -# .python-version - -# pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock - -# UV -# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control. -# This is especially recommended for binary packages to ensure reproducibility, and is more -# commonly ignored for libraries. -#uv.lock - -# poetry -# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. -# This is especially recommended for binary packages to ensure reproducibility, and is more -# commonly ignored for libraries. -# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control -#poetry.lock -#poetry.toml - -# pdm -# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. -# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python. -# https://pdm-project.org/en/latest/usage/project/#working-with-version-control -#pdm.lock -#pdm.toml -.pdm-python -.pdm-build/ - -# pixi -# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control. -#pixi.lock -# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one -# in the .venv directory. It is recommended not to include this directory in version control. -.pixi - -# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm -__pypackages__/ - -# Celery stuff -celerybeat-schedule -celerybeat.pid - -# SageMath parsed files -*.sage.py - -# Environments -.env -.envrc -.venv -env/ +media/ venv/ -ENV/ -env.bak/ -venv.bak/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ -.dmypy.json -dmypy.json - -# Pyre type checker -.pyre/ - -# pytype static type analyzer -.pytype/ - -# Cython debug symbols -cython_debug/ - -# PyCharm -# JetBrains specific template is maintained in a separate JetBrains.gitignore that can -# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore -# and can be added to the global gitignore or merged into this file. For a more nuclear -# option (not recommended) you can uncomment the following to ignore the entire idea folder. -#.idea/ - -# Abstra -# Abstra is an AI-powered process automation framework. -# Ignore directories containing user credentials, local state, and settings. -# Learn more at https://abstra.io/docs -.abstra/ - -# Visual Studio Code -# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore -# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore -# and can be added to the global gitignore or merged into this file. However, if you prefer, -# you could uncomment the following to ignore the entire vscode folder +.venv/ +__pycache__/ +*.pyc +db.sqlite3 +*.sqlite3 +.idea/ .vscode/ - -# Ruff stuff: -.ruff_cache/ - -# PyPI configuration file -.pypirc - -# Cursor -# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to -# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data -# refer to https://docs.cursor.com/context/ignore-files -.cursorignore -.cursorindexingignore - -# Marimo -marimo/_static/ -marimo/_lsp/ -__marimo__/ - - - -.DS_Store -*.log -*.sqlite3 \ No newline at end of file +.env \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4906332 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM python:3.10-slim + +ENV PYTHONDONTWRITEBYTECODE=1 +ENV PYTHONUNBUFFERED=1 + +WORKDIR /app + +COPY ./requirements.txt ./ +RUN pip install --no-cache-dir -r requirements.txt + +COPY . . + +EXPOSE 8000 + +CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"] diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 261eeb9..0000000 --- a/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/README.md b/README.md index b0498f0..a4f6049 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,28 @@ -# 2026-VK-EDU-Web-12-Istratov-D -VK Education +## Добро пожаловать в мой репозиторий :) -## Инструкция к запуску -Индекс-файл (открыть в браузере): `/public/index.html` +Позже здесь будет проект-дз... -## HW-1: -- создан репозиторий и подкаталоги внутри -- создана базовая структура проекта (/public/*.html, /public/static/css/style.css, /public/static/js/script.js) -- подключена библиотека bootstrap локально (/public/static/css/bootstrap.min.css) (пока не использовалась, подключена на будущее) -- настроены права (protected main branch + merge только через PR — 1) -- настроен .gitignore (за основу взят шаблон для python) -- сверстаны -- сверстаны base.html, index.html, question.html, ask.html, login.html, signup.html, profile.html \ No newline at end of file +### О себе + +Я интересуюсь **backend-разработкой**, **серверными инструментами** и **микроконтроллерами**. +Пишу на Java, Python и C++, начинал с написания плагинов для Minecraft и разных полезных утилит. + +🔧 Студент VK Education, курса "Web-разработка". + + +## Запуск проекта + +### На текущей машине + +```shell +python manage.py runserver 8000 +pip install --no-cache-dir -r requirements.txt +``` + +### Docker + +```shell +docker compose up --build +``` + +Запустится именно на 127.0.0.1:8000 \ No newline at end of file diff --git a/public/static/js/script.js b/application/__init__.py similarity index 100% rename from public/static/js/script.js rename to application/__init__.py diff --git a/application/asgi.py b/application/asgi.py new file mode 100644 index 0000000..d00291c --- /dev/null +++ b/application/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for application 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/5.2/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'application.settings') + +application = get_asgi_application() diff --git a/application/settings.py b/application/settings.py new file mode 100644 index 0000000..78e374b --- /dev/null +++ b/application/settings.py @@ -0,0 +1,130 @@ +""" +Django settings for application project. + +Generated by 'django-admin startproject' using Django 5.2.12. + +For more information on this file, see +https://docs.djangoproject.com/en/5.2/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/5.2/ref/settings/ +""" +import os +from pathlib import Path +from dotenv import load_dotenv + +# Build paths inside the project like this: BASE_DIR / 'subdir'. +BASE_DIR = Path(__file__).resolve().parent.parent + +load_dotenv() +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/5.2/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = os.getenv("SECRET_KEY") + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = os.getenv("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 = 'application.urls' + +STATICFILES_DIRS = [ + BASE_DIR / 'questions' / 'static', +] + + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [BASE_DIR / 'questions' / 'templates'], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'application.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/5.2/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': BASE_DIR / 'db.sqlite3', + } +} + + +# Password validation +# https://docs.djangoproject.com/en/5.2/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/5.2/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/5.2/howto/static-files/ + +STATIC_URL = 'static/' + +STATIC_ROOT = os.path.join(BASE_DIR, 'static') + +# Default primary key field type +# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field + +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' diff --git a/application/urls.py b/application/urls.py new file mode 100644 index 0000000..bcc79ea --- /dev/null +++ b/application/urls.py @@ -0,0 +1,7 @@ +from django.contrib import admin +from django.urls import path, include + +urlpatterns = [ + path('admin/', admin.site.urls), + path('', include('questions.urls')), +] diff --git a/application/wsgi.py b/application/wsgi.py new file mode 100644 index 0000000..629909b --- /dev/null +++ b/application/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for application 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/5.2/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'application.settings') + +application = get_wsgi_application() diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..7d027e6 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,11 @@ +version: '3.8' + +services: + python-app: + build: . + container_name: django-app-container + ports: + - "8000:8000" + volumes: + - .:/app + working_dir: /app diff --git a/manage.py b/manage.py new file mode 100644 index 0000000..c3564fd --- /dev/null +++ b/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', 'application.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/public/index.html b/public/index.html deleted file mode 100644 index cf03609..0000000 --- a/public/index.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - VkDesk | Fresh Questions - - - - - -
-
-
-

Fresh Questions

- Top Today -
- - - - - - - - -
- -
- - - - - - - - - diff --git a/public/login.html b/public/login.html deleted file mode 100644 index 3fdea3e..0000000 --- a/public/login.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - VkDesk ' Sign In - - - - - -
-
-
-

Sign In

-
- -

Sorry, wrong password!

- -
-
- - -
-
- - -
-
- -
- create new account -
-
- -
- - - - - - - - - - diff --git a/public/profile.html b/public/profile.html deleted file mode 100644 index d63a36c..0000000 --- a/public/profile.html +++ /dev/null @@ -1,94 +0,0 @@ - - - - - VkDesk | Settings - - - - - -
-
-
-

Profile: Dr. Pepper

-
- -
-
- - -
-
- - -
-
- - -
-
- -
avatar
-
-
- - -
-
- -
-
-
- -
- - - - - - - - - diff --git a/public/question.html b/public/question.html deleted file mode 100644 index 0a50c71..0000000 --- a/public/question.html +++ /dev/null @@ -1,117 +0,0 @@ - - - - - VkDesk | Question - - - - - -
-
-
-
-
avatar
-
- 5 - ^' -
-
-
-
How to build a moon park ?
-

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.

-
- Tags: - black-jack - bender -
-
-
- -
-
-
avatar
-
- 5 - ^' -
-
-
-

First of all I would like to thank you for the invitation to participate in such a ... Russia is the huge territory which in many respects needs to be render habitable.

-
- - Correct! -
-
-
- -
-
-
avatar
-
- 3 - ^' -
-
-
-

First of all I would like to thank you for the invitation to participate in such a ... Russia is the huge territory which in many respects needs to be render habitable.

-
- - Correct! -
-
-
- -
- - - -
-
- -
- - - - - - - - - diff --git a/public/signup.html b/public/signup.html deleted file mode 100644 index f3758fa..0000000 --- a/public/signup.html +++ /dev/null @@ -1,94 +0,0 @@ - - - - - VkDesk | Create Account - - - - - -
-
-
-

Create Account

-
- -

Sorry, this email address already registered!

- -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- -
-
-
- -
- - - - - - - - - diff --git a/questions/__init__.py b/questions/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/questions/admin.py b/questions/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/questions/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/questions/apps.py b/questions/apps.py new file mode 100644 index 0000000..3079f26 --- /dev/null +++ b/questions/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class QuestionsConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'questions' diff --git a/questions/migrations/__init__.py b/questions/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/questions/models.py b/questions/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/questions/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/public/static/css/bootstrap.min.css b/questions/static/core/css/bootstrap.min.css similarity index 100% rename from public/static/css/bootstrap.min.css rename to questions/static/core/css/bootstrap.min.css diff --git a/public/static/css/style.css b/questions/static/core/css/style.css similarity index 100% rename from public/static/css/style.css rename to questions/static/core/css/style.css diff --git a/public/static/img/profile.webp b/questions/static/core/img/profile.webp similarity index 100% rename from public/static/img/profile.webp rename to questions/static/core/img/profile.webp diff --git a/questions/static/core/js/script.js b/questions/static/core/js/script.js new file mode 100644 index 0000000..e69de29 diff --git a/questions/templates/core/ask.html b/questions/templates/core/ask.html new file mode 100644 index 0000000..5d02db9 --- /dev/null +++ b/questions/templates/core/ask.html @@ -0,0 +1,27 @@ +{% extends 'core/layout/base.html' %} +{% load static %} + +{% block content %} + +
+

Ask a Question

+
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+{% endblock %} diff --git a/public/base.html b/questions/templates/core/base.html similarity index 92% rename from public/base.html rename to questions/templates/core/base.html index b0b03e4..92f7d13 100644 --- a/public/base.html +++ b/questions/templates/core/base.html @@ -4,22 +4,22 @@ VkDesk | Fresh Questions - +