Showing
19 changed files
with
348 additions
and
0 deletions
RF_project/ReturnFarm/__init__.py
0 → 100644
File mode changed
RF_project/ReturnFarm/asgi.py
0 → 100644
| 1 | +""" | ||
| 2 | +ASGI config for ReturnFarm project. | ||
| 3 | + | ||
| 4 | +It exposes the ASGI callable as a module-level variable named ``application``. | ||
| 5 | + | ||
| 6 | +For more information on this file, see | ||
| 7 | +https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/ | ||
| 8 | +""" | ||
| 9 | + | ||
| 10 | +import os | ||
| 11 | + | ||
| 12 | +from django.core.asgi import get_asgi_application | ||
| 13 | + | ||
| 14 | +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ReturnFarm.settings') | ||
| 15 | + | ||
| 16 | +application = get_asgi_application() |
RF_project/ReturnFarm/settings.py
0 → 100644
| 1 | +""" | ||
| 2 | +Django settings for ReturnFarm project. | ||
| 3 | + | ||
| 4 | +Generated by 'django-admin startproject' using Django 3.0.6. | ||
| 5 | + | ||
| 6 | +For more information on this file, see | ||
| 7 | +https://docs.djangoproject.com/en/3.0/topics/settings/ | ||
| 8 | + | ||
| 9 | +For the full list of settings and their values, see | ||
| 10 | +https://docs.djangoproject.com/en/3.0/ref/settings/ | ||
| 11 | +""" | ||
| 12 | + | ||
| 13 | +import os | ||
| 14 | + | ||
| 15 | +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) | ||
| 16 | +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | ||
| 17 | + | ||
| 18 | + | ||
| 19 | +# Quick-start development settings - unsuitable for production | ||
| 20 | +# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ | ||
| 21 | + | ||
| 22 | +# SECURITY WARNING: keep the secret key used in production secret! | ||
| 23 | +SECRET_KEY = 'ph*v6_rhrfblbgme=rb@5(!jpp0i043p&q9km#)8acj$0*v08f' | ||
| 24 | + | ||
| 25 | +# SECURITY WARNING: don't run with debug turned on in production! | ||
| 26 | +DEBUG = True | ||
| 27 | + | ||
| 28 | +ALLOWED_HOSTS = [] | ||
| 29 | + | ||
| 30 | + | ||
| 31 | +# Application definition | ||
| 32 | + | ||
| 33 | +INSTALLED_APPS = [ | ||
| 34 | + 'django.contrib.admin', | ||
| 35 | + 'django.contrib.auth', | ||
| 36 | + 'django.contrib.contenttypes', | ||
| 37 | + 'django.contrib.sessions', | ||
| 38 | + 'django.contrib.messages', | ||
| 39 | + 'django.contrib.staticfiles', | ||
| 40 | + 'market_analysis', | ||
| 41 | +] | ||
| 42 | + | ||
| 43 | +MIDDLEWARE = [ | ||
| 44 | + 'django.middleware.security.SecurityMiddleware', | ||
| 45 | + 'django.contrib.sessions.middleware.SessionMiddleware', | ||
| 46 | + 'django.middleware.common.CommonMiddleware', | ||
| 47 | + 'django.middleware.csrf.CsrfViewMiddleware', | ||
| 48 | + 'django.contrib.auth.middleware.AuthenticationMiddleware', | ||
| 49 | + 'django.contrib.messages.middleware.MessageMiddleware', | ||
| 50 | + 'django.middleware.clickjacking.XFrameOptionsMiddleware', | ||
| 51 | +] | ||
| 52 | + | ||
| 53 | +ROOT_URLCONF = 'ReturnFarm.urls' | ||
| 54 | + | ||
| 55 | +TEMPLATES = [ | ||
| 56 | + { | ||
| 57 | + 'BACKEND': 'django.template.backends.django.DjangoTemplates', | ||
| 58 | + 'DIRS': [], | ||
| 59 | + 'APP_DIRS': True, | ||
| 60 | + 'OPTIONS': { | ||
| 61 | + 'context_processors': [ | ||
| 62 | + 'django.template.context_processors.debug', | ||
| 63 | + 'django.template.context_processors.request', | ||
| 64 | + 'django.contrib.auth.context_processors.auth', | ||
| 65 | + 'django.contrib.messages.context_processors.messages', | ||
| 66 | + ], | ||
| 67 | + }, | ||
| 68 | + }, | ||
| 69 | +] | ||
| 70 | + | ||
| 71 | +WSGI_APPLICATION = 'ReturnFarm.wsgi.application' | ||
| 72 | + | ||
| 73 | + | ||
| 74 | +# Database | ||
| 75 | +# https://docs.djangoproject.com/en/3.0/ref/settings/#databases | ||
| 76 | + | ||
| 77 | +DATABASES = { | ||
| 78 | + 'default': { | ||
| 79 | + 'ENGINE': 'django.db.backends.postgresql', | ||
| 80 | + 'NAME': 'mrkt_analysis', | ||
| 81 | + 'USER': 'mrktanaly', | ||
| 82 | + 'PASSWORD' : 'mrktanaly', | ||
| 83 | + 'HOST' : 'localhost', | ||
| 84 | + 'PORT' : '5433', | ||
| 85 | + } | ||
| 86 | +} | ||
| 87 | + | ||
| 88 | + | ||
| 89 | +# Password validation | ||
| 90 | +# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators | ||
| 91 | + | ||
| 92 | +AUTH_PASSWORD_VALIDATORS = [ | ||
| 93 | + { | ||
| 94 | + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', | ||
| 95 | + }, | ||
| 96 | + { | ||
| 97 | + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', | ||
| 98 | + }, | ||
| 99 | + { | ||
| 100 | + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', | ||
| 101 | + }, | ||
| 102 | + { | ||
| 103 | + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', | ||
| 104 | + }, | ||
| 105 | +] | ||
| 106 | + | ||
| 107 | + | ||
| 108 | +# Internationalization | ||
| 109 | +# https://docs.djangoproject.com/en/3.0/topics/i18n/ | ||
| 110 | + | ||
| 111 | +LANGUAGE_CODE = 'en-us' | ||
| 112 | + | ||
| 113 | +TIME_ZONE = 'UTC' | ||
| 114 | + | ||
| 115 | +USE_I18N = True | ||
| 116 | + | ||
| 117 | +USE_L10N = True | ||
| 118 | + | ||
| 119 | +USE_TZ = True | ||
| 120 | + | ||
| 121 | + | ||
| 122 | +# Static files (CSS, JavaScript, Images) | ||
| 123 | +# https://docs.djangoproject.com/en/3.0/howto/static-files/ | ||
| 124 | + | ||
| 125 | +STATIC_URL = '/static/' | ||
| 126 | +STATIC_ROOT = os.path.join(BASE_DIR, 'static') | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
RF_project/ReturnFarm/urls.py
0 → 100644
| 1 | +"""ReturnFarm URL Configuration | ||
| 2 | + | ||
| 3 | +The `urlpatterns` list routes URLs to views. For more information please see: | ||
| 4 | + https://docs.djangoproject.com/en/3.0/topics/http/urls/ | ||
| 5 | +Examples: | ||
| 6 | +Function views | ||
| 7 | + 1. Add an import: from my_app import views | ||
| 8 | + 2. Add a URL to urlpatterns: path('', views.home, name='home') | ||
| 9 | +Class-based views | ||
| 10 | + 1. Add an import: from other_app.views import Home | ||
| 11 | + 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') | ||
| 12 | +Including another URLconf | ||
| 13 | + 1. Import the include() function: from django.urls import include, path | ||
| 14 | + 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) | ||
| 15 | +""" | ||
| 16 | +from django.contrib import admin | ||
| 17 | +from django.urls import path,include | ||
| 18 | + | ||
| 19 | +urlpatterns = [ | ||
| 20 | + path('admin/', admin.site.urls), | ||
| 21 | + path('market_analysis/', include('market_analysis.urls')), | ||
| 22 | +] |
RF_project/ReturnFarm/wsgi.py
0 → 100644
| 1 | +""" | ||
| 2 | +WSGI config for ReturnFarm project. | ||
| 3 | + | ||
| 4 | +It exposes the WSGI callable as a module-level variable named ``application``. | ||
| 5 | + | ||
| 6 | +For more information on this file, see | ||
| 7 | +https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/ | ||
| 8 | +""" | ||
| 9 | + | ||
| 10 | +import os | ||
| 11 | + | ||
| 12 | +from django.core.wsgi import get_wsgi_application | ||
| 13 | + | ||
| 14 | +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ReturnFarm.settings') | ||
| 15 | + | ||
| 16 | +application = get_wsgi_application() |
RF_project/manage.py
0 → 100644
| 1 | +#!/usr/bin/env python | ||
| 2 | +"""Django's command-line utility for administrative tasks.""" | ||
| 3 | +import os | ||
| 4 | +import sys | ||
| 5 | + | ||
| 6 | + | ||
| 7 | +def main(): | ||
| 8 | + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ReturnFarm.settings') | ||
| 9 | + try: | ||
| 10 | + from django.core.management import execute_from_command_line | ||
| 11 | + except ImportError as exc: | ||
| 12 | + raise ImportError( | ||
| 13 | + "Couldn't import Django. Are you sure it's installed and " | ||
| 14 | + "available on your PYTHONPATH environment variable? Did you " | ||
| 15 | + "forget to activate a virtual environment?" | ||
| 16 | + ) from exc | ||
| 17 | + execute_from_command_line(sys.argv) | ||
| 18 | + | ||
| 19 | + | ||
| 20 | +if __name__ == '__main__': | ||
| 21 | + main() |
RF_project/market_analysis/__init__.py
0 → 100644
File mode changed
RF_project/market_analysis/admin.py
0 → 100644
RF_project/market_analysis/apps.py
0 → 100644
| 1 | +# Generated by Django 3.0.6 on 2020-05-18 03:21 | ||
| 2 | + | ||
| 3 | +from django.db import migrations, models | ||
| 4 | + | ||
| 5 | + | ||
| 6 | +class Migration(migrations.Migration): | ||
| 7 | + | ||
| 8 | + initial = True | ||
| 9 | + | ||
| 10 | + dependencies = [ | ||
| 11 | + ] | ||
| 12 | + | ||
| 13 | + operations = [ | ||
| 14 | + migrations.CreateModel( | ||
| 15 | + name='RT_edu', | ||
| 16 | + fields=[ | ||
| 17 | + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
| 18 | + ('city', models.CharField(max_length=5)), | ||
| 19 | + ('cntr', models.CharField(max_length=10)), | ||
| 20 | + ('edu_name', models.CharField(max_length=50)), | ||
| 21 | + ('edu_center', models.CharField(max_length=30)), | ||
| 22 | + ('edu_start', models.DateField()), | ||
| 23 | + ('edu_end', models.DateField()), | ||
| 24 | + ('edu_time', models.IntegerField()), | ||
| 25 | + ('edu_infocall', models.CharField(max_length=15)), | ||
| 26 | + ], | ||
| 27 | + ), | ||
| 28 | + ] |
| 1 | +# Generated by Django 3.0.6 on 2020-05-18 04:31 | ||
| 2 | + | ||
| 3 | +from django.db import migrations, models | ||
| 4 | + | ||
| 5 | + | ||
| 6 | +class Migration(migrations.Migration): | ||
| 7 | + | ||
| 8 | + dependencies = [ | ||
| 9 | + ('market_analysis', '0001_initial'), | ||
| 10 | + ] | ||
| 11 | + | ||
| 12 | + operations = [ | ||
| 13 | + migrations.AlterField( | ||
| 14 | + model_name='rt_edu', | ||
| 15 | + name='edu_infocall', | ||
| 16 | + field=models.CharField(max_length=30), | ||
| 17 | + ), | ||
| 18 | + ] |
| 1 | +# Generated by Django 3.0.6 on 2020-05-18 04:32 | ||
| 2 | + | ||
| 3 | +from django.db import migrations, models | ||
| 4 | + | ||
| 5 | + | ||
| 6 | +class Migration(migrations.Migration): | ||
| 7 | + | ||
| 8 | + dependencies = [ | ||
| 9 | + ('market_analysis', '0002_auto_20200518_1331'), | ||
| 10 | + ] | ||
| 11 | + | ||
| 12 | + operations = [ | ||
| 13 | + migrations.AlterField( | ||
| 14 | + model_name='rt_edu', | ||
| 15 | + name='city', | ||
| 16 | + field=models.CharField(max_length=7), | ||
| 17 | + ), | ||
| 18 | + migrations.AlterField( | ||
| 19 | + model_name='rt_edu', | ||
| 20 | + name='cntr', | ||
| 21 | + field=models.CharField(max_length=7), | ||
| 22 | + ), | ||
| 23 | + ] |
File mode changed
RF_project/market_analysis/models.py
0 → 100644
| 1 | +from django.db import models | ||
| 2 | + | ||
| 3 | +# Create your models here. | ||
| 4 | + | ||
| 5 | +class RT_edu(models.Model): | ||
| 6 | + city = models.CharField(max_length=7) | ||
| 7 | + cntr = models.CharField(max_length=7) | ||
| 8 | + edu_name = models.CharField(max_length=50) | ||
| 9 | + edu_center = models.CharField(max_length=30) | ||
| 10 | + edu_start = models.DateField() | ||
| 11 | + edu_end = models.DateField() | ||
| 12 | + edu_time = models.IntegerField() | ||
| 13 | + edu_infocall = models.CharField(max_length=30) |
| 1 | +#mapid{height: 180px;} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +<html> | ||
| 2 | + <head> | ||
| 3 | + <!-- link에 들어가 있는건 지도 데이터를 위한 css 파일 --> | ||
| 4 | + <!-- script에 들어가 있는건 지도 데이터를 위한 js 파일 --> | ||
| 5 | + <!-- 직접 다운받아 넣을 수도 있는데 우선은 그냥 웹에서 불러올 수 있도록 해놨다. --> | ||
| 6 | + <link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css" /> | ||
| 7 | + <script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js"></script> | ||
| 8 | + <!--css 내용 여기에 direct로 넣었다--> | ||
| 9 | + <style> | ||
| 10 | + #map {top:100; bottom:100; left:10; right:10; } | ||
| 11 | + </style> | ||
| 12 | + </head> | ||
| 13 | + | ||
| 14 | + <body> | ||
| 15 | + {% for cont in educations %} | ||
| 16 | + <p>where : {{cont.city}}</p> | ||
| 17 | + <p>where : {{cont.ct}}</p> | ||
| 18 | + {% endfor %} | ||
| 19 | + | ||
| 20 | + <div id="map"></div> | ||
| 21 | + | ||
| 22 | + <script> | ||
| 23 | + // map 객체 생성 | ||
| 24 | + // 위도, 경도, zoom 수준 | ||
| 25 | + var map = L.map('map').setView([0,0],3); | ||
| 26 | + // tilelayer를 씌우는 작업 OSM을 사용했음 | ||
| 27 | + L.tileLayer('https://api.maptiler.com/maps/positron/{z}/{x}/{y}.png?key=IHLiEj11tKzE3WCyeanP',{ | ||
| 28 | + attribution: '<a href="https://www.maptiler.com/copyright/" target="_blank">© MapTiler</a> <a href="https://www.openstreetmap.org/copyright" target="_blank">© OpenStreetMap contributors</a>', | ||
| 29 | + }).addTo(map) | ||
| 30 | + | ||
| 31 | + </script> | ||
| 32 | + </body> | ||
| 33 | +</html> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
RF_project/market_analysis/tests.py
0 → 100644
RF_project/market_analysis/urls.py
0 → 100644
RF_project/market_analysis/views.py
0 → 100644
| 1 | +from django.shortcuts import render | ||
| 2 | +from django.db.models import Count | ||
| 3 | +from .models import RT_edu | ||
| 4 | + | ||
| 5 | +# Create your views here. | ||
| 6 | + | ||
| 7 | +def test(request): | ||
| 8 | + educations = RT_edu.objects.values('city').annotate(ct=Count('city')) | ||
| 9 | + context = {'educations': educations} | ||
| 10 | + return render(request, 'test.html', context) | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment