Skip to content

Commit

Permalink
v0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jianw4 committed Jan 2, 2018
0 parents commit 8cdba36
Show file tree
Hide file tree
Showing 50 changed files with 14,385 additions and 0 deletions.
Empty file added BabyEnglish/__init__.py
Empty file.
133 changes: 133 additions & 0 deletions BabyEnglish/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
"""
Django settings for BabyEnglish project.
Generated by 'django-admin startproject' using Django 1.11.5.
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 = '(uth-(6)b3_+!hjk6jt58z2@6h%)1*-n+@u(5g(xlp5gvbl!iw'

# 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',
'video',
'UserManage',
]

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

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

TEMPLATE_DIRS = (
os.path.join(BASE_DIR, 'templates'),
)

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

STATICFILES_DIRS = (
os.path.join(BASE_DIR, "static"),
)

STATIC_URL = '/static/'
# 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/'
29 changes: 29 additions & 0 deletions BabyEnglish/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""BabyEnglish 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 *
from django.contrib import admin
from video import urls, views

urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^video/', include('video.urls')),
url(r'^login/',views.login),
url(r'^logout/',views.logout),
url(r'^register/',views.register, name='register'),
url(r'^index/$', views.list),
url(r'^index/(?P<username>\w+)/$',views.list),
url(r'^pl/$', views.pl),
]
16 changes: 16 additions & 0 deletions BabyEnglish/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
WSGI config for BabyEnglish 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", "BabyEnglish.settings")

application = get_wsgi_application()
Empty file added UserManage/__init__.py
Empty file.
12 changes: 12 additions & 0 deletions UserManage/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from django.contrib import admin
from UserManage.models import *

# Register your models here.

class UserAdmin(admin.ModelAdmin):
list_display = ('username', 'password', 'email',)
list_filter = ('username',)



admin.site.register(User, UserAdmin)
5 changes: 5 additions & 0 deletions UserManage/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class UsermanageConfig(AppConfig):
name = 'UserManage'
38 changes: 38 additions & 0 deletions UserManage/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-10-26 14:23
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
migrations.CreateModel(
name='Group',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=50, unique=True)),
],
),
migrations.CreateModel(
name='User',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('username', models.CharField(max_length=50, unique=True)),
('password', models.CharField(max_length=100)),
('key_pass', models.CharField(max_length=100)),
('name', models.CharField(max_length=50)),
('is_admin', models.BooleanField(default=False)),
('is_superuser', models.BooleanField(default=False)),
('ldap_password', models.CharField(max_length=100)),
('email', models.EmailField(blank=True, max_length=50, null=True)),
('group', models.ManyToManyField(to='UserManage.Group')),
],
),
]
27 changes: 27 additions & 0 deletions UserManage/migrations/0002_auto_20171026_2231.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-10-26 14:31
from __future__ import unicode_literals

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('UserManage', '0001_initial'),
]

operations = [
migrations.RemoveField(
model_name='user',
name='key_pass',
),
migrations.RemoveField(
model_name='user',
name='ldap_password',
),
migrations.RemoveField(
model_name='user',
name='name',
),
]
22 changes: 22 additions & 0 deletions UserManage/migrations/0003_auto_20171026_2233.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-10-26 14:33
from __future__ import unicode_literals

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('UserManage', '0002_auto_20171026_2231'),
]

operations = [
migrations.RemoveField(
model_name='user',
name='group',
),
migrations.DeleteModel(
name='Group',
),
]
35 changes: 35 additions & 0 deletions UserManage/migrations/0004_auto_20171029_1946.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-10-29 11:46
from __future__ import unicode_literals

import datetime
from django.db import migrations, models
from django.utils.timezone import utc


class Migration(migrations.Migration):

dependencies = [
('UserManage', '0003_auto_20171026_2233'),
]

operations = [
migrations.AddField(
model_name='user',
name='city',
field=models.CharField(default=datetime.datetime(2017, 10, 29, 11, 45, 16, 337172, tzinfo=utc), max_length=100),
preserve_default=False,
),
migrations.AddField(
model_name='user',
name='nickname',
field=models.CharField(default=datetime.datetime(2017, 10, 29, 11, 45, 39, 467918, tzinfo=utc), max_length=50, unique=True),
preserve_default=False,
),
migrations.AddField(
model_name='user',
name='sex',
field=models.BooleanField(default=True),
preserve_default=False,
),
]
26 changes: 26 additions & 0 deletions UserManage/migrations/0005_comment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-10-30 07:42
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone


class Migration(migrations.Migration):

dependencies = [
('UserManage', '0004_auto_20171029_1946'),
]

operations = [
migrations.CreateModel(
name='comment',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('content', models.CharField(max_length=100)),
('time', models.DateTimeField(default=django.utils.timezone.now, verbose_name='发表时间')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='UserManage.User', verbose_name='Video')),
],
),
]
28 changes: 28 additions & 0 deletions UserManage/migrations/0006_auto_20171030_1733.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-10-30 09:33
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion
import uuid


class Migration(migrations.Migration):

dependencies = [
('video', '0001_initial'),
('UserManage', '0005_comment'),
]

operations = [
migrations.AddField(
model_name='comment',
name='video',
field=models.ForeignKey(default=uuid.uuid1, on_delete=django.db.models.deletion.CASCADE, to='video.Video'),
),
migrations.AlterField(
model_name='comment',
name='user',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='UserManage.User', verbose_name='user'),
),
]
Empty file.
Loading

0 comments on commit 8cdba36

Please sign in to comment.