You can use re_path
instead of path
for use regular expression in your url pattern. use ?
sign in your url like this:
from django.urls import re_pathre_path(r'url/?$', views.appmain, name="main")
Note: question mark matches zero or one /
in the url. it accepts both domain.com/url
and domain.com/url/