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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
128 changes: 128 additions & 0 deletions JeonJaewon/Clonestagram/Clonestagram/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
"""
Django settings for Clonestagram project.

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

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

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/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/1.11/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'vv3n@^b@zy6y3r!)a0^0=)qvl^hjnwp@_9-#3hrd%!k4lft_d%'

# 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',
'indexApp.apps.IndexappConfig',
]

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 = 'Clonestagram.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 = 'Clonestagram.wsgi.application'


# Database
# https://docs.djangoproject.com/en/1.11/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/1.11/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/1.11/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


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

STATIC_URL = '/static/'

STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'indexApp', 'static')
]

STATIC_ROOT = os.path.join(BASE_DIR, 'static')

27 changes: 27 additions & 0 deletions JeonJaewon/Clonestagram/Clonestagram/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""Clonestagram URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url
from django.contrib import admin
from indexApp.views import signup
from indexApp.views import main
from indexApp.views import home

urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^signup/', signup, name='signup'),
url(r'^home/', home, name='home'),
url('', main, name='main'),
]
16 changes: 16 additions & 0 deletions JeonJaewon/Clonestagram/Clonestagram/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
WSGI config for Clonestagram 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/1.11/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

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

application = get_wsgi_application()
Binary file added JeonJaewon/Clonestagram/db.sqlite3
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
3 changes: 3 additions & 0 deletions JeonJaewon/Clonestagram/indexApp/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 JeonJaewon/Clonestagram/indexApp/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class IndexappConfig(AppConfig):
name = 'indexApp'
Empty file.
Binary file not shown.
3 changes: 3 additions & 0 deletions JeonJaewon/Clonestagram/indexApp/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.
30 changes: 30 additions & 0 deletions JeonJaewon/Clonestagram/indexApp/static/css/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
h1 {
margin-top: 10%;
margin-bottom: 30px;
text-align: center;
}
#inputContainer {
text-align: center;
width: 200px;
margin: 0 auto;
margin-bottom: 10px;
}
.inputGroup {
margin: 5px 0;
width: 200px;
height: 40px;
display: block;
}
#btnLogin {
display: block;
width: 200px;
margin: 0 auto;
margin-top: 10px;
}
#btnSignup {
text-align: center;
display: block;
width: 200px;
margin: 0 auto;
margin-top: 30px;
}
18 changes: 18 additions & 0 deletions JeonJaewon/Clonestagram/indexApp/static/css/signup.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.inputGroup {
margin: 5px 0;
margin-bottom : 15px;
width: 200px;
height: 40px;
display: block;
}
#inputContainer {
text-align: center;
width: 200px;
margin: 0 auto;
margin-bottom: 10px;
}
#btnSubmit {
display: block;
margin: 0 auto;
width: 200px;
}
10 changes: 10 additions & 0 deletions JeonJaewon/Clonestagram/indexApp/templates/home.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>
<p>로그인 완료</p>
</body>
</html>
33 changes: 33 additions & 0 deletions JeonJaewon/Clonestagram/indexApp/templates/main.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{% load static %}
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">


<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<link rel="stylesheet" href="{% static 'css/main.css' %}">
<!-- <link rel="stylesheet" href="main.css">-->
<title>Hello, world!</title>
</head>
<body>
<h1>Clonestagram</h1>
<div id="inputContainer">
<form method="POST">
{% csrf_token %}
<input name="username" class="inputGroup" type="text" placeholder="사용자 이름">
<input name="password" class="inputGroup" type="password" placeholder="비밀번호">
<input id="btnLogin" type="submit" class="btn btn-primary" value="로그인">
</form>
</div>
<a id="btnSignup" href="http://127.0.0.1:8000/signup/">가입하기</a>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
</body>
</html>
22 changes: 22 additions & 0 deletions JeonJaewon/Clonestagram/indexApp/templates/signup.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<!-- <link rel="stylesheet" href="signup.css">-->
<title>Title</title>
<link rel="stylesheet" href="{% static 'css/signup.css' %}">
</head>
<body>
<div id="inputContainer" style="margin-top:10%">
<form method="POST">
{% csrf_token %}
<input name="phone" class="inputGroup" type="text" placeholder="휴대폰 번호">
<input name="username" class="inputGroup" type="text" placeholder="사용자 이름">
<input name="password" class="inputGroup" type="password" placeholder="비밀번호">
<input type="submit" class="btn btn-primary" id="btnSubmit" value="확인">
</form>
</div>
</body>
</html>
3 changes: 3 additions & 0 deletions JeonJaewon/Clonestagram/indexApp/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.
37 changes: 37 additions & 0 deletions JeonJaewon/Clonestagram/indexApp/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from django.shortcuts import render, redirect
from django.contrib.auth.models import User
from django.contrib import auth


# Create your views here.


def signup(request):
if request.method == "POST":
if request.POST["username"] != "" and request.POST["password"] != "":
user = User.objects.create_user(
username=request.POST["username"],
password=request.POST["password"])
auth.login(request, user)
return redirect('main')
else:
return render(request, 'signup.html')


def main(request):
if request.method == "POST":
username = request.POST["username"]
password = request.POST["password"]
user = auth.authenticate(request, username=username, password=password)
if user is not None:
auth.login(request, user)
return redirect('home')
else:
# return redirect('signup')
return render(request, 'main.html', {'error': '아이디나 패스워드 오류입니다'})
else:
return render(request, 'main.html')


def home(request):
return render(request, 'home.html')
22 changes: 22 additions & 0 deletions JeonJaewon/Clonestagram/manage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env python
import os
import sys

if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Clonestagram.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
# issue is really that Django is missing to avoid masking other
# exceptions on Python 2.
try:
import django
except ImportError:
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?"
)
raise
execute_from_command_line(sys.argv)
Loading