Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*.pyc
*~
__pycache__
myvenv
db.sqlite3
/static
.DS_Store
3 changes: 3 additions & 0 deletions community/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"git.ignoreLimitWarning": true
}
Empty file added community/README.md
Empty file.
Empty file added community/accounts/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions community/accounts/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
5 changes: 5 additions & 0 deletions community/accounts/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class AccountsConfig(AppConfig):
name = 'accounts'
5 changes: 5 additions & 0 deletions community/accounts/forms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.contribauth.models import User
from django import forms

class SignUpForm(forms.ModelForm):

Empty file.
3 changes: 3 additions & 0 deletions community/accounts/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.db import models

# Create your models here.
22 changes: 22 additions & 0 deletions community/accounts/templates/accounts/login.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{% extends 'base.html' %}

{% block title %}
{% endblock %}

{% block content %}

<div class="row">
<div class="col"></div>
<div class="col-6">
<div class="alert alert-primary" role="alert">
Please enter your login information.
</div>
<form action="" method="post">
{% csrf_token %}
{{form.as_p}}
<input type="submit" value="Login">
</form>
</div>
<div class="col"></div>
</div>
{% endblock %}
18 changes: 18 additions & 0 deletions community/accounts/templates/accounts/logout.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{% extends 'base.html' %}

{% block title %}
{% endblock %}

{% block content %}

<div class="row">
<div class="col"></div>
<div class="col-6">
<div class="alert alert-primary" role="alert">
Logout
</div>
<a href="{% url 'accounts:login' %}" class="btn btn-outline-success">Login</a>
</div>
<div class="col"></div>
</div>
{% endblock %}
21 changes: 21 additions & 0 deletions community/accounts/templates/accounts/signup.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{% extends 'base.html' %}

{% block content %}

<div class="row">
<div class="col"></div>
<div class="col-6">

<form action="" method="post">
<div class ="alert alert-info">Enter your account information </div>
{% csrf_token %}
<label>Username : <input type="text" name="username"></label>
<label>Password : <input type="password" name="password"></label>
<label>Repeat Password : <input type="password" name="password2"></label>
<input type="submit" value ="Sign up" class ="btn btn-outline-info">

</form>
</div>
<div class="col"></div>
</div>
{% endblock %}
18 changes: 18 additions & 0 deletions community/accounts/templates/accounts/signup_complete.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{% extends 'base.html' %}

{% block title %}
{% endblock %}

{% block content %}

<div class="row">
<div class="col"></div>
<div class="col-6">
<div class="alert alert-primary" role="alert">
Successfully signed up ! Welcome
</div>
<a href="{% url 'accounts:login' %}">Move to Login </a>
</div>
<div class="col"></div>
</div>
{% endblock %}
3 changes: 3 additions & 0 deletions community/accounts/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.
11 changes: 11 additions & 0 deletions community/accounts/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from django.urls import path
from django.contrib.auth.views import LoginView, LogoutView
from .views import signup

app_name ="accounts"

urlpatterns = [
path('login/',LoginView.as_view(template_name ='accounts/login.html'),name='login'),
path('logout/',LogoutView.as_view(template_name ='accounts/logout.html'), name ='logout'),
path('signup/',signup, name='signup'),
]
17 changes: 17 additions & 0 deletions community/accounts/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from django.shortcuts import render
from django.contrib.auth.models import User

def signup(request):
if request.method =='POST':
username =request.POST.get('username')
password = request.POST.get('password')
password2 = request.POST.get('password2')
print(username, password , password2)
user = User()
user.username = username
user.set_password(password)
user.save()
return render(request, 'accounts/signup_complete.html')
else:
context_values = {'form':'this is form'}
return render(request, 'accounts/signup.html',context_values)
Empty file added community/config/__init__.py
Empty file.
128 changes: 128 additions & 0 deletions community/config/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
"""
Django settings for config project.

Generated by 'django-admin startproject' using Django 2.0.13.

For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.0/ref/settings/
"""

import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'j^!+^53@(+bx@*3glm3@41z5y6=8gro%wd0v)5pl)e_=kb=uxk'

# 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',
'example',
'photo',
'accounts',
]

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 = 'config.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR,'layout')],
'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 = 'config.wsgi.application'


# Database
# https://docs.djangoproject.com/en/2.0/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}


# Password validation
# https://docs.djangoproject.com/en/2.0/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/2.0/topics/i18n/

LANGUAGE_CODE = 'ko'

TIME_ZONE = 'Asia/Seoul'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.0/howto/static-files/

STATIC_URL = '/static/'

LOGIN_REDIRECT_URL ='/'

MEDIA_URL ='/res/'
MEDIA_ROOT = os.path.join(BASE_DIR,'media')
23 changes: 23 additions & 0 deletions community/config/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""config URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/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, include

urlpatterns = [
path('admin/', admin.site.urls),
path('',include('photo.urls')),
path('accounts/',include('accounts.urls')),
]
16 changes: 16 additions & 0 deletions community/config/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
WSGI config for config 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/2.0/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")

application = get_wsgi_application()
Binary file added community/db.sqlite3
Binary file not shown.
Empty file added community/example/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions community/example/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
5 changes: 5 additions & 0 deletions community/example/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class ExampleConfig(AppConfig):
name = 'example'
Empty file.
3 changes: 3 additions & 0 deletions community/example/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.db import models

# Create your models here.
10 changes: 10 additions & 0 deletions community/example/templates/hello.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{{ title }}</title>
</head>
<body>
{{ body }}
</body>
</html>
3 changes: 3 additions & 0 deletions community/example/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.
Empty file added community/example/urls.py
Empty file.
11 changes: 11 additions & 0 deletions community/example/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from django.shortcuts import render
from django.http import HttpResponse

def hello(request):
print(request)
return render(request,'hello.html',{'title':'hello','body':'world'})

def http_response(request):
str1= 'hello2'
str2 = 'django'
return HttpResponse(str1 + str2)
Loading