diff --git a/goeun/.gitignore b/goeun/.gitignore new file mode 100644 index 0000000..e5cf352 --- /dev/null +++ b/goeun/.gitignore @@ -0,0 +1,265 @@ +# Created by https://www.toptal.com/developers/gitignore/api/django,python +# Edit at https://www.toptal.com/developers/gitignore?templates=django,python + +### Django ### +*.log +*.pot +*.pyc +__pycache__/ +local_settings.py +media + + +# If your build process includes running collectstatic, then you probably don't need or want to include staticfiles/ +# in your Git repository. Update and uncomment the following line accordingly. +# /staticfiles/ + +### Django.Python Stack ### +# Byte-compiled / optimized / DLL files +*.py[cod] +*$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 + +# Django stuff: + +# 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 + +# 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 + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# 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 +.venv +env/ +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/ + +### Python ### +# Byte-compiled / optimized / DLL files + +# C extensions + +# Distribution / packaging + +# 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. + +# Installer logs + +# Unit test / coverage reports + +# Translations + +# Django stuff: + +# Flask stuff: + +# Scrapy stuff: + +# Sphinx documentation + +# PyBuilder + +# Jupyter Notebook + +# IPython + +# 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. + +# 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 + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm + +# Celery stuff + +# SageMath parsed files + +# Environments + +# Spyder project settings + +# Rope project settings + +# mkdocs documentation + +# mypy + +# Pyre type checker + +# pytype static type analyzer + +# Cython debug symbols + +# 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. + +### Python Patch ### +# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration +poetry.toml + +# ruff +.ruff_cache/ + +# LSP config files +pyrightconfig.json + +# End of https://www.toptal.com/developers/gitignore/api/django,python \ No newline at end of file diff --git a/goeun/diaryapp/__init__.py b/goeun/diaryapp/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/goeun/diaryapp/admin.py b/goeun/diaryapp/admin.py new file mode 100644 index 0000000..a011d19 --- /dev/null +++ b/goeun/diaryapp/admin.py @@ -0,0 +1,4 @@ +from django.contrib import admin + + +# Register your models here. diff --git a/goeun/diaryapp/apps.py b/goeun/diaryapp/apps.py new file mode 100644 index 0000000..80ff601 --- /dev/null +++ b/goeun/diaryapp/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class DiaryappConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'diaryapp' diff --git a/goeun/diaryapp/migrations/0001_initial.py b/goeun/diaryapp/migrations/0001_initial.py new file mode 100644 index 0000000..14a47e9 --- /dev/null +++ b/goeun/diaryapp/migrations/0001_initial.py @@ -0,0 +1,25 @@ +# Generated by Django 4.2.2 on 2023-06-21 03:33 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='ReviewNotForm', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=30)), + ('pub_date', models.DateTimeField(verbose_name='data published')), + ('weather', models.CharField(max_length=20)), + ('content', models.TextField()), + ('phto', models.FileField(blank=True, upload_to='phto/')), + ], + ), + ] diff --git a/goeun/diaryapp/migrations/__init__.py b/goeun/diaryapp/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/goeun/diaryapp/models.py b/goeun/diaryapp/models.py new file mode 100644 index 0000000..e8cad11 --- /dev/null +++ b/goeun/diaryapp/models.py @@ -0,0 +1,13 @@ +from django.db import models + +# Create your models here. +class ReviewNotForm(models.Model): + title = models.CharField(max_length=30) + pub_date = models.DateTimeField('data published') + weather = models.CharField(max_length=20) + content = models.TextField() + phto = models.FileField(upload_to='phto/',blank=True) + + def __int__(self): + return self.title + diff --git a/goeun/diaryapp/templates/detail.html b/goeun/diaryapp/templates/detail.html new file mode 100644 index 0000000..cfc9d6f --- /dev/null +++ b/goeun/diaryapp/templates/detail.html @@ -0,0 +1,20 @@ +{% extends 'index.html' %} + +{% block title %} + Detail +{% endblock %} + +{% block content %} +

diary_Detail Page

+
+

제목:{{ review.title }}

+

날짜 및 시간: {{ review.pub_date }}

+

날씨: {{ review.weather }}

+

일기: {{ review.content }}

+ {% if review.phto %} + phto + {% endif %} +
+ 글 수정하기 + 글 삭제하기 +{% endblock %} \ No newline at end of file diff --git a/goeun/diaryapp/templates/edit.html b/goeun/diaryapp/templates/edit.html new file mode 100644 index 0000000..9226906 --- /dev/null +++ b/goeun/diaryapp/templates/edit.html @@ -0,0 +1,20 @@ +{% extends 'index.html' %} + +{% block title %} + Edit +{% endblock %} + +{% block content %} +

Edit Page

+
+
+ {% csrf_token %} + 제목:
+ 날씨:
+ 일기: +
+ 사진 업로드: +
+ +
+{% endblock %} \ No newline at end of file diff --git a/goeun/diaryapp/templates/new.html b/goeun/diaryapp/templates/new.html new file mode 100644 index 0000000..acf0c3e --- /dev/null +++ b/goeun/diaryapp/templates/new.html @@ -0,0 +1,18 @@ +{% extends 'index.html' %} + +{% block title %} + Create +{% endblock %} + +{% block content %} +
+ {% csrf_token %} + 제목:
+ 날씨:
+ 일기: +
+ 사진 업로드: +
+ +
+{% endblock %} \ No newline at end of file diff --git a/goeun/diaryapp/templates/notform.html b/goeun/diaryapp/templates/notform.html new file mode 100644 index 0000000..8ee8482 --- /dev/null +++ b/goeun/diaryapp/templates/notform.html @@ -0,0 +1,24 @@ +{% extends 'index.html' %} + +{% block title %} + Read +{% endblock %} + +{% block content %} + +
+

diary Page

+
+ {% for reviews in reviews.all %} +

{{ reviews.title }}

+

날짜 및 시간 : {{ reviews.pub_date }}

+

날씨 : {{ reviews.weather }}

+

일기: {{ reviews.content }}

+ {% if reviews.phto %} + phto + {% endif %} + {% endfor %} +{% endblock %} diff --git a/goeun/diaryapp/tests.py b/goeun/diaryapp/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/goeun/diaryapp/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/goeun/diaryapp/urls.py b/goeun/diaryapp/urls.py new file mode 100644 index 0000000..f52ec88 --- /dev/null +++ b/goeun/diaryapp/urls.py @@ -0,0 +1,17 @@ +from django.contrib import admin +from django.urls import path +import diaryapp.views + + +urlpatterns = [ + path('admin/',admin.site.urls), + path('new/', diaryapp.views.new, name='new'), + path('new/create/', diaryapp.views.create, name= 'create'), + path('notform/', diaryapp.views.notform, name= 'notform'), + path('detail//',diaryapp.views.detail, name='detail'), + + #UD + path('edit//',diaryapp.views.edit, name='edit'), + path('update//', diaryapp.views.update, name='update'), + path('delete//',diaryapp.views.delete, name='delete'), +] \ No newline at end of file diff --git a/goeun/diaryapp/views.py b/goeun/diaryapp/views.py new file mode 100644 index 0000000..f6b56f8 --- /dev/null +++ b/goeun/diaryapp/views.py @@ -0,0 +1,45 @@ +from django.shortcuts import render,redirect,get_object_or_404 +from django.utils import timezone +from .models import ReviewNotForm + +# Create your views here. +def new(request): + return render(request, 'new.html') + +def create(request): + review = ReviewNotForm() + review.title = request.POST['title'] + review.pub_date = timezone.now() + review.weather = request.POST['weather'] + review.content = request.POST['content'] + review.phto = request.FILES['phto'] + review.save() + return redirect('notform') + +def notform(request): + reviews = ReviewNotForm.objects + return render(request, 'notform.html',{'reviews': reviews}) + +def detail(request,id): + review = get_object_or_404(ReviewNotForm, id=id) + return render(request,'detail.html',{'review': review}) + +def edit(request,id): + edit_review = ReviewNotForm.objects.get(id = id) + return render(request, 'edit.html', {'edit_review': edit_review}) + +def update(request,id): + update_review = ReviewNotForm.objects.get(id=id) + update_review.title = request.POST['title'] + update_review.pub_date = timezone.now() + update_review.weather = request.POST['weather'] + update_review.content = request.POST['content'] + update_review.phto = request.FILES.get('phto') + update_review.save() + return redirect('notform') + +def delete(request,id): + delete_review = get_object_or_404(ReviewNotForm,id=id) + delete_review.delete() + return redirect('notform') + \ No newline at end of file diff --git a/goeun/journalapp/__init__.py b/goeun/journalapp/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/goeun/journalapp/admin.py b/goeun/journalapp/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/goeun/journalapp/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/goeun/journalapp/apps.py b/goeun/journalapp/apps.py new file mode 100644 index 0000000..85e29f1 --- /dev/null +++ b/goeun/journalapp/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class JournalappConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'journalapp' diff --git a/goeun/journalapp/forms.py b/goeun/journalapp/forms.py new file mode 100644 index 0000000..a7595c0 --- /dev/null +++ b/goeun/journalapp/forms.py @@ -0,0 +1,7 @@ +from django import forms +from .models import ReviewUseForm + +class ReviewForm(forms.ModelForm) : + class Meta: + model = ReviewUseForm + fields = ['title','weather','content','picture'] \ No newline at end of file diff --git a/goeun/journalapp/migrations/0001_initial.py b/goeun/journalapp/migrations/0001_initial.py new file mode 100644 index 0000000..445750b --- /dev/null +++ b/goeun/journalapp/migrations/0001_initial.py @@ -0,0 +1,25 @@ +# Generated by Django 4.2.2 on 2023-06-21 03:33 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='ReviewUseForm', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=30)), + ('pub_date', models.DateTimeField(verbose_name='data published')), + ('weather', models.CharField(max_length=20)), + ('content', models.TextField()), + ('picture', models.FileField(blank=True, upload_to='picture/')), + ], + ), + ] diff --git a/goeun/journalapp/migrations/0002_alter_reviewuseform_picture.py b/goeun/journalapp/migrations/0002_alter_reviewuseform_picture.py new file mode 100644 index 0000000..a62c4e2 --- /dev/null +++ b/goeun/journalapp/migrations/0002_alter_reviewuseform_picture.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.1 on 2023-06-21 15:03 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('journalapp', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='reviewuseform', + name='picture', + field=models.ImageField(blank=True, upload_to='picture/'), + ), + ] diff --git a/goeun/journalapp/migrations/__init__.py b/goeun/journalapp/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/goeun/journalapp/models.py b/goeun/journalapp/models.py new file mode 100644 index 0000000..ec2baaa --- /dev/null +++ b/goeun/journalapp/models.py @@ -0,0 +1,12 @@ +from django.db import models + +# Create your models here. +class ReviewUseForm(models.Model): + title = models.CharField(max_length=30) + pub_date = models.DateTimeField('data published') + weather = models.CharField(max_length=20) + content = models.TextField() + picture = models.ImageField(upload_to='picture/', blank=True) + + def __int__(self): + return self.title diff --git a/goeun/journalapp/templates/detail02.html b/goeun/journalapp/templates/detail02.html new file mode 100644 index 0000000..4300ade --- /dev/null +++ b/goeun/journalapp/templates/detail02.html @@ -0,0 +1,20 @@ +{% extends 'index.html' %} + +{% block title %} + Detail02 +{% endblock %} + +{% block content %} +

journal_Detail Page

+
+

제목:{{ review.title }}

+

날짜 및 시간: {{ review.pub_date }}

+

날씨: {{ review.weather }}

+

일기: {{ review.content }}

+ {% if review.picture %} + picture + {% endif %} +
+ 글 수정하기 + 글 삭제하기 +{% endblock %} \ No newline at end of file diff --git a/goeun/journalapp/templates/update02.html b/goeun/journalapp/templates/update02.html new file mode 100644 index 0000000..d33e896 --- /dev/null +++ b/goeun/journalapp/templates/update02.html @@ -0,0 +1,17 @@ +{% extends 'index.html' %} + +{% block title %} + Update +{% endblock %} + +{% block content %} +

Update Page

+
+
+ {% csrf_token %} + + {{ form.as_table }} +
+ +
+{% endblock %} \ No newline at end of file diff --git a/goeun/journalapp/templates/useform.html b/goeun/journalapp/templates/useform.html new file mode 100644 index 0000000..2aba2cf --- /dev/null +++ b/goeun/journalapp/templates/useform.html @@ -0,0 +1,25 @@ +{% extends 'index.html' %} + +{% block title %} + Read02 +{% endblock %} + +{% block content %} + +

journal Page

+
+

+ {% for reviews in reviews.all %} + +

{{ reviews.title }}

+

날짜 및 시간: {{ reviews.pub_date }}

+

날씨: {{ reviews.weather }}

+

일기: {{ reviews.content }}

+ {% if reviews.picture %} + picture + {% endif %} + {% endfor %} +{% endblock %} \ No newline at end of file diff --git a/goeun/journalapp/templates/write.html b/goeun/journalapp/templates/write.html new file mode 100644 index 0000000..43e4a06 --- /dev/null +++ b/goeun/journalapp/templates/write.html @@ -0,0 +1,15 @@ +{% extends 'index.html' %} + +{% block title %} + Write +{% endblock %} + +{% block content %} +
+ {% csrf_token %} + + {{ form.as_table }} +
+ +
+{% endblock %} \ No newline at end of file diff --git a/goeun/journalapp/tests.py b/goeun/journalapp/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/goeun/journalapp/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/goeun/journalapp/urls.py b/goeun/journalapp/urls.py new file mode 100644 index 0000000..466821b --- /dev/null +++ b/goeun/journalapp/urls.py @@ -0,0 +1,14 @@ +from django.contrib import admin +from django.urls import path +import journalapp.views + +urlpatterns = [ + path('admin/', admin.site.urls), + path('write/',journalapp.views.write, name='write'), + path('useform/',journalapp.views.useform, name= 'useform'), + path('detail02//',journalapp.views.detail02, name='detail02'), + + #UD + path('update02//',journalapp.views.update02, name='update02'), + path('delete02//',journalapp.views.delete02, name='delete02'), +] \ No newline at end of file diff --git a/goeun/journalapp/views.py b/goeun/journalapp/views.py new file mode 100644 index 0000000..f9d1cb0 --- /dev/null +++ b/goeun/journalapp/views.py @@ -0,0 +1,43 @@ +from django.shortcuts import render,redirect,get_object_or_404 +from django.utils import timezone +from .models import ReviewUseForm +from .forms import ReviewForm + +# Create your views here. +def write(request): + if request.method == 'POST': + form = ReviewForm(request.POST,request.FILES) + if form.is_valid(): + form = form.save(commit= False) + form.pub_date = timezone.now() + form.save() + return redirect('useform') + else: + form = ReviewForm + return render(request,'write.html',{'form':form}) + +def useform(request): + reviews = ReviewUseForm.objects.all() + return render(request, 'useform.html',{'reviews':reviews}) + +def detail02(request,id): + review = get_object_or_404(ReviewUseForm, id=id) + return render(request,'detail02.html',{'review':review}) + +def update02(request, id) : + review = get_object_or_404(ReviewUseForm, id= id) + if request.method == 'POST': + form = ReviewForm(request.POST,request.FILES,instance= review) + if form.is_valid(): + form = form.save(commit=False) + form.pub_date = timezone.now() + form.save() + return redirect('useform') + else: + form = ReviewForm(instance=review) + return render(request, 'update02.html',{'form':form}) + +def delete02(request, id): + reviw = get_object_or_404(ReviewUseForm,id=id) + reviw.delete() + return redirect('useform') \ No newline at end of file diff --git a/goeun/mainapp/__init__.py b/goeun/mainapp/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/goeun/mainapp/admin.py b/goeun/mainapp/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/goeun/mainapp/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/goeun/mainapp/apps.py b/goeun/mainapp/apps.py new file mode 100644 index 0000000..8aa89a8 --- /dev/null +++ b/goeun/mainapp/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class MainappConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'mainapp' diff --git a/goeun/mainapp/migrations/__init__.py b/goeun/mainapp/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/goeun/mainapp/models.py b/goeun/mainapp/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/goeun/mainapp/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/goeun/mainapp/templates/index.html b/goeun/mainapp/templates/index.html new file mode 100644 index 0000000..8c2bfce --- /dev/null +++ b/goeun/mainapp/templates/index.html @@ -0,0 +1,44 @@ +{% load static %} + + + + + + + + {% block title %} + Index + {% endblock %} + + + + + {% block content %} +

Index Html입니다.

+ {% endblock %} + {% block content2 %} +

💕고은이의 블로그💕

+ {% endblock %} + + + \ No newline at end of file diff --git a/goeun/mainapp/tests.py b/goeun/mainapp/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/goeun/mainapp/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/goeun/mainapp/views.py b/goeun/mainapp/views.py new file mode 100644 index 0000000..f2bcb00 --- /dev/null +++ b/goeun/mainapp/views.py @@ -0,0 +1,5 @@ +from django.shortcuts import render + +# Create your views here. +def index(request): + return render(request,'index.html') \ No newline at end of file diff --git a/goeun/manage.py b/goeun/manage.py new file mode 100644 index 0000000..30ba11b --- /dev/null +++ b/goeun/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', 'mediaproject.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/goeun/mediaproject/__init__.py b/goeun/mediaproject/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/goeun/mediaproject/asgi.py b/goeun/mediaproject/asgi.py new file mode 100644 index 0000000..666dba5 --- /dev/null +++ b/goeun/mediaproject/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for mediaproject project. + +It exposes the ASGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mediaproject.settings') + +application = get_asgi_application() diff --git a/goeun/mediaproject/settings.py b/goeun/mediaproject/settings.py new file mode 100644 index 0000000..9816d42 --- /dev/null +++ b/goeun/mediaproject/settings.py @@ -0,0 +1,144 @@ +""" +Django settings for mediaproject project. + +Generated by 'django-admin startproject' using Django 4.2.2. + +For more information on this file, see +https://docs.djangoproject.com/en/4.2/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/4.2/ref/settings/ +""" + +from pathlib import Path +import os, json +from django.core.exceptions import ImproperlyConfigured + +# Build paths inside the project like this: BASE_DIR / 'subdir'. +BASE_DIR = Path(__file__).resolve().parent.parent + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +secret_file = os.path.join(BASE_DIR, 'secrets.json') + +with open(secret_file) as f: + secrets = json.loads(f.read()) + +def get_secret(setting, secrets = secrets): + try: + return secrets[setting] + except KeyError: + error_msg = "Set the {} enviroment variable".format(setting) + raise ImproperlyConfigured(error_msg) + +SECRET_KEY = get_secret("SECRET_KEY") + +# 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', + 'diaryapp.apps.DiaryappConfig', + 'journalapp.apps.JournalappConfig', + 'mainapp.apps.MainappConfig', +] + +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 = 'mediaproject.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'mediaproject.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/4.2/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': BASE_DIR / 'db.sqlite3', + } +} + + +# Password validation +# https://docs.djangoproject.com/en/4.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/4.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/4.2/howto/static-files/ + +STATIC_URL = 'static/' + +MEDIA_ROOT = os.path.join(BASE_DIR,'media') + +MEDIA_URL = '/media/' + +# Default primary key field type +# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field + +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' diff --git a/goeun/mediaproject/urls.py b/goeun/mediaproject/urls.py new file mode 100644 index 0000000..7ad9d3b --- /dev/null +++ b/goeun/mediaproject/urls.py @@ -0,0 +1,30 @@ +""" +URL configuration for mediaproject project. + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/4.2/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.conf.urls import include +import mainapp.views +from django.conf import settings +from django.conf.urls.static import static + +urlpatterns = [ + path('admin/', admin.site.urls), + path('',mainapp.views.index, name='index'), + + path('',include('diaryapp.urls')), + path('',include('journalapp.urls')), +] + static(settings.MEDIA_URL,document_root = settings.MEDIA_ROOT) diff --git a/goeun/mediaproject/wsgi.py b/goeun/mediaproject/wsgi.py new file mode 100644 index 0000000..7eae794 --- /dev/null +++ b/goeun/mediaproject/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for mediaproject project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mediaproject.settings') + +application = get_wsgi_application() diff --git a/goeun/result_img/diary.png b/goeun/result_img/diary.png new file mode 100644 index 0000000..868e830 Binary files /dev/null and b/goeun/result_img/diary.png differ diff --git a/goeun/result_img/diary_detail.png b/goeun/result_img/diary_detail.png new file mode 100644 index 0000000..e133d9a Binary files /dev/null and b/goeun/result_img/diary_detail.png differ diff --git a/goeun/result_img/journal.png b/goeun/result_img/journal.png new file mode 100644 index 0000000..ec2126e Binary files /dev/null and b/goeun/result_img/journal.png differ diff --git a/goeun/result_img/journal_detail.png b/goeun/result_img/journal_detail.png new file mode 100644 index 0000000..f39013d Binary files /dev/null and b/goeun/result_img/journal_detail.png differ