'django admin 403 page display error. Unable to find return page when data is inserted
when I add or delete data in the admin, I get 404 not found error. I am using windows server.
urls.py:
from django.contrib import admin
from django.urls import path, include
from django.conf.urls.static import static
from django.conf import settings
from django.contrib.sitemaps.views import sitemap
from home.sitemap import StaticViewSitemap
sitemaps = {
'static':StaticViewSitemap
}
urlpatterns = [
path('admin/', admin.site.urls),
path('', include("home.urls"), name="anasayfa"),
path('sitemap.xml', sitemap, {"sitemaps":sitemaps}, name="sitemaps")
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Home urls.py:
from django.contrib import admin
from django.urls import path
from django.views.generic import TemplateView
from . import views
app_name = "home"
urlpatterns = [
path(r'', views.index, name="anasayfa")
path(r'galeri', views.galeri, name="galeri"),
]
models.py
from django.db import models
class Galeri(models.Model):
baslik = models.CharField(max_length=255,null=True,blank=True, verbose_name="Başlık")
resim = models.ImageField(blank=True, null=True, verbose_name="Fotoğraf Ekle")
class Video(models.Model):
baslik = models.CharField(max_length=255, null=True, blank=True, verbose_name="Başlık")
video = models.FileField(upload_to="video", blank=True, null=True)
settings.py:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
"home",
'django.contrib.sitemaps'
]
The project was working fine in localhost, but I have such a problem when I upload it to my domain address. The pages of the site are working fine, but there is only this problem in the admin panel.
I'm sorry for my bad english. Thanks in advance for your help
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

