-3

error while add new record in admin panel it say :

 The current path, blog_app/android/add/, didn't match any of these.

i use namecheap hosting how to fix this

enter image description here

enter image description here

when i add new record and press save it show this error ...

Kok Hyvv
  • 145
  • 1
  • 9

1 Answers1

0

The problem is with the image field. The solution that I am going to present here is not from me but it was posted by some other user on stack overflow here https://stackoverflow.com/a/63535409/8868448

The Solution: Add this code to passenger_wsgi.py file and change project_name at line 4:

import os
import sys
sys.path.append(os.getcwd())
os.environ['DJANGO_SETTINGS_MODULE'] = 'project_name.settings'
import django.core.handlers.wsgi
from django.core.wsgi import get_wsgi_application
SCRIPT_NAME = os.getcwd()
class PassengerPathInfoFix(object):
    def __init__(self, app):
        self.app = app
    def __call__(self, environ, start_response):
        from urllib.parse import unquote
        environ['SCRIPT_NAME'] = SCRIPT_NAME
        request_uri = unquote(environ['REQUEST_URI'])
        script_name = unquote(environ.get('SCRIPT_NAME', ''))
        offset = request_uri.startswith(script_name) and len(environ['SCRIPT_NAME']) or 0
        environ['PATH_INFO'] = request_uri[offset:].split('?', 1)[0]
        return self.app(environ, start_response)
application = get_wsgi_application()
application = PassengerPathInfoFix(application)
Umer
  • 566
  • 6
  • 13