Added Django to project and moved react files to 'sm_react' folder

This commit is contained in:
username 2021-01-13 12:24:10 +01:00
parent dccedec72a
commit 0995714950
35 changed files with 227 additions and 18 deletions

View File

@ -1 +1 @@
[{"/Users/user/repos/guillotine-cut/src/index.js":"1","/Users/user/repos/guillotine-cut/src/App.js":"2","/Users/user/repos/guillotine-cut/src/Navbar.js":"3","/Users/user/repos/guillotine-cut/src/MainSection.js":"4","/Users/user/repos/guillotine-cut/src/MainSheet.js":"5"},{"size":222,"mtime":1607967045945,"results":"6","hashOfConfig":"7"},{"size":318,"mtime":1607965957763,"results":"8","hashOfConfig":"7"},{"size":250,"mtime":1607968257270,"results":"9","hashOfConfig":"7"},{"size":246,"mtime":1607968424050,"results":"10","hashOfConfig":"7"},{"size":214,"mtime":1609099097125,"results":"11","hashOfConfig":"7"},{"filePath":"12","messages":"13","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"l6z3kw",{"filePath":"14","messages":"15","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"16","messages":"17","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"18","messages":"19","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"20","messages":"21","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/Users/user/repos/guillotine-cut/src/index.js",[],"/Users/user/repos/guillotine-cut/src/App.js",[],"/Users/user/repos/guillotine-cut/src/Navbar.js",[],"/Users/user/repos/guillotine-cut/src/MainSection.js",[],"/Users/user/repos/guillotine-cut/src/MainSheet.js",[]]
[{"/Users/user/repos/sort-measurer/src/index.js":"1","/Users/user/repos/sort-measurer/src/App.js":"2","/Users/user/repos/sort-measurer/src/Navbar.js":"3","/Users/user/repos/sort-measurer/src/MainSection.js":"4","/Users/user/repos/sort-measurer/src/MainSheet.js":"5"},{"size":222,"mtime":1607967045945,"results":"6","hashOfConfig":"7"},{"size":318,"mtime":1607965957763,"results":"8","hashOfConfig":"7"},{"size":290,"mtime":1610490068978,"results":"9","hashOfConfig":"7"},{"size":246,"mtime":1607968424050,"results":"10","hashOfConfig":"7"},{"size":214,"mtime":1609099097125,"results":"11","hashOfConfig":"7"},{"filePath":"12","messages":"13","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"14"},"ff9ndh",{"filePath":"15","messages":"16","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"14"},{"filePath":"17","messages":"18","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"19","usedDeprecatedRules":"14"},{"filePath":"20","messages":"21","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"14"},{"filePath":"22","messages":"23","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/Users/user/repos/sort-measurer/src/index.js",[],["24","25"],"/Users/user/repos/sort-measurer/src/App.js",[],"/Users/user/repos/sort-measurer/src/Navbar.js",["26"],"import React from \"react\";\nimport \"./Navbar.css\";\nimport styled from \"styled-components\";\n\nexport default function Navbar() {\n return (\n <div className=\"Navbar\">\n <h2>Navbar</h2>\n <p>Example</p>\n <p>Example</p>\n <p>Example</p>\n <p>Example</p>\n </div>\n );\n}\n","/Users/user/repos/sort-measurer/src/MainSection.js",[],"/Users/user/repos/sort-measurer/src/MainSheet.js",[],{"ruleId":"27","replacedBy":"28"},{"ruleId":"29","replacedBy":"30"},{"ruleId":"31","severity":1,"message":"32","line":3,"column":8,"nodeType":"33","messageId":"34","endLine":3,"endColumn":14},"no-native-reassign",["35"],"no-negated-in-lhs",["36"],"no-unused-vars","'styled' is defined but never used.","Identifier","unusedVar","no-global-assign","no-unsafe-negation"]

6
.gitignore vendored
View File

@ -1,15 +1,15 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/sm_react/node_modules
/.pnp
.pnp.js
# testing
/coverage
/sm_react/coverage
# production
/build
/sm_react/build
# misc
.DS_Store

0
db.sqlite3 Normal file
View File

22
manage.py Executable file
View File

@ -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', 'sm_django.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()

0
sm_django/__init__.py Normal file
View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

16
sm_django/asgi.py Normal file
View File

@ -0,0 +1,16 @@
"""
ASGI config for sm_django 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/3.1/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sm_django.settings')
application = get_asgi_application()

127
sm_django/settings.py Normal file
View File

@ -0,0 +1,127 @@
"""
Django settings for sm_django project.
Generated by 'django-admin startproject' using Django 3.1.5.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
from pathlib import Path
import os
# 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/3.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '%o(h$_y53$1g+ygja(1p(1+27wyp5v@h!l&4c8h--9gl)ore1k'
# 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',
]
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 = 'sm_django.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(BASE_DIR, 'sm_react/build'),
],
'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 = 'sm_django.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
# Password validation
# https://docs.djangoproject.com/en/3.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/3.1/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.1/howto/static-files/
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'sm_react/build/static'),
]

23
sm_django/urls.py Normal file
View File

@ -0,0 +1,23 @@
"""sm_django URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.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
from django.views.generic import TemplateView
urlpatterns = [
path('admin/', admin.site.urls),
path('', TemplateView.as_view(template_name='index.html')),
]

16
sm_django/wsgi.py Normal file
View File

@ -0,0 +1,16 @@
"""
WSGI config for sm_django 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/3.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sm_django.settings')
application = get_wsgi_application()

1
sm_react/.eslintcache Normal file
View File

@ -0,0 +1 @@
[{"/Users/user/repos/sort-measurer/sm_django/sm_react/src/index.js":"1","/Users/user/repos/sort-measurer/sm_django/sm_react/src/App.js":"2","/Users/user/repos/sort-measurer/sm_django/sm_react/src/MainSection.js":"3","/Users/user/repos/sort-measurer/sm_django/sm_react/src/Navbar.js":"4","/Users/user/repos/sort-measurer/sm_django/sm_react/src/MainSheet.js":"5"},{"size":222,"mtime":1607967045945,"results":"6","hashOfConfig":"7"},{"size":318,"mtime":1607965957763,"results":"8","hashOfConfig":"7"},{"size":246,"mtime":1607968424050,"results":"9","hashOfConfig":"7"},{"size":290,"mtime":1610490068978,"results":"10","hashOfConfig":"7"},{"size":214,"mtime":1609099097125,"results":"11","hashOfConfig":"7"},{"filePath":"12","messages":"13","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"jqi4ba",{"filePath":"14","messages":"15","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"16","messages":"17","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"18","messages":"19","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"20","messages":"21","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/Users/user/repos/sort-measurer/sm_django/sm_react/src/index.js",[],"/Users/user/repos/sort-measurer/sm_django/sm_react/src/App.js",[],"/Users/user/repos/sort-measurer/sm_django/sm_react/src/MainSection.js",[],"/Users/user/repos/sort-measurer/sm_django/sm_react/src/Navbar.js",["22"],"/Users/user/repos/sort-measurer/sm_django/sm_react/src/MainSheet.js",[],{"ruleId":"23","severity":1,"message":"24","line":3,"column":8,"nodeType":"25","messageId":"26","endLine":3,"endColumn":14},"no-unused-vars","'styled' is defined but never used.","Identifier","unusedVar"]

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

6
sm_react/src/App.css Normal file
View File

@ -0,0 +1,6 @@
.App {
font-family: "Nunito", sans-serif;
background: #253237;
color: white;
display: flex;
}

View File

@ -1,5 +1,5 @@
.MainSection {
background: cornflowerblue;
background: #363c58;
text-align: center;
flex: 1;
/* height of the whole site (both columns) */

View File

@ -1,7 +1,8 @@
.MainSheet {
width: 60vw;
width: 65vw;
height: 30vw;
border: solid mediumslateblue;
background: #3f476c;
border: solid #9b1cfc;
margin: auto;
position: relative;
}

5
sm_react/src/Navbar.css Normal file
View File

@ -0,0 +1,5 @@
.Navbar {
background: #191e36;
text-align: center;
flex: 0 0 7vw;
}

View File

@ -1,5 +1,6 @@
import React from "react";
import "./Navbar.css";
import styled from "styled-components";
export default function Navbar() {
return (

View File

@ -1,7 +1,8 @@
@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@200&display=swap");
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Nunito",
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;

View File

@ -1,5 +0,0 @@
.App {
background: #253237;
color: #fafafa;
display: flex;
}

View File

@ -1,5 +0,0 @@
.Navbar {
background: cadetblue;
text-align: center;
flex: 0 0 15vw;
}