增加用户登录

包括用户model、用户登录模板、登录api和测试。
This commit is contained in:
virusdefender
2015-06-29 12:43:17 +08:00
parent 00052d8e9b
commit 592720dd01
11 changed files with 175 additions and 7 deletions

View File

@@ -46,6 +46,12 @@ INSTALLED_APPS = (
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'account',
'rest_framework',
'rest_framework_swagger',
)
MIDDLEWARE_CLASSES = (
@@ -113,6 +119,12 @@ STATIC_URL = '/static/'
STATICFILES_DIRS = (os.path.join(BASE_DIR, "static"),)
TEMPLATE_DIRS = (
os.path.join(BASE_DIR, "template"),
)
AUTH_USER_MODEL = 'account.User'
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
@@ -147,7 +159,7 @@ LOGGING = {
},
'django.db.backends': {
'handlers': ['console'],
'level': 'DEBUG',
'level': 'ERROR',
'propagate': True,
}
},

View File

@@ -3,10 +3,17 @@ from django.conf.urls import include, url
from django.contrib import admin
from django.views.generic import TemplateView
from account.views import UserLoginAPIView
urlpatterns = [
# Examples:
# url(r'^$', 'qduoj.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^docs/', include('rest_framework_swagger.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^login/$', TemplateView.as_view(template_name="account/login.html"), name="user_login_page"),
url(r'^api/login/$', UserLoginAPIView.as_view(), name="user_login_api"),
]