Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Django 项目URL在安装Oscar后被覆盖_Django_Django Views_Django Urls_Django Apps - Fatal编程技术网

Django 项目URL在安装Oscar后被覆盖

Django 项目URL在安装Oscar后被覆盖,django,django-views,django-urls,django-apps,Django,Django Views,Django Urls,Django Apps,所以我一直在做一个项目,我需要2个应用程序。我从零开始做了一个,我正在使用奥斯卡(一个电子商务应用程序)。我已安装的应用程序中有这两个应用程序。但是在安装了oscar之后,我无法访问我的其他应用程序的URL 设置.py from oscar.defaults import * from oscar import OSCAR_MAIN_TEMPLATE_DIR from oscar import get_core_apps import os BASE_DIR = os.path.dirname

所以我一直在做一个项目,我需要2个应用程序。我从零开始做了一个,我正在使用奥斯卡(一个电子商务应用程序)。我已安装的应用程序中有这两个应用程序。但是在安装了oscar之后,我无法访问我的其他应用程序的URL

设置.py

from oscar.defaults import *
from oscar import OSCAR_MAIN_TEMPLATE_DIR
from oscar import get_core_apps
import os

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
PROJECT_DIR = os.path.dirname(__file__)
location = lambda x: os.path.join(
    os.path.dirname(os.path.realpath(__file__)), x)

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/

# 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',
    'django.contrib.sites',
    'django.contrib.flatpages',
    'NGO',
    'compressor',
    'widget_tweaks',

] + get_core_apps()

MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'django.middleware.security.SecurityMiddleware',
    'oscar.apps.basket.middleware.BasketMiddleware',
    'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
)

AUTHENTICATION_BACKENDS = (
    'oscar.apps.customer.auth_backends.EmailBackend',
    'django.contrib.auth.backends.ModelBackend',
)

HAYSTACK_CONNECTIONS = {
    'default': {
        'ENGINE': 'haystack.backends.simple_backend.SimpleEngine',
    },
}

OSCAR_INITIAL_ORDER_STATUS = 'Pending'
OSCAR_INITIAL_LINE_STATUS = 'Pending'
OSCAR_ORDER_STATUS_PIPELINE = {
    'Pending': ('Being processed', 'Cancelled',),
    'Being processed': ('Processed', 'Cancelled',),
    'Cancelled': (),
}

ROOT_URLCONF = 'codeshastra.urls'

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

                'oscar.apps.search.context_processors.search_form',
                'oscar.apps.promotions.context_processors.promotions',
                'oscar.apps.checkout.context_processors.checkout',
                'oscar.apps.customer.notifications.context_processors.notifications',
                'oscar.core.context_processors.metadata',
            ],
        },
    },
]

WSGI_APPLICATION = 'codeshastra.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'),
    }
}


# Internationalization
# https://docs.djangoproject.com/en/1.8/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'Asia/Kolkata'

USE_I18N = True

USE_L10N = True

USE_TZ = True

SITE_ID = 1
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.8/howto/static-files/

STATIC_URL = '/static/'
STATIC_ROOT = location('public/static')
url.py

from django.conf.urls import include, url
from django.contrib import admin
from NGO import views 
from oscar.app import application

urlpatterns = [
url(r'^admin/', include(admin.site.urls)),

url(r'^$', views.testview),
url(r'^allschools/$', views.allSchools, name = 'allSchools'), 
url(r'^98761234([A-z]+)/$', views.studentsOfSchool, name = 'studentsOfSchool'),
url(r'^incrementdayspresent/(\d+)/98761234([A-z]+)/$', views.incrementDaysPresent),
url(r'^incrementtotaldays/(\d+)/98761234([A-z]+)/$', views.incrementTotalDays),
url(r'^addnewschool/$', views.addNewSchool, name = "addnewschool"),
url(r'^addnewstudent/$', views.addNewStudent, name = "addnewstudent"),
url(r'^searchstudent/$', views.searchStudent, name = "searchStudent"),
url(r'^searchSchool/$', views.searchSchool, name = "searchSchool"),
url(r'^average(\d+)/$', views.marksheet, name = "marksheet"),
url(r'^addmarks/(\d+)/$', views.addMarks, name = "addMarks"),
url(r'^98761234[A-z]+/(\d+)/$', views.StudentProfile, name ="Profile"),
url (r'^accounts/login/$', views.loginUser, name = "Auth"),

url(r'^i18n/', include('django.conf.urls.i18n')),
url(r'', include(application.urls)),

]

现在,如果我访问“/allschools/”或任何其他URL,我所能看到的只是一个空白页面,页面标题为奥斯卡。有人知道为什么会这样吗?

你的模板结构是什么?您是否正在扩展
oscar
模板?i、 e.base.html和layout.html(来自oscar)。@kaveh的观察应该得到考虑,因为您仍然在调试模式下运行,所以您应该将静态文件URL包括在urlconf
urlpatterns=[…]+static中(settings.STATIC\u URL,document\u root=settings.STATIC\u root)
@kaveh no我没有从oscar扩展base.html。@MosesKoledoye附加STATIC(settings.STATIC\u URL,document\u root=settings.STATIC\u root)tp my urlpatterns给我一个错误“名称‘STATIC’未定义”@在调试模式下,大多数用户可以使用
staticfiles
contrib应用程序补丁
runserver
,为静态文件提供服务。如果使用
staticfiles
,则媒体文件只需
+static()