-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
67fe56d
commit d8ac5a1
Showing
6,496 changed files
with
975,186 additions
and
0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
django deployment/ | ||
flask deployment/ | ||
practice/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"git.ignoreLimitWarning": true, | ||
"python.formatting.provider": "yapf", | ||
"python.pythonPath": "C:\\Python38\\python.exe" | ||
} |
3 changes: 3 additions & 0 deletions
3
Django/assignments/Login_and_Registration/.vscode/settings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"git.ignoreLimitWarning": true | ||
} |
Empty file.
Binary file added
BIN
+210 Bytes
Django/assignments/Login_and_Registration/Login_and_Registration/__init__.pyc
Binary file not shown.
121 changes: 121 additions & 0 deletions
121
Django/assignments/Login_and_Registration/Login_and_Registration/settings.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
""" | ||
Django settings for Login_and_Registration project. | ||
Generated by 'django-admin startproject' using Django 1.11.10. | ||
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 = 'g3lwf4=m1*#m5tbtz2pdafp@!74c-yq_z*7@da_&9q82^_i%*^' | ||
|
||
# SECURITY WARNING: don't run with debug turned on in production! | ||
DEBUG = True | ||
|
||
ALLOWED_HOSTS = [] | ||
|
||
|
||
# Application definition | ||
|
||
INSTALLED_APPS = [ | ||
'apps.main', | ||
'django.contrib.admin', | ||
'django.contrib.auth', | ||
'django.contrib.contenttypes', | ||
'django.contrib.sessions', | ||
'django.contrib.messages', | ||
'django.contrib.staticfiles', | ||
] | ||
|
||
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 = 'Login_and_Registration.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 = 'Login_and_Registration.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/' |
Binary file added
BIN
+2.64 KB
Django/assignments/Login_and_Registration/Login_and_Registration/settings.pyc
Binary file not shown.
22 changes: 22 additions & 0 deletions
22
Django/assignments/Login_and_Registration/Login_and_Registration/urls.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
"""Login_and_Registration 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, include | ||
from django.contrib import admin | ||
|
||
urlpatterns = [ | ||
url(r'^', include('apps.main.urls')), | ||
url(r'^admin/', admin.site.urls), | ||
] |
Binary file added
BIN
+1.11 KB
Django/assignments/Login_and_Registration/Login_and_Registration/urls.pyc
Binary file not shown.
16 changes: 16 additions & 0 deletions
16
Django/assignments/Login_and_Registration/Login_and_Registration/wsgi.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
""" | ||
WSGI config for Login_and_Registration 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", "Login_and_Registration.settings") | ||
|
||
application = get_wsgi_application() |
Binary file added
BIN
+698 Bytes
Django/assignments/Login_and_Registration/Login_and_Registration/wsgi.pyc
Binary file not shown.
Empty file.
Binary file not shown.
Empty file.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
from django.contrib import admin | ||
|
||
# Register your models here. |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
from django.apps import AppConfig | ||
|
||
|
||
class MainConfig(AppConfig): | ||
name = 'main' |
28 changes: 28 additions & 0 deletions
28
Django/assignments/Login_and_Registration/apps/main/migrations/0001_initial.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.11.10 on 2018-02-28 06:50 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='User', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('fname', models.CharField(max_length=255)), | ||
('lname', models.CharField(max_length=255)), | ||
('email', models.EmailField(max_length=254)), | ||
('password', models.CharField(max_length=255)), | ||
('created_at', models.DateTimeField(auto_now_add=True)), | ||
('updated_at', models.DateTimeField(auto_now=True)), | ||
], | ||
), | ||
] |
Binary file added
BIN
+1.21 KB
Django/assignments/Login_and_Registration/apps/main/migrations/0001_initial.pyc
Binary file not shown.
Empty file.
Binary file added
BIN
+208 Bytes
Django/assignments/Login_and_Registration/apps/main/migrations/__init__.pyc
Binary file not shown.
36 changes: 36 additions & 0 deletions
36
Django/assignments/Login_and_Registration/apps/main/models.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
from django.db import models | ||
import re | ||
import bcrypt | ||
|
||
class UserManager(models.Manager): | ||
def basic_validator(self, postData): | ||
EMAIL_REGEX = re.compile(r'^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9._-]+\.[a-zA-Z]+$') | ||
errors = {} | ||
if len(postData['fname']) < 2: | ||
errors['fname'] = "First Name is required, must be at least 2 characters!" | ||
elif not postData['fname'].isalpha(): | ||
errors['fname'] = "First name must contain only letters!" | ||
if len(postData['lname']) < 2: | ||
errors['lname'] = "Last Name is required, must be at least 2 characters!" | ||
elif not postData['lname'].isalpha(): | ||
errors['lname'] = "Last name must contain only letters!" | ||
if not EMAIL_REGEX.match(postData['email']): | ||
errors['email'] = "Must be a valid email!" | ||
elif len(User.objects.filter(email=postData["email"])): | ||
errors['email'] = "Email already in use, try again" | ||
if len(postData['password']) < 8: | ||
errors['password'] = "Password is required, must be at least 8 characters!" | ||
if postData['password'] != postData['confirm']: | ||
errors['confirm'] = "Passwords must match!" | ||
return errors | ||
|
||
class User(models.Model): | ||
fname = models.CharField(max_length=255) | ||
lname = models.CharField(max_length=255) | ||
email = models.EmailField() | ||
password = models.CharField(max_length=255) | ||
created_at = models.DateTimeField(auto_now_add=True) | ||
updated_at = models.DateTimeField(auto_now = True) | ||
objects = UserManager() |
Binary file not shown.
28 changes: 28 additions & 0 deletions
28
Django/assignments/Login_and_Registration/apps/main/static/main/css/style.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
*{ | ||
font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif; | ||
} | ||
#reg{ | ||
border: 1px solid black; | ||
border-radius: 3px; | ||
padding: 10px 5px; | ||
margin: 0px auto; | ||
width: 500px; | ||
background-color: lightsalmon; | ||
text-align: center; | ||
} | ||
#log{ | ||
border: 1px solid black; | ||
border-radius: 3px; | ||
padding: 10px 5px; | ||
margin: 20px auto; | ||
width: 500px; | ||
background-color: lightgreen; | ||
text-align: center; | ||
} | ||
.button{ | ||
padding: 5px 10px; | ||
background-color: lightgoldenrodyellow; | ||
} | ||
#green{ | ||
color: lightgreen; | ||
} |
46 changes: 46 additions & 0 deletions
46
Django/assignments/Login_and_Registration/apps/main/templates/main/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
{% load static %} | ||
<link rel="stylesheet" href="{% static 'main/css/style.css' %}"> | ||
<title>Login & Reg | Home</title> | ||
</head> | ||
<body> | ||
{% if messages %} | ||
{% for message in messages %} | ||
<h3>{% if message.tags %} {% endif %} {{ message }}</h3> | ||
{% endfor %} | ||
{% endif %} | ||
<div id="reg"> | ||
<h2>Registration</h2> | ||
<form action="/register" method="POST"> | ||
{% csrf_token %} | ||
<p>First Name</p> | ||
<p><input type="text" name="fname"></input></p> | ||
<p>Last Name</p> | ||
<p><input type="text" name="lname"></input></p> | ||
<p>Email</p> | ||
<p><input type="text" name="email"></input></p> | ||
<p>Password:</p> | ||
<p><input type="password" name="password"></input></p> | ||
<p>Confirm Password</p> | ||
<p><input type="password" name="confirm"></input></p> | ||
<input class="button" type="submit" Value="REGISTER"></input> | ||
</form> | ||
</div> | ||
<div id="log"> | ||
<h3>Login</h3> | ||
<form action="/login" method="POST"> | ||
{% csrf_token %} | ||
<p>Email</p> | ||
<p><input type="text" name="email"></p> | ||
<p>Password</p> | ||
<p><input type="password" name="password"></p> | ||
<input class="button" type="submit" value="LOGIN"> | ||
</form> | ||
</div> | ||
</body> | ||
</html> |
20 changes: 20 additions & 0 deletions
20
Django/assignments/Login_and_Registration/apps/main/templates/main/success.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
{% load static %} | ||
<link rel="stylesheet" href="{% static 'main/css/style.css' %}"> | ||
<title>Login & Reg | Success</title> | ||
</head> | ||
<body> | ||
<h2>Success! Welcome, {{ name }}!</h2> | ||
<p id="green">Successfully registered (or logged in)!</p> | ||
<hr> | ||
<form action="/logout" method="POST"> | ||
{% csrf_token %} | ||
<input class="button" type="submit" value="LOG OUT"> | ||
</form> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
from django.test import TestCase | ||
|
||
# Create your tests here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from django.conf.urls import url | ||
from . import views | ||
urlpatterns = [ | ||
url(r'^$', views.index), | ||
url(r'^register$', views.register), | ||
url(r'^login$', views.login), | ||
url(r'^success$', views.success), | ||
url(r'^logout$', views.log_out), | ||
] |
Binary file not shown.
Oops, something went wrong.