'TemplateDoesNotExist' can't get the solution - django

I am starting in Django, but I am stuck with this problem
I have this structure in my VSCode Workspace
-Project1
__pycache__
__init__.py
asgi.py
settings.py
urls.py
views.py
wsgi.py
-templates
mytemplate.html
db.sqlite3
manage.py
I am trying to use a template that I built
urls.py
from Project1.views import salute
urlpatterns = [
path('admin/', admin.site.urls),
path('salute/', salute),
]
views.py
from django.template.loader import get_template
from django.shortcuts import render
class Persona(object):
def __init__(self, nombre, apellido):
self.nombre = nombre
self.apellido = apellido
def salute(request):
p1=Persona('Peter', 'Parker')
temas_del_curso = ['Plantillas', 'Modelos', 'Formularios', 'Vistas', 'Despliegue']
fecha_de_hoy = datetime.datetime.now()
return render(request, 'miplantilla.html', { 'nombre_persona' : p1.nombre, 'apellido_persona' : p1.apellido, 'fecha_de_hoy' : fecha_de_hoy, 'temas' : temas_del_curso })
They suggest I copy the directory path where my template is saved
settings.py
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ['C:/Users/machine/Desktop/Django/Project1/templates'],
'APP_DIRS': True,
}
Also use the form Django suggests 'DIRS': BASE_DIR / 'templates' and the form [os.path.join (BASE_DIR, 'templates')] but the error continues

This is standard settings.py for full project.
Since I can't see your full source code, I can't solve out issue directly.
Take a reference from it.
import os
from decouple import config
from unipath import Path
import dj_database_url
BASE_DIR = Path(__file__).parent
CORE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = config('SECRET_KEY', default='S#perS3crEt_1122')
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = config('DEBUG', default=True, cast=bool)
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
# load production server from .env
ALLOWED_HOSTS = ['localhost', 'ec2-3-133-208-9.us-east-2.compute.amazonaws.com','www.spreadmore.space','spreadmore.space', config('SERVER', default='127.0.0.1')]
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django_plotly_dash.apps.DjangoPlotlyDashConfig',
'app',
'authentication',
'rest_framework',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'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',
'django_plotly_dash.middleware.BaseMiddleware',
'django_plotly_dash.middleware.ExternalRedirectionMiddleware',
]
ROOT_URLCONF = 'core.urls'
LOGIN_REDIRECT_URL = "home" # Route defined in app/urls.py
LOGOUT_REDIRECT_URL = "home" # Route defined in app/urls.py
TEMPLATE_DIR = "E:/Python/ocm_project/app/templates" # ROOT dir for templates
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [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',
],
},
},
]
WSGI_APPLICATION = 'core.wsgi.application'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME' : 'E:/Python/ocm_project/db.sqlite3',
}
}
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',
},
]
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# custom settings
AUTH_USER_MODEL = "authentication.User"
X_FRAME_OPTIONS = 'SAMEORIGIN'
STATICFILES_FINDERS = [
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'django_plotly_dash.finders.DashAssetFinder',
'django_plotly_dash.finders.DashComponentFinder',
'django_plotly_dash.finders.DashAppDirectoryFinder',
]
# Plotly components containing static content that should
# be handled by the Django staticfiles infrastructure
PLOTLY_COMPONENTS = [
'dash_core_components',
'dash_html_components',
'dash_bootstrap_components',
'dash_renderer',
'dpd_components',
'dpd_static_support',
]
MEDIA_URL = 'app/ocm_data/TW/SPX/'
MEDIA_ROOT = "E:/Python/ocm_project/app/ocm_data/TW/SPX/"

Related

Django blog page, admin page stopped working

I try to code a blog with Django and it worked pretty well until I couldn't open the admin page anymore: 127.0.0.1:8000/admin/.
I created a superuser I could login to the admin page but then I changed something else but I can't say what. The blog with the database and my personal was working except the admin page. Do you have any idea why that happened? Appreciate any help.
The following image shows the failure message:
Here is my code:
settings.py
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'xxx'
# 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',
'blog',
'ckeditor',
'ckeditor_uploader',
'taggit',
'django.contrib.sites',
'django.contrib.sitemaps',
]
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 = 'thomkell.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [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 = 'thomkell.wsgi.application'
# Database
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
# Password validation
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',
},
]
# Internationalization
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
STATIC_URL = 'static/'
#this code
STATICFILES_DIRS = [
BASE_DIR / "static",
]
# Default primary key field type
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
MEDIA_URL = "/media/"
MEDIA_ROOT = BASE_DIR / "media/"
#ckeditor upload path
CKEDITOR_UPLOAD_PATH="uploads/"
CKEDITOR_CONFIGS = { ...
}
urls.py
from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('blog.urls', namespace='blog')),
path('ckeditor/',include('ckeditor_uploader.urls')),
]+static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Looks like you've installed the Django sites framework with django.contrib.sites in your installed apps but you probably haven't set everything else up that is needed. If you put SITE_ID=1 in your settings.py, I expect your page will load - at the moment it isn't receiving anything at all - but you should read through the rest of the framework docs:
https://docs.djangoproject.com/en/4.0/ref/contrib/sites/

How can I solve the error "page not found(404)" in my 1st django project?

I'm very new to django and I stuck in my first project
the error says Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8000/about
using the URLconf defined in emuhay.urls, Django tried these URL patterns, in this order:
admin/
The current path, about, didn't match any of these.
You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.
I'm expecting "Contat page" but page not found displayed every time
my code is below
#Url code
from django.contrib import admin
from django.urls import path
from django.http import HttpResponse
def home(request):
return HttpResponse('Home Page')
def contact(request):
return HttpResponse('Contact Page')
urlpatterns = [
path('admin/', admin.site.urls),
path('',home),
path('about/',contact),
]
#setting.py
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'yra+iwr3x_)#ssxj)e%h^7=m(te0mh!_4xx61g7j2j4y)o9z&$'
# 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',
'hihi',
]
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 = 'emuhay.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'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 = 'emuhay.wsgi.application'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
# Password validation
# https://docs.djangoproject.com/en/3.1/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',
},
]
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
STATIC_URL = '/static/'
This part of the official docs would be helpful
Try this in your urls.py
urlpatterns = [
path('admin/', admin.site.urls),
path('', home, name='home'),
path('about/', contact, name='contact'),
]

Getting the except django.core.exceptions.ImproperlyConfigured while querying DB

I am trying to fetch a few rows from the DB using the following code in my views.py:
from django.http import HttpResponse
from django.shortcuts import render
from fusioncharts.models import QRC_DB
def display_data(request,component):
query_results = QRC_DB.objects.get(component_name__contains=component)
return HttpResponse("You're looking at the component %s." % component)
For the above, I am getting the following exception:
django.core.exceptions.ImproperlyConfigured: The included URLconf 'Piechart_Excel.urls' does not appear to have any patterns in it. If you see valid patterns in the file then the issue is probably caused by a circular import.
However whenever I am removing/commenting out the below line, the above exception disappears:
query_results = QRC_DB.objects.get(component_name__contains=component)
The 2 urls files are as follows:
urls.py under the app directory
from django.urls import path
from fusioncharts import views
urlpatterns = [
path('push-data/', views.push_data, name='push-data'),
path('home/', views.home, name='home'),
path('display_data/<str:component>', views.display_data, name='display_data'),
]
and urls.py under the main project directory
from django.contrib import admin
from django.urls import path,include
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('fusioncharts.urls'))
]
Edit:
Settings.py file is as follows:
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/3.0/howto/deployment/checklist/
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'fusioncharts',
]
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 = 'Piechart_Excel.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates'),
os.path.join(BASE_DIR, 'fusioncharts', 'templates', 'fusioncharts'),],
'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 = 'Piechart_Excel.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'QRC_Report_First_Project',
'USER':'xxxx',
'PASSWORD':'xxxx',
'HOST':'localhost',
'PORT':'3306'
}
}
# Password validation
# https://docs.djangoproject.com/en/3.0/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',
},
]
# Internationalization
# https://docs.djangoproject.com/en/3.0/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/3.0/howto/static-files/
STATIC_URL = '/static/'
Can anyone say what's going wrong? How come just one line of code which queries the DB is causing the above exception?

django.core.exceptions.ImproperlyConfigured: WSGI application 'netfacer.wsgi.application' could not be loaded; Error importing module

I am just a beginner in django . I tried to create sub-domain by following this link. When I run my project it shows the following error
django.core.exceptions.ImproperlyConfigured: WSGI application
'netfacer.wsgi.application' could not be loaded; Error importing
module.
my settings.py
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = 'dhxz$csco35cti*^kjru_lum-j*e&$el0rw^!$y0sc_$q8qi-x'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['*']
# Application definition
INSTALLED_APPS = [
'django_hosts',
'subdomains',
'administrator.apps.AdministratorConfig',
'vendoruser.apps.VendoruserConfig',
'management.apps.ManagementConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
MIDDLEWARE = [
'django_hosts.middleware.HostsRequestMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'subdomains.middleware.SubdomainURLRoutingMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django_hosts.middleware.HostsResponseMiddleware',
]
SUBDOMAIN_URLCONF = {
'vendor':'netfacer.urls.vendor'
}
ROOT_URLCONF = 'netfacer.urls'
ROOT_HOSTCONF = 'netfacer.hosts'
DEFAULT_HOST = 'www'
DEFAULT_REDIRECT_URL = "http://www.netfacer.com:8000"
CUSTOM_URL = "netfacer.com:8000"
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.media',
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'netfacer.wsgi.application'
DATABASES = {
'default':{
'ENGINE' : 'django.db.backends.postgresql_psycopg2',
'NAME' : 'alpha',
'USER' : 'alpha',
'PASSWORD' : 'alpha',
'HOST' : 'localhost',
'PORT': ''
}
}
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',
},
]
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static"),
# '/assets/licences/your/images/outside/web/tree/'
]
ENV_PATH = os.path.abspath(os.path.dirname(__file__))
MEDIA_URL = '/assets/'
# MEDIA_URL = '/assets/'
MEDIA_ROOT = os.path.join(ENV_PATH, 'assets/')
# STATIC_ROOT = (os.path.join(BASE_DIR, 'static')
# MEDIA_ROOT = os.path.join(BASE_DIR, 'uploads')
# MEDIA_URL = '/uploads/'
hosts.py
host_patterns = patterns('',
host(r'www', settings.ROOT_URLCONF, name='www'),
host(r'(?!www).*', 'netfacer.hostsconf.urls', name='wildcard'),
host(r'vendor', 'netfacer.hostsconf.urls', name="vendor")
)
also the documentation in the above link is confusing me
Typically you have to set WSGI_APPLICATION variable in your settings module, according to codenetfacer.wsgi.application, package that contain wsgi.py is named netfacer. There may be next issues:
There is not package with name netfacer - check if you have renamed settings package
netfacer package is located in your <project_root> directory, check if <project_root> directory is part of PYTHONPATH environment variable
Add to your settings.py
MIDDLEWARE=[
'whitenoise.middleware.WhiteNoiseMiddleware',
]
wsgi.py
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'your-project-Name.settings')
application = get_wsgi_application()
Ensure your wsgi.py does not fall short of the above configuration
check and Remove
from whitenoise.django import DjangoWhiteNoise
application = DjangoWhiteNoise(application)

Project Urls got overridden after installing Oscar

So I've been working on a project and I need 2 apps for it. I've made one of them from scratch and I am using Oscar(an e-commerce app). I have both the Apps in my Installed_Apps. But after installing oscar, I'm unable to visit the urls of my other app.
settings.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')
urls.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)),
]
Now, if I visit the "/allschools/" or any of the other urls all I can see is a blank page with Oscar as the page title. Does anyone know why this is happening?