使用 django 导入名称模式问题
import name patterns issue with django
挖掘后我无法理解我们的服务器发生了什么。我在加载网络时遇到此错误。
一切正常,任何人都可以触摸任何东西。因为这个错误,我已经更改了 application.txt 的所有权。
[Wed Dec 16 04:38:12.059839 2020] [wsgi:error] [pid 12343:tid 140072894818048] [remote xx.xx.xxx.xx:xxxxx] ValueError: 无法配置处理程序 'file': [ Errno 13] 权限被拒绝:'/opt/yhmp-app/YHMP/eamena/logs/application.txt'
在此之后它在浏览器中显示下一个错误:
所有这些都来自 error.log 尝试访问时:
ed Dec 16 13:05:46.856703 2020] [authz_core:debug] [pid 14049:tid 140483607127808] mod_authz_core.c(809): [client] AH01626: authorization result of Require all granted: granted
[Wed Dec 16 13:05:46.856746 2020] [authz_core:debug] [pid 14049:tid 140483607127808] mod_authz_core.c(809): [client ] AH01626: authorization result of <RequireAny>: granted
[Wed Dec 16 13:05:46.856782 2020] [authz_core:debug] [pid 14049:tid 140483607127808] mod_authz_core.c(809): [client :56384] AH01626: authorization result of Require all granted: granted
[Wed Dec 16 13:05:46.856787 2020] [authz_core:debug] [pid 14049:tid 140483607127808] mod_authz_core.c(809): [client :56384] AH01626: authorization result of <RequireAny>: granted
[Wed Dec 16 07:05:46.857793 2020] [wsgi:error] [pid 14047:tid 140483690739456] Internal Server Error: /
[Wed Dec 16 07:05:46.857809 2020] [wsgi:error] [pid 14047:tid 140483690739456] Traceback (most recent call last):
[Wed Dec 16 07:05:46.857814 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/core/handlers/exception.py", line 41, in inner
[Wed Dec 16 07:05:46.857817 2020] [wsgi:error] [pid 14047:tid 140483690739456] response = get_response(request)
[Wed Dec 16 07:05:46.857821 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/core/handlers/base.py", line 244, in _legacy_get_response
[Wed Dec 16 07:05:46.857824 2020] [wsgi:error] [pid 14047:tid 140483690739456] response = middleware_method(request)
[Wed Dec 16 07:05:46.857828 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/middleware/locale.py", line 24, in process_request
[Wed Dec 16 07:05:46.857831 2020] [wsgi:error] [pid 14047:tid 140483690739456] i18n_patterns_used, prefixed_default_language = is_language_prefix_patterns_used(urlconf)
[Wed Dec 16 07:05:46.857834 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/utils/lru_cache.py", line 100, in wrapper
[Wed Dec 16 07:05:46.857838 2020] [wsgi:error] [pid 14047:tid 140483690739456] result = user_function(*args, **kwds)
[Wed Dec 16 07:05:46.857841 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/conf/urls/i18n.py", line 29, in is_language_prefix_patterns_used
[Wed Dec 16 07:05:46.857844 2020] [wsgi:error] [pid 14047:tid 140483690739456] for url_pattern in get_resolver(urlconf).url_patterns:
[Wed Dec 16 07:05:46.857847 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
[Wed Dec 16 07:05:46.857857 2020] [wsgi:error] [pid 14047:tid 140483690739456] res = instance.__dict__[self.name] = self.func(instance)
[Wed Dec 16 07:05:46.857861 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/urls/resolvers.py", line 407, in url_patterns
[Wed Dec 16 07:05:46.857865 2020] [wsgi:error] [pid 14047:tid 140483690739456] patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
[Wed Dec 16 07:05:46.857868 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
[Wed Dec 16 07:05:46.857871 2020] [wsgi:error] [pid 14047:tid 140483690739456] res = instance.__dict__[self.name] = self.func(instance)
[Wed Dec 16 07:05:46.857874 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/urls/resolvers.py", line 400, in urlconf_module
[Wed Dec 16 07:05:46.857877 2020] [wsgi:error] [pid 14047:tid 140483690739456] return import_module(self.urlconf_name)
[Wed Dec 16 07:05:46.857880 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
[Wed Dec 16 07:05:46.857883 2020] [wsgi:error] [pid 14047:tid 140483690739456] __import__(name)
[Wed Dec 16 07:05:46.857886 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/YHMP/eamena/urls.py", line 19, in <module>
[Wed Dec 16 07:05:46.857889 2020] [wsgi:error] [pid 14047:tid 140483690739456] from arches import urls as arches_urls
[Wed Dec 16 07:05:46.857892 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/arches/urls.py", line 20, in <module>
[Wed Dec 16 07:05:46.857895 2020] [wsgi:error] [pid 14047:tid 140483690739456] from django.conf.urls import patterns, include, url
[Wed Dec 16 07:05:46.857898 2020] [wsgi:error] [pid 14047:tid 140483690739456] ImportError: cannot import name patterns
[Wed Dec 16 07:05:46.928281 2020] [wsgi:error] [pid 14047:tid 140483690739456] Internal Server Error: /
[Wed Dec 16 07:05:46.928306 2020] [wsgi:error] [pid 14047:tid 140483690739456] Traceback (most recent call last):
[Wed Dec 16 07:05:46.928310 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/core/handlers/base.py", line 131, in get_response
[Wed Dec 16 07:05:46.928313 2020] [wsgi:error] [pid 14047:tid 140483690739456] response = middleware_method(request, response)
[Wed Dec 16 07:05:46.928316 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/middleware/locale.py", line 36, in process_response
[Wed Dec 16 07:05:46.928319 2020] [wsgi:error] [pid 14047:tid 140483690739456] i18n_patterns_used, prefixed_default_language = is_language_prefix_patterns_used(urlconf)
[Wed Dec 16 07:05:46.928323 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/utils/lru_cache.py", line 100, in wrapper
[Wed Dec 16 07:05:46.928326 2020] [wsgi:error] [pid 14047:tid 140483690739456] result = user_function(*args, **kwds)
[Wed Dec 16 07:05:46.928329 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/conf/urls/i18n.py", line 29, in is_language_prefix_patterns_used
[Wed Dec 16 07:05:46.928332 2020] [wsgi:error] [pid 14047:tid 140483690739456] for url_pattern in get_resolver(urlconf).url_patterns:
[Wed Dec 16 07:05:46.928335 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
[Wed Dec 16 07:05:46.928338 2020] [wsgi:error] [pid 14047:tid 140483690739456] res = instance.__dict__[self.name] = self.func(instance)
[Wed Dec 16 07:05:46.928341 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/urls/resolvers.py", line 407, in url_patterns
[Wed Dec 16 07:05:46.928354 2020] [wsgi:error] [pid 14047:tid 140483690739456] patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
[Wed Dec 16 07:05:46.928357 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
[Wed Dec 16 07:05:46.928360 2020] [wsgi:error] [pid 14047:tid 140483690739456] res = instance.__dict__[self.name] = self.func(instance)
[Wed Dec 16 07:05:46.928363 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/urls/resolvers.py", line 400, in urlconf_module
[Wed Dec 16 07:05:46.928366 2020] [wsgi:error] [pid 14047:tid 140483690739456] return import_module(self.urlconf_name)
[Wed Dec 16 07:05:46.928369 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
[Wed Dec 16 07:05:46.928372 2020] [wsgi:error] [pid 14047:tid 140483690739456] __import__(name)
[Wed Dec 16 07:05:46.928375 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/YHMP/eamena/urls.py", line 19, in <module>
[Wed Dec 16 07:05:46.928378 2020] [wsgi:error] [pid 14047:tid 140483690739456] from arches import urls as arches_urls
[Wed Dec 16 07:05:46.928381 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/arches/urls.py", line 20, in <module>
[Wed Dec 16 07:05:46.928384 2020] [wsgi:error] [pid 14047:tid 140483690739456] from django.conf.urls import patterns, include, url
[Wed Dec 16 07:05:46.928387 2020] [wsgi:error] [pid 14047:tid 140483690739456] ImportError: cannot import name patterns
[Wed Dec 16 13:05:47.258838 2020] [authz_core:debug] [pid 14048:tid 140483573556992] mod_authz_core.c(809): [client :56386] AH01626: authorization result of Require all granted: granted, referer: http://database.yhmp.online/
[Wed Dec 16 13:05:47.258876 2020] [authz_core:debug] [pid 14048:tid 140483573556992] mod_authz_core.c(809): [client :56386] AH01626: authorization result of <RequireAny>: granted, referer: http://database.yhmp.online/
[Wed Dec 16 13:05:47.258911 2020] [authz_core:debug] [pid 14048:tid 140483573556992] mod_authz_core.c(809): [client :56386] AH01626: authorization result of Require all granted: granted, referer: http://database.yhmp.online/
[Wed Dec 16 13:05:47.258915 2020] [authz_core:debug] [pid 14048:tid 140483573556992] mod_authz_core.c(809): [client :56386] AH01626: authorization result of <RequireAny>: granted, referer: http://database.yhmp.online/
[Wed Dec 16 07:05:47.259857 2020] [wsgi:error] [pid 14047:tid 140483741136640] Internal Server Error: /favicon.ico
[Wed Dec 16 07:05:47.259871 2020] [wsgi:error] [pid 14047:tid 140483741136640] Traceback (most recent call last):
[Wed Dec 16 07:05:47.259875 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/core/handlers/exception.py", line 41, in inner
[Wed Dec 16 07:05:47.259878 2020] [wsgi:error] [pid 14047:tid 140483741136640] response = get_response(request)
[Wed Dec 16 07:05:47.259881 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/core/handlers/base.py", line 244, in _legacy_get_response
[Wed Dec 16 07:05:47.259885 2020] [wsgi:error] [pid 14047:tid 140483741136640] response = middleware_method(request)
[Wed Dec 16 07:05:47.259888 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/middleware/locale.py", line 24, in process_request
[Wed Dec 16 07:05:47.259892 2020] [wsgi:error] [pid 14047:tid 140483741136640] i18n_patterns_used, prefixed_default_language = is_language_prefix_patterns_used(urlconf)
[Wed Dec 16 07:05:47.259895 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/utils/lru_cache.py", line 100, in wrapper
[Wed Dec 16 07:05:47.259909 2020] [wsgi:error] [pid 14047:tid 140483741136640] result = user_function(*args, **kwds)
[Wed Dec 16 07:05:47.259912 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/conf/urls/i18n.py", line 29, in is_language_prefix_patterns_used
[Wed Dec 16 07:05:47.259916 2020] [wsgi:error] [pid 14047:tid 140483741136640] for url_pattern in get_resolver(urlconf).url_patterns:
[Wed Dec 16 07:05:47.259919 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
[Wed Dec 16 07:05:47.259922 2020] [wsgi:error] [pid 14047:tid 140483741136640] res = instance.__dict__[self.name] = self.func(instance)
[Wed Dec 16 07:05:47.259925 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/urls/resolvers.py", line 407, in url_patterns
[Wed Dec 16 07:05:47.259928 2020] [wsgi:error] [pid 14047:tid 140483741136640] patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
[Wed Dec 16 07:05:47.259931 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
[Wed Dec 16 07:05:47.259934 2020] [wsgi:error] [pid 14047:tid 140483741136640] res = instance.__dict__[self.name] = self.func(instance)
[Wed Dec 16 07:05:47.259937 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/urls/resolvers.py", line 400, in urlconf_module
[Wed Dec 16 07:05:47.259940 2020] [wsgi:error] [pid 14047:tid 140483741136640] return import_module(self.urlconf_name)
[Wed Dec 16 07:05:47.259943 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
[Wed Dec 16 07:05:47.259946 2020] [wsgi:error] [pid 14047:tid 140483741136640] __import__(name)
[Wed Dec 16 07:05:47.259948 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/YHMP/eamena/urls.py", line 19, in <module>
[Wed Dec 16 07:05:47.259951 2020] [wsgi:error] [pid 14047:tid 140483741136640] from arches import urls as arches_urls
[Wed Dec 16 07:05:47.259954 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/arches/urls.py", line 20, in <module>
[Wed Dec 16 07:05:47.259957 2020] [wsgi:error] [pid 14047:tid 140483741136640] from django.conf.urls import patterns, include, url
[Wed Dec 16 07:05:47.259960 2020] [wsgi:error] [pid 14047:tid 140483741136640] ImportError: cannot import name patterns
[Wed Dec 16 07:05:47.323245 2020] [wsgi:error] [pid 14047:tid 140483741136640] Internal Server Error: /favicon.ico
[Wed Dec 16 07:05:47.323268 2020] [wsgi:error] [pid 14047:tid 140483741136640] Traceback (most recent call last):
[Wed Dec 16 07:05:47.323271 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/core/handlers/base.py", line 131, in get_response
[Wed Dec 16 07:05:47.323275 2020] [wsgi:error] [pid 14047:tid 140483741136640] response = middleware_method(request, response)
[Wed Dec 16 07:05:47.323278 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/middleware/locale.py", line 36, in process_response
[Wed Dec 16 07:05:47.323281 2020] [wsgi:error] [pid 14047:tid 140483741136640] i18n_patterns_used, prefixed_default_language = is_language_prefix_patterns_used(urlconf)
[Wed Dec 16 07:05:47.323284 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/utils/lru_cache.py", line 100, in wrapper
[Wed Dec 16 07:05:47.323287 2020] [wsgi:error] [pid 14047:tid 140483741136640] result = user_function(*args, **kwds)
[Wed Dec 16 07:05:47.323290 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/conf/urls/i18n.py", line 29, in is_language_prefix_patterns_used
[Wed Dec 16 07:05:47.323302 2020] [wsgi:error] [pid 14047:tid 140483741136640] for url_pattern in get_resolver(urlconf).url_patterns:
[Wed Dec 16 07:05:47.323306 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
[Wed Dec 16 07:05:47.323309 2020] [wsgi:error] [pid 14047:tid 140483741136640] res = instance.__dict__[self.name] = self.func(instance)
[Wed Dec 16 07:05:47.323312 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/urls/resolvers.py", line 407, in url_patterns
[Wed Dec 16 07:05:47.323315 2020] [wsgi:error] [pid 14047:tid 140483741136640] patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
[Wed Dec 16 07:05:47.323318 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
[Wed Dec 16 07:05:47.323321 2020] [wsgi:error] [pid 14047:tid 140483741136640] res = instance.__dict__[self.name] = self.func(instance)
[Wed Dec 16 07:05:47.323324 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/urls/resolvers.py", line 400, in urlconf_module
[Wed Dec 16 07:05:47.323327 2020] [wsgi:error] [pid 14047:tid 140483741136640] return import_module(self.urlconf_name)
[Wed Dec 16 07:05:47.323329 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
[Wed Dec 16 07:05:47.323332 2020] [wsgi:error] [pid 14047:tid 140483741136640] __import__(name)
[Wed Dec 16 07:05:47.323335 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/YHMP/eamena/urls.py", line 19, in <module>
[Wed Dec 16 07:05:47.323338 2020] [wsgi:error] [pid 14047:tid 140483741136640] from arches import urls as arches_urls
[Wed Dec 16 07:05:47.323341 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/arches/urls.py", line 20, in <module>
[Wed Dec 16 07:05:47.323344 2020] [wsgi:error] [pid 14047:tid 140483741136640] from django.conf.urls import patterns, include, url
[Wed Dec 16 07:05:47.323347 2020] [wsgi:error] [pid 14047:tid 140483741136640] ImportError: cannot import name patterns
抱歉复制和粘贴了很长的日志,有人知道会发生什么吗?我们在同一台服务器上工作,但据说任何人都不会接触任何东西,因此很难找到要查找的位置。
此外,这是异常位置中指向的文件:/opt/yhmp-app/env/lib/python2.7/site-packages/arches/urls.py
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.conf.urls.i18n import patterns
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
uuid_regex = '[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}'
urlpatterns = patterns('',
url(r'^$', 'arches.app.views.main.index'),
url(r'^index.htm', 'arches.app.views.main.index', name='home'),
url(r'^auth/', 'arches.app.views.main.auth', name='auth'),
url(r'^rdm/(?P<conceptid>%s|())$' % uuid_regex , 'arches.app.views.concept.rdm', name='rdm'),
url(r'^map', 'arches.app.views.map.get_page', name="map"),
url(r'^geocoder', 'arches.app.views.search.geocode', name="geocoder"),
url(r'^entities/(?P<entityid>%s)$' % uuid_regex , 'arches.app.views.entity.Entities'),
url(r'^entityTypes/(?P<entitytypeid>.*)$', 'arches.app.views.entity.EntityTypes'),
url(r'^concepts/(?P<conceptid>%s)/manage_parents/$' % uuid_regex, 'arches.app.views.concept.manage_parents', name="concept_manage_parents"),
url(r'^concepts/(?P<conceptid>%s)/confirm_delete/$' % uuid_regex, 'arches.app.views.concept.confirm_delete', name="confirm_delete"),
url(r'^concepts/(?P<conceptid>%s|())$' % uuid_regex , 'arches.app.views.concept.concept', name="concept"),
url(r'^concepts/tree$', 'arches.app.views.concept.concept_tree', name="concept_tree"),
url(r'^concepts/search$', 'arches.app.views.concept.search', name="concept_search"),
url(r'^concepts/(?P<conceptid>%s)/from_sparql_endpoint$' % uuid_regex, 'arches.app.views.concept.add_concepts_from_sparql_endpoint', name="from_sparql_endpoint"),
url(r'^concepts/search_sparql_endpoint$', 'arches.app.views.concept.search_sparql_endpoint_for_concepts', name="search_sparql_endpoint"),
url(r'^search$', 'arches.app.views.search.home_page', name="search_home"),
url(r'^search/terms$', 'arches.app.views.search.search_terms', name="search_terms"),
url(r'^search/resources$', 'arches.app.views.search.search_results', name="search_results"),
url(r'^buffer/$', 'arches.app.views.search.buffer', name="buffer"),
url(r'^resources/(?P<resourcetypeid>[0-9a-zA-Z_.]*)/(?P<form_id>[a-zA-Z_-]*)/(?P<resourceid>%s|())$' % uuid_regex, 'arches.app.views.resources.resource_manager', name="resource_manager"),
url(r'^resources/related/(?P<resourceid>%s|())$' % uuid_regex, 'arches.app.views.resources.related_resources', name="related_resources"),
url(r'^resources/history/(?P<resourceid>%s|())$' % uuid_regex, 'arches.app.views.resources.edit_history', name="edit_history"),
url(r'^resources/layers/(?P<entitytypeid>.*)$', 'arches.app.views.resources.map_layers', name="map_layers"),
url(r'^resources/markers/(?P<entitytypeid>.*)$', 'arches.app.views.resources.map_layers', {'get_centroids':True}, name="map_markers"),
url(r'^reports/(?P<resourceid>%s)$' % uuid_regex , 'arches.app.views.resources.report', name='report'),
url(r'^get_admin_areas','arches.app.views.resources.get_admin_areas', name='get_admin_areas'),
# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# enables language change via form
url(r'^i18n/', include('django.conf.urls.i18n')),
# Uncomment the next line to enable the admin:
url(r'^admin/', include(admin.site.urls)),
)
urlpatterns += staticfiles_urlpatterns()
if settings.DEBUG:
from django.conf.urls.static import static
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
在 env 模式下 pip freeze 后,我得到以下详细信息,以防它们与解决问题相关:
appdirs==1.4.4
arches==3.1.2
arches-hip==1.0.4
configparser==4.0.2
contextlib2==0.6.0.post1
distlib==0.3.1
Django==1.7.11
elasticsearch==1.9.0
filelock==3.0.12
importlib-metadata==2.1.1
importlib-resources==3.3.0
isodate==0.6.0
packaging==20.8
pathlib2==2.3.5
Pillow==2.4.0
pluggy==0.13.1
psycopg2==2.5.4
py==1.10.0
pycryptodome==3.8.1
pyparsing==2.4.0
pyshp==2.1.0
pytz==2020.4
PyYAML==5.1
rdflib==4.2.2
scandir==1.10.0
singledispatch==3.4.0.3
six==1.15.0
SPARQLWrapper==1.8.4
toml==0.10.2
tox==3.20.1
typing==3.7.4.3
unicodecsv==0.14.1
urllib3==1.25.2
virtualenv==20.2.2
xlrd==0.9.0
zipp==1.2.0
同样在更改 django 版本后出现其他错误不知道是否真实:
如果你能给我指明方向,我将非常感谢你的专业知识。
提前致谢
django 的服务器版本升级了吗? patterns
在 1.10
中被弃用
当前的实现如下所示
from django.urls import include, path
urlpatterns = [
path('index/', views.index, name='main-view'),
path('bio/<username>/', views.bio, name='bio'),
path('articles/<slug:title>/', views.article, name='article-detail'),
path('articles/<slug:title>/<int:section>/', views.section, name='article-section'),
path('weblog/', include('blog.urls')),
...
]
*编辑
在服务器上安装旧版本的 django。
pip install "django==1.10.*"
Collecting django==1.10.*
Downloading https://files.pythonhosted.org/packages/bb/9f/2c20639ac635a83123ddffd91ba15001cb0d04e74fbb08f31fb57e490dab/Django-1.10.8-py2.py3-none-any.whl (6.8MB)
|████████████████████████████████| 6.8MB 17.2MB/s
Installing collected packages: django
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/Django-1.10.8.dist-info'
Consider using the `--user` option or check the permissions.
WARNING: You are using pip version 19.1.1, however version 20.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
挖掘后我无法理解我们的服务器发生了什么。我在加载网络时遇到此错误。
一切正常,任何人都可以触摸任何东西。因为这个错误,我已经更改了 application.txt 的所有权。 [Wed Dec 16 04:38:12.059839 2020] [wsgi:error] [pid 12343:tid 140072894818048] [remote xx.xx.xxx.xx:xxxxx] ValueError: 无法配置处理程序 'file': [ Errno 13] 权限被拒绝:'/opt/yhmp-app/YHMP/eamena/logs/application.txt'
在此之后它在浏览器中显示下一个错误:
所有这些都来自 error.log 尝试访问时:
ed Dec 16 13:05:46.856703 2020] [authz_core:debug] [pid 14049:tid 140483607127808] mod_authz_core.c(809): [client] AH01626: authorization result of Require all granted: granted
[Wed Dec 16 13:05:46.856746 2020] [authz_core:debug] [pid 14049:tid 140483607127808] mod_authz_core.c(809): [client ] AH01626: authorization result of <RequireAny>: granted
[Wed Dec 16 13:05:46.856782 2020] [authz_core:debug] [pid 14049:tid 140483607127808] mod_authz_core.c(809): [client :56384] AH01626: authorization result of Require all granted: granted
[Wed Dec 16 13:05:46.856787 2020] [authz_core:debug] [pid 14049:tid 140483607127808] mod_authz_core.c(809): [client :56384] AH01626: authorization result of <RequireAny>: granted
[Wed Dec 16 07:05:46.857793 2020] [wsgi:error] [pid 14047:tid 140483690739456] Internal Server Error: /
[Wed Dec 16 07:05:46.857809 2020] [wsgi:error] [pid 14047:tid 140483690739456] Traceback (most recent call last):
[Wed Dec 16 07:05:46.857814 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/core/handlers/exception.py", line 41, in inner
[Wed Dec 16 07:05:46.857817 2020] [wsgi:error] [pid 14047:tid 140483690739456] response = get_response(request)
[Wed Dec 16 07:05:46.857821 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/core/handlers/base.py", line 244, in _legacy_get_response
[Wed Dec 16 07:05:46.857824 2020] [wsgi:error] [pid 14047:tid 140483690739456] response = middleware_method(request)
[Wed Dec 16 07:05:46.857828 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/middleware/locale.py", line 24, in process_request
[Wed Dec 16 07:05:46.857831 2020] [wsgi:error] [pid 14047:tid 140483690739456] i18n_patterns_used, prefixed_default_language = is_language_prefix_patterns_used(urlconf)
[Wed Dec 16 07:05:46.857834 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/utils/lru_cache.py", line 100, in wrapper
[Wed Dec 16 07:05:46.857838 2020] [wsgi:error] [pid 14047:tid 140483690739456] result = user_function(*args, **kwds)
[Wed Dec 16 07:05:46.857841 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/conf/urls/i18n.py", line 29, in is_language_prefix_patterns_used
[Wed Dec 16 07:05:46.857844 2020] [wsgi:error] [pid 14047:tid 140483690739456] for url_pattern in get_resolver(urlconf).url_patterns:
[Wed Dec 16 07:05:46.857847 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
[Wed Dec 16 07:05:46.857857 2020] [wsgi:error] [pid 14047:tid 140483690739456] res = instance.__dict__[self.name] = self.func(instance)
[Wed Dec 16 07:05:46.857861 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/urls/resolvers.py", line 407, in url_patterns
[Wed Dec 16 07:05:46.857865 2020] [wsgi:error] [pid 14047:tid 140483690739456] patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
[Wed Dec 16 07:05:46.857868 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
[Wed Dec 16 07:05:46.857871 2020] [wsgi:error] [pid 14047:tid 140483690739456] res = instance.__dict__[self.name] = self.func(instance)
[Wed Dec 16 07:05:46.857874 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/urls/resolvers.py", line 400, in urlconf_module
[Wed Dec 16 07:05:46.857877 2020] [wsgi:error] [pid 14047:tid 140483690739456] return import_module(self.urlconf_name)
[Wed Dec 16 07:05:46.857880 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
[Wed Dec 16 07:05:46.857883 2020] [wsgi:error] [pid 14047:tid 140483690739456] __import__(name)
[Wed Dec 16 07:05:46.857886 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/YHMP/eamena/urls.py", line 19, in <module>
[Wed Dec 16 07:05:46.857889 2020] [wsgi:error] [pid 14047:tid 140483690739456] from arches import urls as arches_urls
[Wed Dec 16 07:05:46.857892 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/arches/urls.py", line 20, in <module>
[Wed Dec 16 07:05:46.857895 2020] [wsgi:error] [pid 14047:tid 140483690739456] from django.conf.urls import patterns, include, url
[Wed Dec 16 07:05:46.857898 2020] [wsgi:error] [pid 14047:tid 140483690739456] ImportError: cannot import name patterns
[Wed Dec 16 07:05:46.928281 2020] [wsgi:error] [pid 14047:tid 140483690739456] Internal Server Error: /
[Wed Dec 16 07:05:46.928306 2020] [wsgi:error] [pid 14047:tid 140483690739456] Traceback (most recent call last):
[Wed Dec 16 07:05:46.928310 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/core/handlers/base.py", line 131, in get_response
[Wed Dec 16 07:05:46.928313 2020] [wsgi:error] [pid 14047:tid 140483690739456] response = middleware_method(request, response)
[Wed Dec 16 07:05:46.928316 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/middleware/locale.py", line 36, in process_response
[Wed Dec 16 07:05:46.928319 2020] [wsgi:error] [pid 14047:tid 140483690739456] i18n_patterns_used, prefixed_default_language = is_language_prefix_patterns_used(urlconf)
[Wed Dec 16 07:05:46.928323 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/utils/lru_cache.py", line 100, in wrapper
[Wed Dec 16 07:05:46.928326 2020] [wsgi:error] [pid 14047:tid 140483690739456] result = user_function(*args, **kwds)
[Wed Dec 16 07:05:46.928329 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/conf/urls/i18n.py", line 29, in is_language_prefix_patterns_used
[Wed Dec 16 07:05:46.928332 2020] [wsgi:error] [pid 14047:tid 140483690739456] for url_pattern in get_resolver(urlconf).url_patterns:
[Wed Dec 16 07:05:46.928335 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
[Wed Dec 16 07:05:46.928338 2020] [wsgi:error] [pid 14047:tid 140483690739456] res = instance.__dict__[self.name] = self.func(instance)
[Wed Dec 16 07:05:46.928341 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/urls/resolvers.py", line 407, in url_patterns
[Wed Dec 16 07:05:46.928354 2020] [wsgi:error] [pid 14047:tid 140483690739456] patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
[Wed Dec 16 07:05:46.928357 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
[Wed Dec 16 07:05:46.928360 2020] [wsgi:error] [pid 14047:tid 140483690739456] res = instance.__dict__[self.name] = self.func(instance)
[Wed Dec 16 07:05:46.928363 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/urls/resolvers.py", line 400, in urlconf_module
[Wed Dec 16 07:05:46.928366 2020] [wsgi:error] [pid 14047:tid 140483690739456] return import_module(self.urlconf_name)
[Wed Dec 16 07:05:46.928369 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
[Wed Dec 16 07:05:46.928372 2020] [wsgi:error] [pid 14047:tid 140483690739456] __import__(name)
[Wed Dec 16 07:05:46.928375 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/YHMP/eamena/urls.py", line 19, in <module>
[Wed Dec 16 07:05:46.928378 2020] [wsgi:error] [pid 14047:tid 140483690739456] from arches import urls as arches_urls
[Wed Dec 16 07:05:46.928381 2020] [wsgi:error] [pid 14047:tid 140483690739456] File "/opt/yhmp-app/env/lib/python2.7/site-packages/arches/urls.py", line 20, in <module>
[Wed Dec 16 07:05:46.928384 2020] [wsgi:error] [pid 14047:tid 140483690739456] from django.conf.urls import patterns, include, url
[Wed Dec 16 07:05:46.928387 2020] [wsgi:error] [pid 14047:tid 140483690739456] ImportError: cannot import name patterns
[Wed Dec 16 13:05:47.258838 2020] [authz_core:debug] [pid 14048:tid 140483573556992] mod_authz_core.c(809): [client :56386] AH01626: authorization result of Require all granted: granted, referer: http://database.yhmp.online/
[Wed Dec 16 13:05:47.258876 2020] [authz_core:debug] [pid 14048:tid 140483573556992] mod_authz_core.c(809): [client :56386] AH01626: authorization result of <RequireAny>: granted, referer: http://database.yhmp.online/
[Wed Dec 16 13:05:47.258911 2020] [authz_core:debug] [pid 14048:tid 140483573556992] mod_authz_core.c(809): [client :56386] AH01626: authorization result of Require all granted: granted, referer: http://database.yhmp.online/
[Wed Dec 16 13:05:47.258915 2020] [authz_core:debug] [pid 14048:tid 140483573556992] mod_authz_core.c(809): [client :56386] AH01626: authorization result of <RequireAny>: granted, referer: http://database.yhmp.online/
[Wed Dec 16 07:05:47.259857 2020] [wsgi:error] [pid 14047:tid 140483741136640] Internal Server Error: /favicon.ico
[Wed Dec 16 07:05:47.259871 2020] [wsgi:error] [pid 14047:tid 140483741136640] Traceback (most recent call last):
[Wed Dec 16 07:05:47.259875 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/core/handlers/exception.py", line 41, in inner
[Wed Dec 16 07:05:47.259878 2020] [wsgi:error] [pid 14047:tid 140483741136640] response = get_response(request)
[Wed Dec 16 07:05:47.259881 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/core/handlers/base.py", line 244, in _legacy_get_response
[Wed Dec 16 07:05:47.259885 2020] [wsgi:error] [pid 14047:tid 140483741136640] response = middleware_method(request)
[Wed Dec 16 07:05:47.259888 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/middleware/locale.py", line 24, in process_request
[Wed Dec 16 07:05:47.259892 2020] [wsgi:error] [pid 14047:tid 140483741136640] i18n_patterns_used, prefixed_default_language = is_language_prefix_patterns_used(urlconf)
[Wed Dec 16 07:05:47.259895 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/utils/lru_cache.py", line 100, in wrapper
[Wed Dec 16 07:05:47.259909 2020] [wsgi:error] [pid 14047:tid 140483741136640] result = user_function(*args, **kwds)
[Wed Dec 16 07:05:47.259912 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/conf/urls/i18n.py", line 29, in is_language_prefix_patterns_used
[Wed Dec 16 07:05:47.259916 2020] [wsgi:error] [pid 14047:tid 140483741136640] for url_pattern in get_resolver(urlconf).url_patterns:
[Wed Dec 16 07:05:47.259919 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
[Wed Dec 16 07:05:47.259922 2020] [wsgi:error] [pid 14047:tid 140483741136640] res = instance.__dict__[self.name] = self.func(instance)
[Wed Dec 16 07:05:47.259925 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/urls/resolvers.py", line 407, in url_patterns
[Wed Dec 16 07:05:47.259928 2020] [wsgi:error] [pid 14047:tid 140483741136640] patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
[Wed Dec 16 07:05:47.259931 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
[Wed Dec 16 07:05:47.259934 2020] [wsgi:error] [pid 14047:tid 140483741136640] res = instance.__dict__[self.name] = self.func(instance)
[Wed Dec 16 07:05:47.259937 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/urls/resolvers.py", line 400, in urlconf_module
[Wed Dec 16 07:05:47.259940 2020] [wsgi:error] [pid 14047:tid 140483741136640] return import_module(self.urlconf_name)
[Wed Dec 16 07:05:47.259943 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
[Wed Dec 16 07:05:47.259946 2020] [wsgi:error] [pid 14047:tid 140483741136640] __import__(name)
[Wed Dec 16 07:05:47.259948 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/YHMP/eamena/urls.py", line 19, in <module>
[Wed Dec 16 07:05:47.259951 2020] [wsgi:error] [pid 14047:tid 140483741136640] from arches import urls as arches_urls
[Wed Dec 16 07:05:47.259954 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/arches/urls.py", line 20, in <module>
[Wed Dec 16 07:05:47.259957 2020] [wsgi:error] [pid 14047:tid 140483741136640] from django.conf.urls import patterns, include, url
[Wed Dec 16 07:05:47.259960 2020] [wsgi:error] [pid 14047:tid 140483741136640] ImportError: cannot import name patterns
[Wed Dec 16 07:05:47.323245 2020] [wsgi:error] [pid 14047:tid 140483741136640] Internal Server Error: /favicon.ico
[Wed Dec 16 07:05:47.323268 2020] [wsgi:error] [pid 14047:tid 140483741136640] Traceback (most recent call last):
[Wed Dec 16 07:05:47.323271 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/core/handlers/base.py", line 131, in get_response
[Wed Dec 16 07:05:47.323275 2020] [wsgi:error] [pid 14047:tid 140483741136640] response = middleware_method(request, response)
[Wed Dec 16 07:05:47.323278 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/middleware/locale.py", line 36, in process_response
[Wed Dec 16 07:05:47.323281 2020] [wsgi:error] [pid 14047:tid 140483741136640] i18n_patterns_used, prefixed_default_language = is_language_prefix_patterns_used(urlconf)
[Wed Dec 16 07:05:47.323284 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/utils/lru_cache.py", line 100, in wrapper
[Wed Dec 16 07:05:47.323287 2020] [wsgi:error] [pid 14047:tid 140483741136640] result = user_function(*args, **kwds)
[Wed Dec 16 07:05:47.323290 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/conf/urls/i18n.py", line 29, in is_language_prefix_patterns_used
[Wed Dec 16 07:05:47.323302 2020] [wsgi:error] [pid 14047:tid 140483741136640] for url_pattern in get_resolver(urlconf).url_patterns:
[Wed Dec 16 07:05:47.323306 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
[Wed Dec 16 07:05:47.323309 2020] [wsgi:error] [pid 14047:tid 140483741136640] res = instance.__dict__[self.name] = self.func(instance)
[Wed Dec 16 07:05:47.323312 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/urls/resolvers.py", line 407, in url_patterns
[Wed Dec 16 07:05:47.323315 2020] [wsgi:error] [pid 14047:tid 140483741136640] patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
[Wed Dec 16 07:05:47.323318 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
[Wed Dec 16 07:05:47.323321 2020] [wsgi:error] [pid 14047:tid 140483741136640] res = instance.__dict__[self.name] = self.func(instance)
[Wed Dec 16 07:05:47.323324 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/django/urls/resolvers.py", line 400, in urlconf_module
[Wed Dec 16 07:05:47.323327 2020] [wsgi:error] [pid 14047:tid 140483741136640] return import_module(self.urlconf_name)
[Wed Dec 16 07:05:47.323329 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
[Wed Dec 16 07:05:47.323332 2020] [wsgi:error] [pid 14047:tid 140483741136640] __import__(name)
[Wed Dec 16 07:05:47.323335 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/YHMP/eamena/urls.py", line 19, in <module>
[Wed Dec 16 07:05:47.323338 2020] [wsgi:error] [pid 14047:tid 140483741136640] from arches import urls as arches_urls
[Wed Dec 16 07:05:47.323341 2020] [wsgi:error] [pid 14047:tid 140483741136640] File "/opt/yhmp-app/env/lib/python2.7/site-packages/arches/urls.py", line 20, in <module>
[Wed Dec 16 07:05:47.323344 2020] [wsgi:error] [pid 14047:tid 140483741136640] from django.conf.urls import patterns, include, url
[Wed Dec 16 07:05:47.323347 2020] [wsgi:error] [pid 14047:tid 140483741136640] ImportError: cannot import name patterns
抱歉复制和粘贴了很长的日志,有人知道会发生什么吗?我们在同一台服务器上工作,但据说任何人都不会接触任何东西,因此很难找到要查找的位置。 此外,这是异常位置中指向的文件:/opt/yhmp-app/env/lib/python2.7/site-packages/arches/urls.py
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.conf.urls.i18n import patterns
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
uuid_regex = '[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}'
urlpatterns = patterns('',
url(r'^$', 'arches.app.views.main.index'),
url(r'^index.htm', 'arches.app.views.main.index', name='home'),
url(r'^auth/', 'arches.app.views.main.auth', name='auth'),
url(r'^rdm/(?P<conceptid>%s|())$' % uuid_regex , 'arches.app.views.concept.rdm', name='rdm'),
url(r'^map', 'arches.app.views.map.get_page', name="map"),
url(r'^geocoder', 'arches.app.views.search.geocode', name="geocoder"),
url(r'^entities/(?P<entityid>%s)$' % uuid_regex , 'arches.app.views.entity.Entities'),
url(r'^entityTypes/(?P<entitytypeid>.*)$', 'arches.app.views.entity.EntityTypes'),
url(r'^concepts/(?P<conceptid>%s)/manage_parents/$' % uuid_regex, 'arches.app.views.concept.manage_parents', name="concept_manage_parents"),
url(r'^concepts/(?P<conceptid>%s)/confirm_delete/$' % uuid_regex, 'arches.app.views.concept.confirm_delete', name="confirm_delete"),
url(r'^concepts/(?P<conceptid>%s|())$' % uuid_regex , 'arches.app.views.concept.concept', name="concept"),
url(r'^concepts/tree$', 'arches.app.views.concept.concept_tree', name="concept_tree"),
url(r'^concepts/search$', 'arches.app.views.concept.search', name="concept_search"),
url(r'^concepts/(?P<conceptid>%s)/from_sparql_endpoint$' % uuid_regex, 'arches.app.views.concept.add_concepts_from_sparql_endpoint', name="from_sparql_endpoint"),
url(r'^concepts/search_sparql_endpoint$', 'arches.app.views.concept.search_sparql_endpoint_for_concepts', name="search_sparql_endpoint"),
url(r'^search$', 'arches.app.views.search.home_page', name="search_home"),
url(r'^search/terms$', 'arches.app.views.search.search_terms', name="search_terms"),
url(r'^search/resources$', 'arches.app.views.search.search_results', name="search_results"),
url(r'^buffer/$', 'arches.app.views.search.buffer', name="buffer"),
url(r'^resources/(?P<resourcetypeid>[0-9a-zA-Z_.]*)/(?P<form_id>[a-zA-Z_-]*)/(?P<resourceid>%s|())$' % uuid_regex, 'arches.app.views.resources.resource_manager', name="resource_manager"),
url(r'^resources/related/(?P<resourceid>%s|())$' % uuid_regex, 'arches.app.views.resources.related_resources', name="related_resources"),
url(r'^resources/history/(?P<resourceid>%s|())$' % uuid_regex, 'arches.app.views.resources.edit_history', name="edit_history"),
url(r'^resources/layers/(?P<entitytypeid>.*)$', 'arches.app.views.resources.map_layers', name="map_layers"),
url(r'^resources/markers/(?P<entitytypeid>.*)$', 'arches.app.views.resources.map_layers', {'get_centroids':True}, name="map_markers"),
url(r'^reports/(?P<resourceid>%s)$' % uuid_regex , 'arches.app.views.resources.report', name='report'),
url(r'^get_admin_areas','arches.app.views.resources.get_admin_areas', name='get_admin_areas'),
# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# enables language change via form
url(r'^i18n/', include('django.conf.urls.i18n')),
# Uncomment the next line to enable the admin:
url(r'^admin/', include(admin.site.urls)),
)
urlpatterns += staticfiles_urlpatterns()
if settings.DEBUG:
from django.conf.urls.static import static
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
在 env 模式下 pip freeze 后,我得到以下详细信息,以防它们与解决问题相关:
appdirs==1.4.4
arches==3.1.2
arches-hip==1.0.4
configparser==4.0.2
contextlib2==0.6.0.post1
distlib==0.3.1
Django==1.7.11
elasticsearch==1.9.0
filelock==3.0.12
importlib-metadata==2.1.1
importlib-resources==3.3.0
isodate==0.6.0
packaging==20.8
pathlib2==2.3.5
Pillow==2.4.0
pluggy==0.13.1
psycopg2==2.5.4
py==1.10.0
pycryptodome==3.8.1
pyparsing==2.4.0
pyshp==2.1.0
pytz==2020.4
PyYAML==5.1
rdflib==4.2.2
scandir==1.10.0
singledispatch==3.4.0.3
six==1.15.0
SPARQLWrapper==1.8.4
toml==0.10.2
tox==3.20.1
typing==3.7.4.3
unicodecsv==0.14.1
urllib3==1.25.2
virtualenv==20.2.2
xlrd==0.9.0
zipp==1.2.0
同样在更改 django 版本后出现其他错误不知道是否真实:
如果你能给我指明方向,我将非常感谢你的专业知识。
提前致谢
django 的服务器版本升级了吗? patterns
在 1.10
当前的实现如下所示
from django.urls import include, path
urlpatterns = [
path('index/', views.index, name='main-view'),
path('bio/<username>/', views.bio, name='bio'),
path('articles/<slug:title>/', views.article, name='article-detail'),
path('articles/<slug:title>/<int:section>/', views.section, name='article-section'),
path('weblog/', include('blog.urls')),
...
]
*编辑
在服务器上安装旧版本的 django。
pip install "django==1.10.*"
Collecting django==1.10.*
Downloading https://files.pythonhosted.org/packages/bb/9f/2c20639ac635a83123ddffd91ba15001cb0d04e74fbb08f31fb57e490dab/Django-1.10.8-py2.py3-none-any.whl (6.8MB)
|████████████████████████████████| 6.8MB 17.2MB/s
Installing collected packages: django
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/Django-1.10.8.dist-info'
Consider using the `--user` option or check the permissions.
WARNING: You are using pip version 19.1.1, however version 20.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.