Hey i have been working on this project for a while but i ran into a problem and i am currently stuck…
I have already looked at all the possible solutions that other people have used to eliminate this problem, but unfortunately I have not been able to solve my problem.
This is what my apps/views.py looks like:
from django.views.generic import TemplateView
class AppsView(TemplateView):
pass
# DTF
apps_dtf_view = AppsView.as_view(
template_name="apps/apps-apps-dtf.html"
)
# LAGER
apps_lager_anlieferung_dashboard_view = AppsView.as_view(
template_name="apps/lager/anlieferung-dashboard.html"
)
apps_lager_anlieferung_annahme_view = AppsView.as_view(
template_name="apps/lager/anlieferung-annahme.html"
)
apps_lager_freier_wareneingang_view = AppsView.as_view(
template_name="apps/lager/freier-wareneingang.html"
)
apps_lager_freier_wareneingang_dashboard_view = AppsView.as_view(
template_name="apps/lager/freier-wareneingang-dashboard.html"
)
apps_lager_freier_wareneingang_ausbuchen_view = AppsView.as_view(
template_name="apps/lager/freier-wareneingang-ausbuchen.html"
)
# PICKPACK
apps_pickpack_box_buchen_view = AppsView.as_view(
template_name="apps/pickpack/box-buchen.html"
)
apps_pickpack_item_in_box_view = AppsView.as_view(
template_name="apps/pickpack/item-in-box.html"
)
apps_pickpack_sammler_view = AppsView.as_view(
template_name="apps/pickpack/sammler.html"
)
apps_pickpack_sammler_versendete_view = AppsView.as_view(
template_name="apps/pickpack/sammler-versendete.html"
)
apps_pickpack_einzeljob_versandfertig_view = AppsView.as_view(
template_name="apps/pickpack/einzeljob_versandfertig.html"
)
apps_pickpack_status_resetten_view = AppsView.as_view(
template_name="apps/pickpack/status-resetten.html"
)
apps_pickpack_statistiken_view = AppsView.as_view(
template_name="apps/pickpack/statistiken.html"
)
apps_pickpack_regal_uebersicht_view = AppsView.as_view(
template_name="apps/pickpack/regal-uebersicht.html"
)
# VERSAND
apps_versand_view = AppsView.as_view(
template_name="apps/apps-apps-versand.html"
)
# QUALI
apps_quali_substep_fertigstellen_view = AppsView.as_view(
template_name="apps/quali/substep-fertigstellen.html"
)
apps_quali_item_try_erhoehen_view = AppsView.as_view(
template_name="apps/quali/item-try-erhoehen.html"
)
my apps/urls.py:
from django.urls import path
from .views import (
apps_dtf_view,
apps_lager_anlieferung_dashboard_view,
apps_lager_anlieferung_annahme_view,
apps_lager_freier_wareneingang_view,
apps_lager_freier_wareneingang_dashboard_view,
apps_lager_freier_wareneingang_ausbuchen_view,
apps_pickpack_box_buchen_view,
apps_pickpack_item_in_box_view,
apps_pickpack_sammler_view,
apps_pickpack_sammler_versendete_view,
apps_pickpack_einzeljob_versandfertig_view,
apps_pickpack_status_resetten_view,
apps_pickpack_statistiken_view,
apps_pickpack_regal_uebersicht_view,
apps_versand_view,
apps_quali_substep_fertigstellen_view,
apps_quali_item_try_erhoehen_view,
)
app_name = "apps"
urlpatterns = [
# DTF
path(
"dtf",
view=apps_dtf_view,
name="dtf"
),
# LAGER
path(
"lager/anlieferung-dashboard",
view=apps_lager_anlieferung_dashboard_view,
name="lager.anlieferung_dashboard"
),
path(
"lager/anlieferung-annahme",
view=apps_lager_anlieferung_annahme_view,
name="lager.anlieferung_annahme"
),
path(
"lager/freier-wareneingang",
view=apps_lager_freier_wareneingang_view,
name="lager.freier_wareneingang"
),
path(
"lager/freier-wareneingang-dashboard",
view=apps_lager_freier_wareneingang_dashboard_view,
name="lager.freier_wareneingang_dashboard"
),
path(
"lager/freier-wareneingang-ausbuchen",
view=apps_lager_freier_wareneingang_ausbuchen_view,
name="lager.freier_wareneingang_ausbuchen"
),
# PICKPACK
path(
"pickpack/box-buchen",
view=apps_pickpack_box_buchen_view,
name="pickpack.box_buchenn"
),
path(
"pickpack/item-in-box",
view=apps_pickpack_item_in_box_view,
name="pickpack.item_in_box"
),
path(
"pickpack/sammler",
view=apps_pickpack_sammler_view,
name="pickpack.sammler"
),
path(
"pickpack/sammler-versendete",
view=apps_pickpack_sammler_versendete_view,
name="pickpack.sammler_versendete"
),
path(
"pickpack/einzeljob-versandfertig",
view=apps_pickpack_einzeljob_versandfertig_view,
name="pickpack.einzeljob_versandfertig"
),
path(
"pickpack/status-resetten",
view=apps_pickpack_status_resetten_view,
name="pickpack.status_resetten"
),
path(
"pickpack/statistiken",
view=apps_pickpack_statistiken_view,
name="pickpack.statistiken"
),
path(
"pickpack/regal-uebersicht",
view=apps_pickpack_regal_uebersicht_view,
name="pickpack.regal_uebersicht"
),
# VERSAND
path(
"versand",
view=apps_versand_view,
name="varsand"
),
# QUALI
path(
"quali/substep-fertigstellen",
view=apps_quali_substep_fertigstellen_view,
name="quali.substep_fertigstellen_view"
),
path(
"quali/item-try-erhoehen",
view=apps_quali_item_try_erhoehen_view,
name="quali.item_try_erhoehen"
),
]
main/settings.py:
"""
Django settings for main project.
Generated by 'django-admin startproject' using Django 4.1.5.
For more information on this file, see
https://docs.djangoproject.com/en/4.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.1/ref/settings/
"""
import os
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-4+h=x+oz8d=d$6f%3mwenx&z0p8r^4piz_c^d7g-4ue-8@1pcb'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['*']
# Application definition
DEFAULT_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'main'
]
LOCAL_APPS = [
"apps",
# "system",
# "t_z",
]
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',
]
INSTALLED_APPS = DEFAULT_APPS + LOCAL_APPS
ROOT_URLCONF = 'main.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(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 = 'main.wsgi.application'
# Database
# https://docs.djangoproject.com/en/4.1/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
# Password validation
# https://docs.djangoproject.com/en/4.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',
},
]
# Internationalization
# https://docs.djangoproject.com/en/4.1/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.1/howto/static-files/
STATIC_URL = 'static/'
# Default primary key field type
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
my main/urls.py:
from django.contrib import admin
from django.urls import path, include
import views
urlpatterns = [
path('admin/', admin.site.urls),
path("", views.DashboardView.as_view(), name="dashboard"),
# APPS
path("apps/", include("apps.urls")),
# # SYSTEM
# path("system/", include("system.urls")),
# # T/Z
# path("t_z/", include("t_z.urls")),
]
main/views.py (just for my Dashboard):
from django.shortcuts import render
from django.views import View
from django.contrib.auth.mixins import LoginRequiredMixin
# Dashboard
class DashboardView(LoginRequiredMixin, View):
def get(self, request):
return render(request, "dashboard.html")
main/wsgi.py:
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'main.settings')
application = get_wsgi_application()
and main/asgi.py:
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'main.settings')
application = get_asgi_application()
I assume that the problem is here, but if you need anything else, please write
If anyone knows/sees the problem, I’d appreciate an explanation and solution to my problem, thanks in advance!