From c253413d7f03fb73df4064bd6b3df90965fccd34 Mon Sep 17 00:00:00 2001 From: Hongyuan Ma Date: Tue, 15 May 2018 23:13:27 +0800 Subject: [PATCH] modify settings.py --- web/apps/tests/models.py | 6 +++--- web/pgperffarm/settings.py | 22 +++++++++++++++------- web/pgperffarm/urls.py | 38 ++++++++++++++++++++------------------ 3 files changed, 38 insertions(+), 28 deletions(-) diff --git a/web/apps/tests/models.py b/web/apps/tests/models.py index db48aa2..4111f0f 100644 --- a/web/apps/tests/models.py +++ b/web/apps/tests/models.py @@ -1,8 +1,8 @@ from datetime import datetime from django.db import models -from users.models import UserProfile -from user_operation.models import UserMachine +from apps.users.models import UserProfile +from apps.user_operation.models import UserMachine # Create your models here. class TestBranch(models.Model): @@ -18,7 +18,7 @@ class TestBranch(models.Model): def __str__(self): return self.branch_name - + class TestCategory(models.Model): """ tests category diff --git a/web/pgperffarm/settings.py b/web/pgperffarm/settings.py index 38fdf8a..aada705 100644 --- a/web/pgperffarm/settings.py +++ b/web/pgperffarm/settings.py @@ -1,5 +1,6 @@ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) import os +import sys # Load local settings overrides from settings_local import * @@ -16,8 +17,11 @@ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ """ +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - +sys.path.insert(0, BASE_DIR) +sys.path.insert(0, os.path.join(BASE_DIR, 'apps')) +sys.path.insert(0, os.path.join(BASE_DIR, 'extra_apps')) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/ @@ -41,6 +45,10 @@ INSTALLED_APPS = ( 'django.contrib.messages', 'django.contrib.staticfiles', 'django_gravatar', + 'rest_framework', + 'apps.tests.apps.TestsConfig', + 'apps.user_operation.apps.UserOperationConfig', + 'apps.users.apps.UsersConfig' ) MIDDLEWARE_CLASSES = ( @@ -78,12 +86,12 @@ WSGI_APPLICATION = 'pgperffarm.wsgi.application' # Database # https://docs.djangoproject.com/en/1.8/ref/settings/#databases -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), - } -} +# DATABASES = { +# 'default': { +# 'ENGINE': 'django.db.backends.sqlite3', +# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), +# } +# } # Internationalization diff --git a/web/pgperffarm/urls.py b/web/pgperffarm/urls.py index 3b439eb..e923a02 100644 --- a/web/pgperffarm/urls.py +++ b/web/pgperffarm/urls.py @@ -17,23 +17,25 @@ from django.contrib import admin from django.views.generic.base import RedirectView urlpatterns = [ - # Static pages - url(r'^$', 'pgperffarm.views.index', name='index'), - url(r'^/licence$', 'pgperffarm.views.licence', name='licence'), - url(r'^/ppolicy$', 'pgperffarm.views.ppolicy', name='ppolicy'), - - # Auth system integration - url(r'^(?:account/)?login/?$', 'pgperffarm.auth.login'), - url(r'^(?:account/)?logout/?$', 'pgperffarm.auth.logout'), - url(r'^auth_receive/$', 'pgperffarm.auth.auth_receive'), + # url(r'^admin/', admin.site.urls), + url(r'^api-auth/', include('rest_framework.urls')), - # Admin site - url(r'^admin/', include(admin.site.urls)), - # This should not happen in production - serve with lightty! - url(r'^static/(.*)$', 'django.views.static.serve', { - 'document_root': '/static', - }), - url(r'^favicon\.ico$', RedirectView.as_view(url='/static/favicon.ico', - permanent=True)) -] + # Static pages + # url(r'^$', 'pgperffarm.views.index', name='index'), + # url(r'^/licence$', 'pgperffarm.views.licence', name='licence'), + # url(r'^/ppolicy$', 'pgperffarm.views.ppolicy', name='ppolicy'), + # + # # Auth system integration + # url(r'^(?:account/)?login/?$', 'pgperffarm.auth.login'), + # url(r'^(?:account/)?logout/?$', 'pgperffarm.auth.logout'), + # url(r'^auth_receive/$', 'pgperffarm.auth.auth_receive'), + # + # # Admin site + # url(r'^admin/', include(admin.site.urls)), + # + # # This should not happen in production - serve with lightty! + # url(r'^static/(.*)$', 'django.views.static.serve', { + # 'document_root': '/static', + # }), +] \ No newline at end of file -- 2.39.5