Django Oscar Dashboard link not accessible - django

I have developed oscar /django applications before but I am completely stumped by this issue:
I can see the dashboard url in the supported urls list but I am not able to access it.
404 Page
I have forked a few apps from oscar like voucher, shipping, checkout, reviews and customized them in various ways(None of these are dashboard related) . This is my INSTALLED_APPS:
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',
'oscar.config.Shop',
'oscar.apps.analytics.apps.AnalyticsConfig',
'iirns.checkout.apps.CheckoutConfig',
'oscar.apps.address.apps.AddressConfig',
'iirns.shipping.apps.ShippingConfig',
'oscar.apps.catalogue.apps.CatalogueConfig',
'iirns.catalogue.reviews.apps.CatalogueReviewsConfig',
'oscar.apps.communication.apps.CommunicationConfig',
'oscar.apps.partner.apps.PartnerConfig',
'oscar.apps.basket.apps.BasketConfig',
'iirns.payment.apps.PaymentConfig',
'oscar.apps.offer.apps.OfferConfig',
'oscar.apps.order.apps.OrderConfig',
'oscar.apps.customer.apps.CustomerConfig',
'oscar.apps.search.apps.SearchConfig',
'iirns.voucher.apps.VoucherConfig',
'oscar.apps.wishlists.apps.WishlistsConfig',
'oscar.apps.dashboard.apps.DashboardConfig',
'oscar.apps.dashboard.reports.apps.ReportsDashboardConfig',
'oscar.apps.dashboard.users.apps.UsersDashboardConfig',
'oscar.apps.dashboard.orders.apps.OrdersDashboardConfig',
'oscar.apps.dashboard.catalogue.apps.CatalogueDashboardConfig',
'oscar.apps.dashboard.offers.apps.OffersDashboardConfig',
'oscar.apps.dashboard.partners.apps.PartnersDashboardConfig',
'oscar.apps.dashboard.pages.apps.PagesDashboardConfig',
'oscar.apps.dashboard.ranges.apps.RangesDashboardConfig',
'oscar.apps.dashboard.reviews.apps.ReviewsDashboardConfig',
'oscar.apps.dashboard.vouchers.apps.VouchersDashboardConfig',
'oscar.apps.dashboard.communications.apps.CommunicationsDashboardConfig',
'oscar.apps.dashboard.shipping.apps.ShippingDashboardConfig',
# 3rd-party apps that oscar depends on
'widget_tweaks',
'haystack',
'treebeard',
'sorl.thumbnail',
'django_tables2',
'mailer',
'extra',
]
and this is my root url file:
from django.conf.urls import url
from django.contrib import admin
from django.apps import apps
from django.urls import include, path
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path('admin/', admin.site.urls),
path('',include('extra.urls')),
path('', include(apps.get_app_config('oscar').urls[0])),
]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

Related

DoesNotExist at /admin/

DoesNotExist at /admin/
URL matching query does not exist.
I copy code form old study-project and i haven't similar problem in old project.
settings.py INSTALLED_APPS:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'cutter',
]
admin.py:
from .models import URL
from django.contrib import admin
admin.site.register(URL)
urls.py:
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('', include('cutter.urls')),
path('admin/', admin.site.urls),
]
All another functions work.

Django doesn't take Custom password_reset_form.html

I used a Custom password_reset_form.html
(My Path: /templates/registration/password_reset_form.html)
But Django takes the Django-Default-Password-Reset-View
Any solution what i could do?
urls.py
from django.contrib.auth import views as auth_views
from django.contrib.auth.forms import AuthenticationForm
from django.template import RequestContext
from django.urls import include, path, re_path
from myapp.CustomForms.appforms import LoginAuthenticationForm
from django.contrib.auth.views import LogoutView
from django.contrib import admin
from django.urls import path, include
from django.conf.urls import url
from myapp.views import (
...
)
from . import views
urlpatterns = [
...
url(r"^$", views.startseite, name="home"),
url(r"^signup/$", views.signup, name="signup"),
url(
r"^activate/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z].
{1,13}-[0-9A-Za-z]{1,20})/",
views.activate, name="activate",),
url('^', include('django.contrib.auth.urls')),
]
settings.py
INSTALLED_APPS = [
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'django.contrib.auth',
'myapp',
]
...
The reason why django didn't pick up my custom template cause i have to change the order of my
INSTALLED_APPS = [
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'myapp',
'django.contrib.admin',
'django.contrib.auth',
]
myapp has to set before django.contrib.admin and django.contrib.auth

ModuleNotFoundError: No module named 'polls'

I am following the official Django tutorial on https://docs.djangoproject.com/en/2.2/intro/tutorial01/ but somehow I am not able to run the server as I have created the polls app and added the required urls. When I use the command "py mysite\manage.py runserver" it returns me ModuleNotFoundError: No module named 'polls' error.
Project Folder available at
https://i.stack.imgur.com/bbxfW.png
#views.py
from django.http import HttpResponse
def index(request):
return HttpResponse('<h1><this is a test page</h1>')
#urls.py in polls
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
]
#urls.py in mysite\mysite
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path('polls/', include('polls.urls')),
path('admin/', admin.site.urls),
]
#settings.py
INSTALLED_APPS = [
'polls',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
[1]: https://i.stack.imgur.com/bbxfW.png
Well, I resolved it myself. Polls module was not found because it was created outside the project directory. When I removed it and recreated inside the project directory, it was OK now.
also it may be a good idea to cd into yoru django project so you are only running
python manage.py runserver

Django-Jet "Page Not Found"

I am attempting to install the Django Jet dashboard, but I'm unable to get anywhere with it.
I've followed the installation instructions, but no matter what I'm getting "Page Not Found" despite the URLs for Jet being listed.
There are a handful of Issues opened on this, but none offer a solution outside that it was resolved in newer versions, and I am using the recommended commit (latest).
Issues:
https://github.com/geex-arts/django-jet/issues/289
https://github.com/geex-arts/django-jet/issues/62
Urls.py:
from django.contrib import admin
from django.urls import path, include, re_path
from depot import views
urlpatterns = [
path('', include('depot.urls')),
path('', include('stores.urls')),
path('admin/', admin.site.urls),
re_path(r'^jet/', include(('jet.urls', 'jet'))),
re_path(r'^jet/dashboard/', include(('jet.dashboard.urls', 'jet-dashboard'))),
]
I have no custom overriding admin templates. I have tried just visiting /admin/, but my admin looks like the default Django Admin (someone mentioned its supposed to take over the original admin templates).
Installed Apps:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'depot',
'stores',
'jet',
'jet.dashboard',
]
I have also verified I have django.template.context_processors.request under Templates in my settings.py as well.
This is a super important note I missed. Simply moved django.contrib.admin to the bottom of my INSTALLED_APPS and this resolved this issue.
INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'depot',
'stores',
'jet',
'jet.dashboard',
'django.contrib.admin',
]

404 after attempting to implement Django(1.5.4) Sitemaps

I've gone through the process, which is seemingly fairly straightforward of setting up an sitemap.xml file..
I'm getting 404 page when I go to www.example.com/sitemap.xml 'page not found' and a message (I've still got debug settings turned on..) along the lines of:
" Django tried these URL patterns, in this order:
^admin/
^nday/
^ ^$ [name='index']
^ ^tomorrow/$ [name='tomorrow']
^ ^day/(?P<day_name_url>\w+)/$ [name='day']
The current URL, sitemap.xml, didn't match any of these."
This is my urls.py file
from django.conf.urls import patterns, url
from django.contrib.sitemaps.views import sitemap
from nday import views
from nday import sitemap
from nday.sitemap import ndaySitemap
sitemaps = {
'posts': ndaySitemap,
}
urlpatterns = patterns('',
url(r'^$', views.index, name='index'),
url(r'^tomorrow/$', views.tomorrow, name='tomorrow'),
url(r'^day/(?P<day_name_url>\w+)/$', views.day, name='day'),
url(r'^sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps}),)
and my sitemap.py file..
from django.contrib.sitemaps import Sitemap
from nday import models
from nday.models import nationalday
class ndaySitemap(Sitemap):
changefreq = "daily"
priority = 0.5
def items(self):
return nationalday.objects.all()
I've installed sitemaps as per the settings.py file..
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.sitemaps',
'nday',
)
Thank you so much in advance
If you are using the Django development server, it should reload when you make any code changes.
However in production (e.g. Apache or Nginx) you have to reload the server after making any changes to .py files.