diff --git a/backend/auth/__init__.py b/backend/auth2/__init__.py similarity index 100% rename from backend/auth/__init__.py rename to backend/auth2/__init__.py diff --git a/backend/auth/admin.py b/backend/auth2/admin.py similarity index 100% rename from backend/auth/admin.py rename to backend/auth2/admin.py diff --git a/backend/auth/models.py b/backend/auth2/models.py similarity index 100% rename from backend/auth/models.py rename to backend/auth2/models.py diff --git a/backend/auth/tests.py b/backend/auth2/tests.py similarity index 100% rename from backend/auth/tests.py rename to backend/auth2/tests.py diff --git a/backend/auth/utils.py b/backend/auth2/utils.py similarity index 97% rename from backend/auth/utils.py rename to backend/auth2/utils.py index e1dbc08..2e56c6b 100644 --- a/backend/auth/utils.py +++ b/backend/auth2/utils.py @@ -1,6 +1,6 @@ import json from django.http import HttpResponse -from auth.models import Token +from auth2.models import Token def json_response(response_dict, status=200): diff --git a/backend/auth/views.py b/backend/auth2/views.py similarity index 95% rename from backend/auth/views.py rename to backend/auth2/views.py index f79754c..185ab02 100644 --- a/backend/auth/views.py +++ b/backend/auth2/views.py @@ -2,8 +2,8 @@ from django.contrib.auth.models import User from django.db import IntegrityError from django.views.decorators.csrf import csrf_exempt -from auth.models import Token -from auth.utils import json_response, token_required +from auth2.models import Token +from auth2.utils import json_response, token_required @csrf_exempt @@ -11,7 +11,8 @@ def register(request): if request.method == 'POST': username = request.POST.get('username', None) password = request.POST.get('password', None) - + print 'hello' + if username is not None and password is not None: try: user = User.objects.create_user(username, None, password) diff --git a/backend/backend/settings.py b/backend/backend/settings.py index c54cbb1..a6a6465 100644 --- a/backend/backend/settings.py +++ b/backend/backend/settings.py @@ -36,7 +36,7 @@ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', - 'auth', + 'auth2', ) MIDDLEWARE_CLASSES = ( @@ -52,6 +52,43 @@ WSGI_APPLICATION = 'backend.wsgi.application' +LOGGING = { + 'version': 1, + 'disable_existing_loggers': False, + 'filters': { + 'require_debug_false': { + '()': 'django.utils.log.RequireDebugFalse' + } + }, + 'formatters': { + 'verbose': { + 'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s', + }, + 'simple': { + 'format': '%(levelname)s %(message)s', + }, + }, + 'handlers': { + 'mail_admins': { + 'level': 'ERROR', + 'filters': ['require_debug_false'], + 'class': 'django.utils.log.AdminEmailHandler' + }, + 'console': { + 'level': 'DEBUG', + 'class': 'logging.StreamHandler', + 'formatter': 'verbose', + }, + }, + 'loggers': { + 'django.request': { + # 'handlers': ['mail_admins'], + 'handlers': ['console'], + 'level': 'INFO', #INFO + 'propagate': True, + }, + } +} # Database # https://docs.djangoproject.com/en/1.6/ref/settings/#databases diff --git a/backend/backend/urls.py b/backend/backend/urls.py index f61791d..e170c55 100644 --- a/backend/backend/urls.py +++ b/backend/backend/urls.py @@ -7,8 +7,8 @@ # Examples: # url(r'^$', 'backend.views.home', name='home'), # url(r'^blog/', include('blog.urls')), - url(r'^api/register/$', 'auth.views.register'), - url(r'^api/login/$', 'auth.views.login'), - url(r'^api/logout/$', 'auth.views.logout'), + url(r'^api/register/$', 'auth2.views.register'), + url(r'^api/login/$', 'auth2.views.login'), + url(r'^api/logout/$', 'auth2.views.logout'), url(r'^admin/', include(admin.site.urls)), )