Showing
51 changed files
with
1144 additions
and
11 deletions
1 | +# Created by https://www.gitignore.io/api/django | ||
2 | +# Edit at https://www.gitignore.io/?templates=django | ||
3 | + | ||
4 | +### Django ### | ||
5 | +*.log | ||
6 | +*.pot | ||
7 | +*.pyc | ||
8 | +__pycache__/ | ||
9 | +local_settings.py | ||
10 | +db.sqlite3 | ||
11 | +db.sqlite3-journal | ||
12 | +media | ||
13 | + | ||
14 | +# If your build process includes running collectstatic, then you probably don't need or want to include staticfiles/ | ||
15 | +# in your Git repository. Update and uncomment the following line accordingly. | ||
16 | +# <django-project-name>/staticfiles/ | ||
17 | + | ||
18 | +### Django.Python Stack ### | ||
19 | +# Byte-compiled / optimized / DLL files | ||
20 | +*.py[cod] | ||
21 | +*$py.class | ||
22 | + | ||
23 | +# C extensions | ||
24 | +*.so | ||
25 | + | ||
26 | +# Distribution / packaging | ||
27 | +.Python | ||
28 | +build/ | ||
29 | +develop-eggs/ | ||
30 | +dist/ | ||
31 | +downloads/ | ||
32 | +eggs/ | ||
33 | +.eggs/ | ||
34 | +lib/ | ||
35 | +lib64/ | ||
36 | +parts/ | ||
37 | +sdist/ | ||
38 | +var/ | ||
39 | +wheels/ | ||
40 | +pip-wheel-metadata/ | ||
41 | +share/python-wheels/ | ||
42 | +*.egg-info/ | ||
43 | +.installed.cfg | ||
44 | +*.egg | ||
45 | +MANIFEST | ||
46 | + | ||
47 | +# PyInstaller | ||
48 | +# Usually these files are written by a python script from a template | ||
49 | +# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
50 | +*.manifest | ||
51 | +*.spec | ||
52 | + | ||
53 | +# Installer logs | ||
54 | +pip-log.txt | ||
55 | +pip-delete-this-directory.txt | ||
56 | + | ||
57 | +# Unit test / coverage reports | ||
58 | +htmlcov/ | ||
59 | +.tox/ | ||
60 | +.nox/ | ||
61 | +.coverage | ||
62 | +.coverage.* | ||
63 | +.cache | ||
64 | +nosetests.xml | ||
65 | +coverage.xml | ||
66 | +*.cover | ||
67 | +.hypothesis/ | ||
68 | +.pytest_cache/ | ||
69 | + | ||
70 | +# Translations | ||
71 | +*.mo | ||
72 | + | ||
73 | +# Scrapy stuff: | ||
74 | +.scrapy | ||
75 | + | ||
76 | +# Sphinx documentation | ||
77 | +docs/_build/ | ||
78 | + | ||
79 | +# PyBuilder | ||
80 | +target/ | ||
81 | + | ||
82 | +# pyenv | ||
83 | +.python-version | ||
84 | + | ||
85 | +# pipenv | ||
86 | +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
87 | +# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
88 | +# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
89 | +# install all needed dependencies. | ||
90 | +#Pipfile.lock | ||
91 | + | ||
92 | +# celery beat schedule file | ||
93 | +celerybeat-schedule | ||
94 | + | ||
95 | +# SageMath parsed files | ||
96 | +*.sage.py | ||
97 | + | ||
98 | +# Spyder project settings | ||
99 | +.spyderproject | ||
100 | +.spyproject | ||
101 | + | ||
102 | +# Rope project settings | ||
103 | +.ropeproject | ||
104 | + | ||
105 | +# Mr Developer | ||
106 | +.mr.developer.cfg | ||
107 | +.project | ||
108 | +.pydevproject | ||
109 | + | ||
110 | +# mkdocs documentation | ||
111 | +/site | ||
112 | + | ||
113 | +# mypy | ||
114 | +.mypy_cache/ | ||
115 | +.dmypy.json | ||
116 | +dmypy.json | ||
117 | + | ||
118 | +# Pyre type checker | ||
119 | +.pyre/ | ||
120 | + | ||
121 | +# End of https://www.gitignore.io/api/django | ||
122 | + | ||
1 | .DS_Store | 123 | .DS_Store |
2 | node_modules | 124 | node_modules |
3 | /dist | 125 | /dist |
... | @@ -19,3 +141,4 @@ yarn-error.log* | ... | @@ -19,3 +141,4 @@ yarn-error.log* |
19 | *.njsproj | 141 | *.njsproj |
20 | *.sln | 142 | *.sln |
21 | *.sw? | 143 | *.sw? |
144 | + | ... | ... |
web/djangoBackend/api/__init__.py
0 → 100644
File mode changed
web/djangoBackend/api/admin.py
0 → 100644
web/djangoBackend/api/apps.py
0 → 100644
web/djangoBackend/api/generics.py
0 → 100644
1 | +class ListCreateAPIView(mixins.ListModelMixin, | ||
2 | + mixins.CreateModelMixin, | ||
3 | + GenericAPIView): | ||
4 | + | ||
5 | + def get(self, request, *args, **kwargs): | ||
6 | + return self.list(request, *args, **kwargs) | ||
7 | + | ||
8 | + def post(self, request, *args, **kwargs): | ||
9 | + return self.create(request, *args, **kwargs) | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +# Generated by Django 3.0.5 on 2020-04-20 07:34 | ||
2 | + | ||
3 | +from django.db import migrations, models | ||
4 | +import jsonfield.fields | ||
5 | + | ||
6 | + | ||
7 | +class Migration(migrations.Migration): | ||
8 | + | ||
9 | + initial = True | ||
10 | + | ||
11 | + dependencies = [ | ||
12 | + ] | ||
13 | + | ||
14 | + operations = [ | ||
15 | + migrations.CreateModel( | ||
16 | + name='Video', | ||
17 | + fields=[ | ||
18 | + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
19 | + ('videourl', models.URLField(max_length=400)), | ||
20 | + ('title', models.CharField(max_length=200)), | ||
21 | + ('tags', jsonfield.fields.JSONField()), | ||
22 | + ], | ||
23 | + ), | ||
24 | + ] |
1 | +# Generated by Django 3.0.5 on 2020-04-20 15:42 | ||
2 | + | ||
3 | +import django.contrib.postgres.fields | ||
4 | +from django.db import migrations, models | ||
5 | + | ||
6 | + | ||
7 | +class Migration(migrations.Migration): | ||
8 | + | ||
9 | + dependencies = [ | ||
10 | + ('api', '0001_initial'), | ||
11 | + ] | ||
12 | + | ||
13 | + operations = [ | ||
14 | + migrations.CreateModel( | ||
15 | + name='Tags', | ||
16 | + fields=[ | ||
17 | + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
18 | + ('tag', models.CharField(max_length=200)), | ||
19 | + ], | ||
20 | + ), | ||
21 | + migrations.AlterField( | ||
22 | + model_name='video', | ||
23 | + name='videourl', | ||
24 | + field=models.CharField(max_length=1000), | ||
25 | + ), | ||
26 | + ] |
1 | +# Generated by Django 3.0.5 on 2020-04-20 15:47 | ||
2 | + | ||
3 | +from django.db import migrations | ||
4 | +import jsonfield.fields | ||
5 | + | ||
6 | + | ||
7 | +class Migration(migrations.Migration): | ||
8 | + | ||
9 | + dependencies = [ | ||
10 | + ('api', '0002_auto_20200420_1542'), | ||
11 | + ] | ||
12 | + | ||
13 | + operations = [ | ||
14 | + migrations.AlterField( | ||
15 | + model_name='video', | ||
16 | + name='tags', | ||
17 | + field=jsonfield.fields.JSONField(), | ||
18 | + ), | ||
19 | + ] |
1 | +# Generated by Django 3.0.5 on 2020-04-20 16:08 | ||
2 | + | ||
3 | +from django.db import migrations, models | ||
4 | + | ||
5 | + | ||
6 | +class Migration(migrations.Migration): | ||
7 | + | ||
8 | + dependencies = [ | ||
9 | + ('api', '0003_auto_20200420_1547'), | ||
10 | + ] | ||
11 | + | ||
12 | + operations = [ | ||
13 | + migrations.AlterField( | ||
14 | + model_name='video', | ||
15 | + name='tags', | ||
16 | + field=models.CharField(max_length=500), | ||
17 | + ), | ||
18 | + migrations.AlterField( | ||
19 | + model_name='video', | ||
20 | + name='videourl', | ||
21 | + field=models.CharField(blank=True, max_length=1000), | ||
22 | + ), | ||
23 | + ] |
web/djangoBackend/api/migrations/__init__.py
0 → 100644
File mode changed
web/djangoBackend/api/models.py
0 → 100644
1 | +from django.db import models | ||
2 | +from jsonfield import JSONField | ||
3 | + | ||
4 | + | ||
5 | +# Create your models here. | ||
6 | +class Video(models.Model): | ||
7 | + videourl = models.CharField(max_length=1000, blank=True) | ||
8 | + title = models.CharField(max_length=200) | ||
9 | + tags = models.CharField(max_length=500) | ||
10 | + | ||
11 | +class Tags(models.Model): | ||
12 | + tag = models.CharField(max_length=200) | ||
13 | + | ||
14 | +class VideoFile(models.Model): | ||
15 | + video = models.FileField(upload_to='uploads/%Y/%m/%d/%h/%m/%s', max_length=100), |
web/djangoBackend/api/serializer.py
0 → 100644
1 | +from .models import Video, Tags | ||
2 | +from rest_framework import serializers | ||
3 | + | ||
4 | +class VideoSerializer(serializers.ModelSerializer): | ||
5 | + | ||
6 | + class Meta: | ||
7 | + model = Video | ||
8 | + fields = '__all__' | ||
9 | + | ||
10 | +class TagSerializer(serializers.ModelSerializer): | ||
11 | + | ||
12 | + class Meta: | ||
13 | + model = Tags | ||
14 | + fields = '__all__' | ||
15 | +#dict화 방법 | ||
16 | +#serializer = VideoSerializer(Video.objects.all(), many=True) | ||
17 | +#serializer.data | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
web/djangoBackend/api/tests.py
0 → 100644
web/djangoBackend/api/urls.py
0 → 100644
1 | +from django.urls import path, include | ||
2 | +from . import views | ||
3 | +from rest_framework.routers import DefaultRouter | ||
4 | + | ||
5 | +router = DefaultRouter() | ||
6 | +router.register('db/tags', views.TagViewSet) | ||
7 | +router.register('db/video', views.VideoViewSet) | ||
8 | + | ||
9 | +urlpatterns = [ | ||
10 | + # FBV | ||
11 | + path('api/video', views.Video_list), | ||
12 | + path('api/loadtag', views.Tag_list), | ||
13 | + path('',include(router.urls)), | ||
14 | + # path('cbv/post/<int:pk>/',views.post_detail), | ||
15 | +] | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
web/djangoBackend/api/views.py
0 → 100644
1 | +from rest_framework.response import Response | ||
2 | +from rest_framework.views import APIView | ||
3 | +from .models import Video, Tags | ||
4 | +from .serializer import VideoSerializer, TagSerializer | ||
5 | +from rest_framework.decorators import api_view | ||
6 | +from django.shortcuts import get_object_or_404 | ||
7 | +from rest_framework import generics | ||
8 | +from rest_framework import mixins | ||
9 | +from rest_framework import viewsets | ||
10 | + | ||
11 | +# Create your views here. | ||
12 | +class VideoViewSet(viewsets.ModelViewSet): | ||
13 | + queryset = Video.objects.all() | ||
14 | + serializer_class = VideoSerializer | ||
15 | + | ||
16 | +class TagViewSet(viewsets.ModelViewSet): | ||
17 | + queryset = Tags.objects.order_by('tag') | ||
18 | + serializer_class = TagSerializer | ||
19 | + | ||
20 | + | ||
21 | +# FBV 예제 | ||
22 | +@api_view(['GET','POST']) | ||
23 | +def Video_list(request): | ||
24 | + if request.method == 'GET': | ||
25 | + qs = Video.objects.all() | ||
26 | + serializer = VideoSerializer(qs, many=True) | ||
27 | + return Response(serializer.data) | ||
28 | + else: | ||
29 | + for i in request.data['tag']: | ||
30 | + convertTag = {'tag':i} | ||
31 | + tagSerial = TagSerializer(data=convertTag) | ||
32 | + | ||
33 | + if tagSerial.is_valid(): | ||
34 | + tagSerial.save() | ||
35 | + else: | ||
36 | + print(tagSerial.errors) | ||
37 | + | ||
38 | + request.data['tags'] = ','.join(request.data['tag']) | ||
39 | + serializer = VideoSerializer(data=request.data) | ||
40 | + | ||
41 | + if serializer.is_valid(): | ||
42 | + serializer.save() | ||
43 | + return Response(serializer.data, status=201) | ||
44 | + | ||
45 | + print(serializer.errors) | ||
46 | + return Response(serializer.errors, status=400) | ||
47 | + | ||
48 | +@api_view(['GET']) | ||
49 | +def Tag_list(request): | ||
50 | + if request.method == 'GET': | ||
51 | + qs = Tags.objects.order_by('tag') | ||
52 | + serializer = TagSerializer(qs, many=True) | ||
53 | + returnData = serializer.data | ||
54 | + return Response(serializer.data) | ||
55 | + | ||
56 | + | ||
57 | + # 삭제, 수정은 나중에 넣음. | ||
58 | + # elif request.method == 'PUT': | ||
59 | + # serializer = VideoSerializer(video, data=request.data) | ||
60 | + # if serializer.is_valid(): | ||
61 | + # serializer.save() | ||
62 | + # return Response(serializer.data) | ||
63 | + # return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) | ||
64 | + # else: | ||
65 | + # video.delete() | ||
66 | + # return Response(status=status.HTTP_204_NO_CONTENT) | ||
67 | + | ||
68 | +# @api_view(['GET','PUT','DELETE']) | ||
69 | +# def post_detail(request, pk): | ||
70 | +# post = get_object_or_404(Post, pk=pk) | ||
71 | +# if request.method == 'GET': | ||
72 | +# serializer = PostSerializer(post) | ||
73 | +# return Response(serializer.data) | ||
74 | +# elif request.method == 'PUT': | ||
75 | +# serializer = PostSerializer(post, data=reqeust.data) | ||
76 | +# if serializer.is_valid(): | ||
77 | +# serializer.save() | ||
78 | +# return Response(serializer.data) | ||
79 | +# return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) | ||
80 | +# else: | ||
81 | +# post.delete() | ||
82 | +# return Response(status=status.HTTP_204_NO_CONTENT) | ||
83 | + | ||
84 | + | ||
85 | + | ||
86 | + | ||
87 | + | ||
88 | +# Mixin example | ||
89 | + | ||
90 | +# class TagListMixins(mixins.ListModelMixin, mixins.CreateModelMixin,generics.GenericAPIView): | ||
91 | +# def get(self, request, *args, **kwargs): | ||
92 | +# return self.list(request) | ||
93 | + | ||
94 | +# def post(self, request, *args, **kwargs): | ||
95 | +# return self.create(request) | ||
96 | + | ||
97 | + | ||
98 | +# class PostDetailMixins(mixins.RetrieveModelMixin, mixins.UpdateModelMixin, mixins.DestroyModelMixin, generics.GenericAPIView): | ||
99 | +# queryset = Video.objects.all() | ||
100 | +# serializer_class = VideoSerializer | ||
101 | + | ||
102 | +# def get(self, request, *args, **kwargs): | ||
103 | +# return self.retrieve(request, *args, **kwargs) | ||
104 | + | ||
105 | +# def put(self, request, *args, **kwargs): | ||
106 | +# return self.update(request, *args, **kwargs) | ||
107 | + | ||
108 | +# def delete(self, request, *args, **kwargs): | ||
109 | +# return self.delete(request, *args, **kwargs) | ||
110 | + | ||
111 | + |
web/djangoBackend/djangoBackend/__init__.py
0 → 100644
File mode changed
web/djangoBackend/djangoBackend/asgi.py
0 → 100644
1 | +""" | ||
2 | +ASGI config for djangoBackend 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', 'djangoBackend.settings') | ||
15 | + | ||
16 | +application = get_asgi_application() |
web/djangoBackend/djangoBackend/settings.py
0 → 100644
1 | +""" | ||
2 | +Django settings for djangoBackend project. | ||
3 | + | ||
4 | +Generated by 'django-admin startproject' using Django 3.0.5. | ||
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 = '$gr0=rm@72sybv94!q4%+#x20q$#27df9g8z%3$%528uf_*dn0' | ||
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 | + 'rest_framework', | ||
41 | + 'rest_framework_swagger', | ||
42 | + 'corsheaders', | ||
43 | + 'api', | ||
44 | +] | ||
45 | + | ||
46 | +MIDDLEWARE = [ | ||
47 | + 'django.middleware.security.SecurityMiddleware', | ||
48 | + 'django.contrib.sessions.middleware.SessionMiddleware', | ||
49 | + 'django.middleware.common.CommonMiddleware', | ||
50 | + 'django.middleware.csrf.CsrfViewMiddleware', | ||
51 | + 'django.contrib.auth.middleware.AuthenticationMiddleware', | ||
52 | + 'django.contrib.messages.middleware.MessageMiddleware', | ||
53 | + 'django.middleware.clickjacking.XFrameOptionsMiddleware', | ||
54 | + 'corsheaders.middleware.CorsMiddleware', | ||
55 | +] | ||
56 | + | ||
57 | +ROOT_URLCONF = 'djangoBackend.urls' | ||
58 | + | ||
59 | +TEMPLATES = [ | ||
60 | + { | ||
61 | + 'BACKEND': 'django.template.backends.django.DjangoTemplates', | ||
62 | + 'DIRS': [], | ||
63 | + 'APP_DIRS': True, | ||
64 | + 'OPTIONS': { | ||
65 | + 'context_processors': [ | ||
66 | + 'django.template.context_processors.debug', | ||
67 | + 'django.template.context_processors.request', | ||
68 | + 'django.contrib.auth.context_processors.auth', | ||
69 | + 'django.contrib.messages.context_processors.messages', | ||
70 | + ], | ||
71 | + }, | ||
72 | + }, | ||
73 | +] | ||
74 | + | ||
75 | +WSGI_APPLICATION = 'djangoBackend.wsgi.application' | ||
76 | + | ||
77 | + | ||
78 | +# Database | ||
79 | +# https://docs.djangoproject.com/en/3.0/ref/settings/#databases | ||
80 | + | ||
81 | +DATABASES = { | ||
82 | + 'default': { | ||
83 | + 'ENGINE': 'django.db.backends.sqlite3', | ||
84 | + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), | ||
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 | + | ||
127 | +##CORS | ||
128 | +CORS_ORIGIN_ALLOW_ALL=True | ||
129 | +CORS_ALLOW_CREDENTIALS = True | ||
130 | +CORS_URLS_REGEX = r'^/api/.*$' | ||
131 | + | ||
132 | +CORS_ALLOW_METHODS = ( | ||
133 | + 'DELETE', | ||
134 | + 'GET', | ||
135 | + 'OPTIONS', | ||
136 | + 'PATCH', | ||
137 | + 'POST', | ||
138 | + 'PUT', | ||
139 | +) | ||
140 | + | ||
141 | +CORS_ALLOW_HEADERS = ( | ||
142 | + 'accept', | ||
143 | + 'accept-encoding', | ||
144 | + 'authorization', | ||
145 | + 'content-type', | ||
146 | + 'dnt', | ||
147 | + 'origin', | ||
148 | + 'user-agent', | ||
149 | + 'x-csrftoken', | ||
150 | + 'x-requested-with', | ||
151 | +) | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
web/djangoBackend/djangoBackend/urls.py
0 → 100644
1 | +"""djangoBackend 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 | ||
18 | +from django.conf.urls import url, include | ||
19 | +from rest_framework import routers | ||
20 | +from rest_framework_swagger.views import get_swagger_view | ||
21 | + | ||
22 | +urlpatterns = [ | ||
23 | + url(r'^admin/', admin.site.urls), | ||
24 | + url(r'^api/doc', get_swagger_view(title='Rest API Document')), | ||
25 | + path('', include('api.urls')), | ||
26 | +] |
web/djangoBackend/djangoBackend/wsgi.py
0 → 100644
1 | +""" | ||
2 | +WSGI config for djangoBackend 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', 'djangoBackend.settings') | ||
15 | + | ||
16 | +application = get_wsgi_application() |
web/djangoBackend/env/bin/activate
0 → 100644
1 | +# This file must be used with "source bin/activate" *from bash* | ||
2 | +# you cannot run it directly | ||
3 | + | ||
4 | + | ||
5 | +if [ "${BASH_SOURCE-}" = "$0" ]; then | ||
6 | + echo "You must source this script: \$ source $0" >&2 | ||
7 | + exit 33 | ||
8 | +fi | ||
9 | + | ||
10 | +deactivate () { | ||
11 | + unset -f pydoc >/dev/null 2>&1 | ||
12 | + | ||
13 | + # reset old environment variables | ||
14 | + # ! [ -z ${VAR+_} ] returns true if VAR is declared at all | ||
15 | + if ! [ -z "${_OLD_VIRTUAL_PATH:+_}" ] ; then | ||
16 | + PATH="$_OLD_VIRTUAL_PATH" | ||
17 | + export PATH | ||
18 | + unset _OLD_VIRTUAL_PATH | ||
19 | + fi | ||
20 | + if ! [ -z "${_OLD_VIRTUAL_PYTHONHOME+_}" ] ; then | ||
21 | + PYTHONHOME="$_OLD_VIRTUAL_PYTHONHOME" | ||
22 | + export PYTHONHOME | ||
23 | + unset _OLD_VIRTUAL_PYTHONHOME | ||
24 | + fi | ||
25 | + | ||
26 | + # This should detect bash and zsh, which have a hash command that must | ||
27 | + # be called to get it to forget past commands. Without forgetting | ||
28 | + # past commands the $PATH changes we made may not be respected | ||
29 | + if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ] ; then | ||
30 | + hash -r 2>/dev/null | ||
31 | + fi | ||
32 | + | ||
33 | + if ! [ -z "${_OLD_VIRTUAL_PS1+_}" ] ; then | ||
34 | + PS1="$_OLD_VIRTUAL_PS1" | ||
35 | + export PS1 | ||
36 | + unset _OLD_VIRTUAL_PS1 | ||
37 | + fi | ||
38 | + | ||
39 | + unset VIRTUAL_ENV | ||
40 | + if [ ! "${1-}" = "nondestructive" ] ; then | ||
41 | + # Self destruct! | ||
42 | + unset -f deactivate | ||
43 | + fi | ||
44 | +} | ||
45 | + | ||
46 | +# unset irrelevant variables | ||
47 | +deactivate nondestructive | ||
48 | + | ||
49 | +VIRTUAL_ENV='/mnt/c/_/PKH_Project1/web/env' | ||
50 | +export VIRTUAL_ENV | ||
51 | + | ||
52 | +_OLD_VIRTUAL_PATH="$PATH" | ||
53 | +PATH="$VIRTUAL_ENV/bin:$PATH" | ||
54 | +export PATH | ||
55 | + | ||
56 | +# unset PYTHONHOME if set | ||
57 | +if ! [ -z "${PYTHONHOME+_}" ] ; then | ||
58 | + _OLD_VIRTUAL_PYTHONHOME="$PYTHONHOME" | ||
59 | + unset PYTHONHOME | ||
60 | +fi | ||
61 | + | ||
62 | +if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT-}" ] ; then | ||
63 | + _OLD_VIRTUAL_PS1="${PS1-}" | ||
64 | + if [ "x" != x ] ; then | ||
65 | + PS1="${PS1-}" | ||
66 | + else | ||
67 | + PS1="(`basename \"$VIRTUAL_ENV\"`) ${PS1-}" | ||
68 | + fi | ||
69 | + export PS1 | ||
70 | +fi | ||
71 | + | ||
72 | +# Make sure to unalias pydoc if it's already there | ||
73 | +alias pydoc 2>/dev/null >/dev/null && unalias pydoc || true | ||
74 | + | ||
75 | +pydoc () { | ||
76 | + python -m pydoc "$@" | ||
77 | +} | ||
78 | + | ||
79 | +# This should detect bash and zsh, which have a hash command that must | ||
80 | +# be called to get it to forget past commands. Without forgetting | ||
81 | +# past commands the $PATH changes we made may not be respected | ||
82 | +if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ] ; then | ||
83 | + hash -r 2>/dev/null | ||
84 | +fi |
web/djangoBackend/env/bin/activate.csh
0 → 100644
1 | +# This file must be used with "source bin/activate.csh" *from csh*. | ||
2 | +# You cannot run it directly. | ||
3 | +# Created by Davide Di Blasi <davidedb@gmail.com>. | ||
4 | + | ||
5 | +set newline='\ | ||
6 | +' | ||
7 | + | ||
8 | +alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH:q" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT:q" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; test "\!:*" != "nondestructive" && unalias deactivate && unalias pydoc' | ||
9 | + | ||
10 | +# Unset irrelevant variables. | ||
11 | +deactivate nondestructive | ||
12 | + | ||
13 | +setenv VIRTUAL_ENV '/mnt/c/_/PKH_Project1/web/env' | ||
14 | + | ||
15 | +set _OLD_VIRTUAL_PATH="$PATH:q" | ||
16 | +setenv PATH "$VIRTUAL_ENV:q/bin:$PATH:q" | ||
17 | + | ||
18 | + | ||
19 | + | ||
20 | +if ('' != "") then | ||
21 | + set env_name = '' | ||
22 | +else | ||
23 | + set env_name = '('"$VIRTUAL_ENV:t:q"') ' | ||
24 | +endif | ||
25 | + | ||
26 | +if ( $?VIRTUAL_ENV_DISABLE_PROMPT ) then | ||
27 | + if ( $VIRTUAL_ENV_DISABLE_PROMPT == "" ) then | ||
28 | + set do_prompt = "1" | ||
29 | + else | ||
30 | + set do_prompt = "0" | ||
31 | + endif | ||
32 | +else | ||
33 | + set do_prompt = "1" | ||
34 | +endif | ||
35 | + | ||
36 | +if ( $do_prompt == "1" ) then | ||
37 | + # Could be in a non-interactive environment, | ||
38 | + # in which case, $prompt is undefined and we wouldn't | ||
39 | + # care about the prompt anyway. | ||
40 | + if ( $?prompt ) then | ||
41 | + set _OLD_VIRTUAL_PROMPT="$prompt:q" | ||
42 | + if ( "$prompt:q" =~ *"$newline:q"* ) then | ||
43 | + : | ||
44 | + else | ||
45 | + set prompt = "$env_name:q$prompt:q" | ||
46 | + endif | ||
47 | + endif | ||
48 | +endif | ||
49 | + | ||
50 | +unset env_name | ||
51 | +unset do_prompt | ||
52 | + | ||
53 | +alias pydoc python -m pydoc | ||
54 | + | ||
55 | +rehash |
web/djangoBackend/env/bin/activate.fish
0 → 100644
1 | +# This file must be used using `source bin/activate.fish` *within a running fish ( http://fishshell.com ) session*. | ||
2 | +# Do not run it directly. | ||
3 | + | ||
4 | +function _bashify_path -d "Converts a fish path to something bash can recognize" | ||
5 | + set fishy_path $argv | ||
6 | + set bashy_path $fishy_path[1] | ||
7 | + for path_part in $fishy_path[2..-1] | ||
8 | + set bashy_path "$bashy_path:$path_part" | ||
9 | + end | ||
10 | + echo $bashy_path | ||
11 | +end | ||
12 | + | ||
13 | +function _fishify_path -d "Converts a bash path to something fish can recognize" | ||
14 | + echo $argv | tr ':' '\n' | ||
15 | +end | ||
16 | + | ||
17 | +function deactivate -d 'Exit virtualenv mode and return to the normal environment.' | ||
18 | + # reset old environment variables | ||
19 | + if test -n "$_OLD_VIRTUAL_PATH" | ||
20 | + # https://github.com/fish-shell/fish-shell/issues/436 altered PATH handling | ||
21 | + if test (echo $FISH_VERSION | head -c 1) -lt 3 | ||
22 | + set -gx PATH (_fishify_path "$_OLD_VIRTUAL_PATH") | ||
23 | + else | ||
24 | + set -gx PATH "$_OLD_VIRTUAL_PATH" | ||
25 | + end | ||
26 | + set -e _OLD_VIRTUAL_PATH | ||
27 | + end | ||
28 | + | ||
29 | + if test -n "$_OLD_VIRTUAL_PYTHONHOME" | ||
30 | + set -gx PYTHONHOME "$_OLD_VIRTUAL_PYTHONHOME" | ||
31 | + set -e _OLD_VIRTUAL_PYTHONHOME | ||
32 | + end | ||
33 | + | ||
34 | + if test -n "$_OLD_FISH_PROMPT_OVERRIDE" | ||
35 | + and functions -q _old_fish_prompt | ||
36 | + # Set an empty local `$fish_function_path` to allow the removal of `fish_prompt` using `functions -e`. | ||
37 | + set -l fish_function_path | ||
38 | + | ||
39 | + # Erase virtualenv's `fish_prompt` and restore the original. | ||
40 | + functions -e fish_prompt | ||
41 | + functions -c _old_fish_prompt fish_prompt | ||
42 | + functions -e _old_fish_prompt | ||
43 | + set -e _OLD_FISH_PROMPT_OVERRIDE | ||
44 | + end | ||
45 | + | ||
46 | + set -e VIRTUAL_ENV | ||
47 | + | ||
48 | + if test "$argv[1]" != 'nondestructive' | ||
49 | + # Self-destruct! | ||
50 | + functions -e pydoc | ||
51 | + functions -e deactivate | ||
52 | + functions -e _bashify_path | ||
53 | + functions -e _fishify_path | ||
54 | + end | ||
55 | +end | ||
56 | + | ||
57 | +# Unset irrelevant variables. | ||
58 | +deactivate nondestructive | ||
59 | + | ||
60 | +set -gx VIRTUAL_ENV '/mnt/c/_/PKH_Project1/web/env' | ||
61 | + | ||
62 | +# https://github.com/fish-shell/fish-shell/issues/436 altered PATH handling | ||
63 | +if test (echo $FISH_VERSION | head -c 1) -lt 3 | ||
64 | + set -gx _OLD_VIRTUAL_PATH (_bashify_path $PATH) | ||
65 | +else | ||
66 | + set -gx _OLD_VIRTUAL_PATH "$PATH" | ||
67 | +end | ||
68 | +set -gx PATH "$VIRTUAL_ENV"'/bin' $PATH | ||
69 | + | ||
70 | +# Unset `$PYTHONHOME` if set. | ||
71 | +if set -q PYTHONHOME | ||
72 | + set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME | ||
73 | + set -e PYTHONHOME | ||
74 | +end | ||
75 | + | ||
76 | +function pydoc | ||
77 | + python -m pydoc $argv | ||
78 | +end | ||
79 | + | ||
80 | +if test -z "$VIRTUAL_ENV_DISABLE_PROMPT" | ||
81 | + # Copy the current `fish_prompt` function as `_old_fish_prompt`. | ||
82 | + functions -c fish_prompt _old_fish_prompt | ||
83 | + | ||
84 | + function fish_prompt | ||
85 | + # Run the user's prompt first; it might depend on (pipe)status. | ||
86 | + set -l prompt (_old_fish_prompt) | ||
87 | + | ||
88 | + # Prompt override provided? | ||
89 | + # If not, just prepend the environment name. | ||
90 | + if test -n '' | ||
91 | + printf '%s%s' '' (set_color normal) | ||
92 | + else | ||
93 | + printf '%s(%s) ' (set_color normal) (basename "$VIRTUAL_ENV") | ||
94 | + end | ||
95 | + | ||
96 | + string join -- \n $prompt # handle multi-line prompts | ||
97 | + end | ||
98 | + | ||
99 | + set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV" | ||
100 | +end |
web/djangoBackend/env/bin/activate.ps1
0 → 100644
1 | +$script:THIS_PATH = $myinvocation.mycommand.path | ||
2 | +$script:BASE_DIR = Split-Path (Resolve-Path "$THIS_PATH/..") -Parent | ||
3 | + | ||
4 | +function global:deactivate([switch] $NonDestructive) { | ||
5 | + if (Test-Path variable:_OLD_VIRTUAL_PATH) { | ||
6 | + $env:PATH = $variable:_OLD_VIRTUAL_PATH | ||
7 | + Remove-Variable "_OLD_VIRTUAL_PATH" -Scope global | ||
8 | + } | ||
9 | + | ||
10 | + if (Test-Path function:_old_virtual_prompt) { | ||
11 | + $function:prompt = $function:_old_virtual_prompt | ||
12 | + Remove-Item function:\_old_virtual_prompt | ||
13 | + } | ||
14 | + | ||
15 | + if ($env:VIRTUAL_ENV) { | ||
16 | + Remove-Item env:VIRTUAL_ENV -ErrorAction SilentlyContinue | ||
17 | + } | ||
18 | + | ||
19 | + if (!$NonDestructive) { | ||
20 | + # Self destruct! | ||
21 | + Remove-Item function:deactivate | ||
22 | + Remove-Item function:pydoc | ||
23 | + } | ||
24 | +} | ||
25 | + | ||
26 | +function global:pydoc { | ||
27 | + python -m pydoc $args | ||
28 | +} | ||
29 | + | ||
30 | +# unset irrelevant variables | ||
31 | +deactivate -nondestructive | ||
32 | + | ||
33 | +$VIRTUAL_ENV = $BASE_DIR | ||
34 | +$env:VIRTUAL_ENV = $VIRTUAL_ENV | ||
35 | + | ||
36 | +New-Variable -Scope global -Name _OLD_VIRTUAL_PATH -Value $env:PATH | ||
37 | + | ||
38 | +$env:PATH = "$env:VIRTUAL_ENV/bin:" + $env:PATH | ||
39 | +if (!$env:VIRTUAL_ENV_DISABLE_PROMPT) { | ||
40 | + function global:_old_virtual_prompt { | ||
41 | + "" | ||
42 | + } | ||
43 | + $function:_old_virtual_prompt = $function:prompt | ||
44 | + | ||
45 | + if ("" -ne "") { | ||
46 | + function global:prompt { | ||
47 | + # Add the custom prefix to the existing prompt | ||
48 | + $previous_prompt_value = & $function:_old_virtual_prompt | ||
49 | + ("" + $previous_prompt_value) | ||
50 | + } | ||
51 | + } | ||
52 | + else { | ||
53 | + function global:prompt { | ||
54 | + # Add a prefix to the current prompt, but don't discard it. | ||
55 | + $previous_prompt_value = & $function:_old_virtual_prompt | ||
56 | + $new_prompt_value = "($( Split-Path $env:VIRTUAL_ENV -Leaf )) " | ||
57 | + ($new_prompt_value + $previous_prompt_value) | ||
58 | + } | ||
59 | + } | ||
60 | +} |
web/djangoBackend/env/bin/activate.xsh
0 → 100644
1 | +"""Xonsh activate script for virtualenv""" | ||
2 | +from xonsh.tools import get_sep as _get_sep | ||
3 | + | ||
4 | +def _deactivate(args): | ||
5 | + if "pydoc" in aliases: | ||
6 | + del aliases["pydoc"] | ||
7 | + | ||
8 | + if ${...}.get("_OLD_VIRTUAL_PATH", ""): | ||
9 | + $PATH = $_OLD_VIRTUAL_PATH | ||
10 | + del $_OLD_VIRTUAL_PATH | ||
11 | + | ||
12 | + if ${...}.get("_OLD_VIRTUAL_PYTHONHOME", ""): | ||
13 | + $PYTHONHOME = $_OLD_VIRTUAL_PYTHONHOME | ||
14 | + del $_OLD_VIRTUAL_PYTHONHOME | ||
15 | + | ||
16 | + if "VIRTUAL_ENV" in ${...}: | ||
17 | + del $VIRTUAL_ENV | ||
18 | + | ||
19 | + if "VIRTUAL_ENV_PROMPT" in ${...}: | ||
20 | + del $VIRTUAL_ENV_PROMPT | ||
21 | + | ||
22 | + if "nondestructive" not in args: | ||
23 | + # Self destruct! | ||
24 | + del aliases["deactivate"] | ||
25 | + | ||
26 | + | ||
27 | +# unset irrelevant variables | ||
28 | +_deactivate(["nondestructive"]) | ||
29 | +aliases["deactivate"] = _deactivate | ||
30 | + | ||
31 | +$VIRTUAL_ENV = r"/mnt/c/_/PKH_Project1/web/env" | ||
32 | + | ||
33 | +$_OLD_VIRTUAL_PATH = $PATH | ||
34 | +$PATH = $PATH[:] | ||
35 | +$PATH.add($VIRTUAL_ENV + _get_sep() + "bin", front=True, replace=True) | ||
36 | + | ||
37 | +if ${...}.get("PYTHONHOME", ""): | ||
38 | + # unset PYTHONHOME if set | ||
39 | + $_OLD_VIRTUAL_PYTHONHOME = $PYTHONHOME | ||
40 | + del $PYTHONHOME | ||
41 | + | ||
42 | +$VIRTUAL_ENV_PROMPT = "" | ||
43 | +if not $VIRTUAL_ENV_PROMPT: | ||
44 | + del $VIRTUAL_ENV_PROMPT | ||
45 | + | ||
46 | +aliases["pydoc"] = ["python", "-m", "pydoc"] |
web/djangoBackend/env/bin/activate_this.py
0 → 100644
1 | +# -*- coding: utf-8 -*- | ||
2 | +"""Activate virtualenv for current interpreter: | ||
3 | + | ||
4 | +Use exec(open(this_file).read(), {'__file__': this_file}). | ||
5 | + | ||
6 | +This can be used when you must use an existing Python interpreter, not the virtualenv bin/python. | ||
7 | +""" | ||
8 | +import os | ||
9 | +import site | ||
10 | +import sys | ||
11 | + | ||
12 | +try: | ||
13 | + abs_file = os.path.abspath(__file__) | ||
14 | +except NameError: | ||
15 | + raise AssertionError("You must use exec(open(this_file).read(), {'__file__': this_file}))") | ||
16 | + | ||
17 | +bin_dir = os.path.dirname(abs_file) | ||
18 | +base = bin_dir[: -len("bin") - 1] # strip away the bin part from the __file__, plus the path separator | ||
19 | + | ||
20 | +# prepend bin to PATH (this file is inside the bin directory) | ||
21 | +os.environ["PATH"] = os.pathsep.join([bin_dir] + os.environ.get("PATH", "").split(os.pathsep)) | ||
22 | +os.environ["VIRTUAL_ENV"] = base # virtual env is right above bin directory | ||
23 | + | ||
24 | +# add the virtual environments libraries to the host python import mechanism | ||
25 | +prev_length = len(sys.path) | ||
26 | +for lib in "../lib/python3.6/site-packages".split(os.pathsep): | ||
27 | + path = os.path.realpath(os.path.join(bin_dir, lib)) | ||
28 | + site.addsitedir(path.decode("utf-8") if "" else path) | ||
29 | +sys.path[:] = sys.path[prev_length:] + sys.path[0:prev_length] | ||
30 | + | ||
31 | +sys.real_prefix = sys.prefix | ||
32 | +sys.prefix = base |
web/djangoBackend/env/bin/chardetect
0 → 100644
web/djangoBackend/env/bin/django-admin
0 → 100644
1 | +#!/mnt/c/_/PKH_Project1/web/env/bin/python | ||
2 | +# -*- coding: utf-8 -*- | ||
3 | +import re | ||
4 | +import sys | ||
5 | +from django.core.management import execute_from_command_line | ||
6 | +if __name__ == '__main__': | ||
7 | + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) | ||
8 | + sys.exit(execute_from_command_line()) |
web/djangoBackend/env/bin/django-admin.py
0 → 100644
web/djangoBackend/env/bin/easy_install
0 → 100644
web/djangoBackend/env/bin/easy_install-3.6
0 → 100644
web/djangoBackend/env/bin/easy_install3
0 → 100644
web/djangoBackend/env/bin/pip
0 → 100644
web/djangoBackend/env/bin/pip-3.6
0 → 100644
web/djangoBackend/env/bin/pip3
0 → 100644
web/djangoBackend/env/bin/pip3.6
0 → 100644
web/djangoBackend/env/bin/python
0 → 120000
1 | +/usr/bin/python3 | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
web/djangoBackend/env/bin/python3
0 → 120000
1 | +python | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
web/djangoBackend/env/bin/python3.6
0 → 120000
1 | +python | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
web/djangoBackend/env/bin/sqlformat
0 → 100644
web/djangoBackend/env/bin/wheel
0 → 100644
web/djangoBackend/env/bin/wheel-3.6
0 → 100644
web/djangoBackend/env/bin/wheel3
0 → 100644
web/djangoBackend/env/pyvenv.cfg
0 → 100644
web/djangoBackend/envrun
0 → 100644
web/djangoBackend/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', 'djangoBackend.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() |
web/djangoBackend/run
0 → 100644
No preview for this file type
... | @@ -4,7 +4,7 @@ import axios from "axios"; | ... | @@ -4,7 +4,7 @@ import axios from "axios"; |
4 | Vue.prototype.$axios = axios; | 4 | Vue.prototype.$axios = axios; |
5 | const apiRootPath = | 5 | const apiRootPath = |
6 | process.env.NODE_ENV !== "production" | 6 | process.env.NODE_ENV !== "production" |
7 | - ? "http://localhost:3000/api/" | 7 | + ? "http://localhost:8000/api/" |
8 | : "/api/"; | 8 | : "/api/"; |
9 | Vue.prototype.$apiRootPath = apiRootPath; | 9 | Vue.prototype.$apiRootPath = apiRootPath; |
10 | axios.defaults.baseURL = apiRootPath; | 10 | axios.defaults.baseURL = apiRootPath; | ... | ... |
... | @@ -46,7 +46,7 @@ | ... | @@ -46,7 +46,7 @@ |
46 | </v-img> | 46 | </v-img> |
47 | <v-divider></v-divider> | 47 | <v-divider></v-divider> |
48 | <v-chip-group column class="mx-1"> | 48 | <v-chip-group column class="mx-1"> |
49 | - <v-chip color="secondary" v-for="(tag, index) in post.tag" :key="index">#{{ tag }}</v-chip> | 49 | + <v-chip color="secondary" v-for="(tag, index) in post.tags" :key="index">#{{ tag }}</v-chip> |
50 | </v-chip-group> | 50 | </v-chip-group> |
51 | </v-card> | 51 | </v-card> |
52 | </v-flex> | 52 | </v-flex> |
... | @@ -94,16 +94,20 @@ export default { | ... | @@ -94,16 +94,20 @@ export default { |
94 | methods: { | 94 | methods: { |
95 | getPost() { | 95 | getPost() { |
96 | this.busy = true; | 96 | this.busy = true; |
97 | + | ||
97 | this.params.skip = this.setSkip; | 98 | this.params.skip = this.setSkip; |
98 | if (this.postList.length !== (this.params.page - 1) * 10) { | 99 | if (this.postList.length !== (this.params.page - 1) * 10) { |
99 | return; | 100 | return; |
100 | } | 101 | } |
101 | 102 | ||
102 | this.$axios | 103 | this.$axios |
103 | - .get("/home/list", { params: this.params }) | 104 | + .get("/video", { params: this.params }) |
104 | .then(r => { | 105 | .then(r => { |
105 | - for (let i = 0; i < r.data.d.length; i++) { | 106 | + let tags = [] |
106 | - this.postList.push(r.data.d[i]); | 107 | + for (let i = 0; i < r.data.length; i++) { |
108 | + tags = r.data[i].tags.split(',') | ||
109 | + r.data[i].tags = tags | ||
110 | + this.postList.push(r.data[i]); | ||
107 | } | 111 | } |
108 | this.busy = false; | 112 | this.busy = false; |
109 | this.params.page++; | 113 | this.params.page++; |
... | @@ -114,9 +118,13 @@ export default { | ... | @@ -114,9 +118,13 @@ export default { |
114 | }, | 118 | }, |
115 | getTags() { | 119 | getTags() { |
116 | this.$axios | 120 | this.$axios |
117 | - .get("/home/tag") | 121 | + .get("/loadtag") |
118 | .then(r => { | 122 | .then(r => { |
119 | - this.tagsList = r.data.d; | 123 | + let tags = [] |
124 | + for (let i = 0; i < r.data.length; i++) { | ||
125 | + tags.push(r.data[i].tag) | ||
126 | + } | ||
127 | + this.tagsList = [...new Set(tags)] | ||
120 | }) | 128 | }) |
121 | .catch(e => { | 129 | .catch(e => { |
122 | console.log(e); | 130 | console.log(e); |
... | @@ -124,7 +132,7 @@ export default { | ... | @@ -124,7 +132,7 @@ export default { |
124 | }, | 132 | }, |
125 | delete(atc) { | 133 | delete(atc) { |
126 | this.$axios | 134 | this.$axios |
127 | - .delete(`/home/${atc._id}`) | 135 | + .delete(`/${atc._id}`) |
128 | .then(() => { | 136 | .then(() => { |
129 | window.location.reload(); | 137 | window.location.reload(); |
130 | }) | 138 | }) | ... | ... |
... | @@ -23,7 +23,7 @@ | ... | @@ -23,7 +23,7 @@ |
23 | type="text" | 23 | type="text" |
24 | ></v-text-field> | 24 | ></v-text-field> |
25 | <!-- file upload --> | 25 | <!-- file upload --> |
26 | - <div class="mx-10 mb-6"> | 26 | + <div class="mx-10 mb-12 mt-6"> |
27 | <video-upload /> | 27 | <video-upload /> |
28 | </div> | 28 | </div> |
29 | <v-dialog max-width="400" v-model="successDialog"> | 29 | <v-dialog max-width="400" v-model="successDialog"> |
... | @@ -55,7 +55,7 @@ | ... | @@ -55,7 +55,7 @@ |
55 | </v-chip-group> | 55 | </v-chip-group> |
56 | </v-card> | 56 | </v-card> |
57 | <v-text-field | 57 | <v-text-field |
58 | - class="mx-10 my-7" | 58 | + class="mx-10 my-12" |
59 | prepend-inner-icon="mdi-shape" | 59 | prepend-inner-icon="mdi-shape" |
60 | v-model="tag" | 60 | v-model="tag" |
61 | :counter="20" | 61 | :counter="20" |
... | @@ -118,7 +118,7 @@ export default { | ... | @@ -118,7 +118,7 @@ export default { |
118 | return; | 118 | return; |
119 | } else { | 119 | } else { |
120 | this.$axios | 120 | this.$axios |
121 | - .post("/upload/post", this.form) | 121 | + .post("/home", this.form) |
122 | .then(r => { | 122 | .then(r => { |
123 | window.location.reload(); | 123 | window.location.reload(); |
124 | console.log(r); | 124 | console.log(r); | ... | ... |
-
Please register or login to post a comment