After digging I cannot manage to understand what happened with our server. I got this error when loading the web.
It was working and anyone touch anything. I have changed the ownership of the application.txt because this error.
[Wed Dec 16 04:38:12.059839 2020] [wsgi:error] [pid 12343:tid 140072894818048] [remote xx.xx.xxx.xx:xxxxx] ValueError: Unable to configure handler 'file': [Errno 13] Permission denied: '/opt/yhmp-app/YHMP/eamena/logs/application.txt'
After this it is showing up the next error in the browser:
and all this is coming form the error.log when trying to access:
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
Sorry for the long log copy and paste, do someone have an idea about what can happened to that? We work within the same server but supposedly anyone touch nothing so it is being very difficult to find where to look for.
in addition this is the file pointed in the Exception Location: /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)
After pip freeze in the env mode i get the following details in case they are relevant to solve the issue:
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
Also after change the version of django it appear thsi other error not idea if it is realted:
I would really appreciate your expertise with this and if you can point me in some direction.
Thanks in advance
Was the servers version of django upgraded? patterns was deprecated in 1.10
https://stackoverflow.com/a/38799716/1464664
current implementations looks like this
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')),
...
]
*edit
To install an older version of django on the server.
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.
Related
i followed AWS tutorial for django lightsail instance: https://aws.amazon.com/es/getting-started/hands-on/deploy-python-application/
i tried to deploy my own code but apache gives me errors on piped installed modules.
It seems that instance have different paths. Some one has deployed custom django projects on django lightsail instance?
[Sun Aug 16 22:58:29.402644 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] mod_wsgi (pid=4065): Exception occurred processing WSGI script '/opt/bitnami/apps/django/django_projects/orderbot/ordermenu/wsgi.py'.
[Sun Aug 16 22:58:29.403437 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] Traceback (most recent call last):
[Sun Aug 16 22:58:29.403493 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] File "/opt/bitnami/apps/django/django_projects/orderbot/ordermenu/wsgi.py", line 22, in <module>
[Sun Aug 16 22:58:29.403504 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] application = get_wsgi_application()
[Sun Aug 16 22:58:29.403515 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] File "/opt/bitnami/python/lib/python3.8/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
[Sun Aug 16 22:58:29.403521 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] django.setup(set_prefix=False)
[Sun Aug 16 22:58:29.403530 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] File "/opt/bitnami/python/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
[Sun Aug 16 22:58:29.403535 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] apps.populate(settings.INSTALLED_APPS)
[Sun Aug 16 22:58:29.403544 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] File "/opt/bitnami/python/lib/python3.8/site-packages/django/apps/registry.py", line 91, in populate
[Sun Aug 16 22:58:29.403549 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] app_config = AppConfig.create(entry)
[Sun Aug 16 22:58:29.403558 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] File "/opt/bitnami/python/lib/python3.8/site-packages/django/apps/config.py", line 90, in create
[Sun Aug 16 22:58:29.403563 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] module = import_module(entry)
[Sun Aug 16 22:58:29.403571 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] File "/opt/bitnami/python/lib/python3.8/importlib/__init__.py", line 127, in import_module
[Sun Aug 16 22:58:29.403578 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] return _bootstrap._gcd_import(name[level:], package, level)
[Sun Aug 16 22:58:29.403587 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
[Sun Aug 16 22:58:29.403596 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] File "<frozen importlib._bootstrap>", line 991, in _find_and_load
[Sun Aug 16 22:58:29.403606 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
[Sun Aug 16 22:58:29.403626 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] ModuleNotFoundError: No module named 'phonenumber_field'
The problem is that 'python install packages in a directory that apache do not see'.
so: packages get installed in '/home/bitnami/.local/lib/python3.8/site-packages/' and Apache looks in '/opt/bitnami/python/lib/python3.8/site-packages/'.
The temporary solution I followed is copying packages to Apache eyes folder with this command 'cp -r /home/bitnami/.local/lib/python3.8/site-packages/* /opt/bitnami/python/lib/python3.8/site-packages/'
Just needed to use the root user with sudo su command for pip install packages, now are found by apache.
I am trying to start my first django app with Apache2 (2.4.18).
Unfortunately, I got a bit stuck. This is the error code i get in my log file:
[Wed Mar 11 06:31:32.668937 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] mod_wsgi (pid=14849): Target WSGI script '/home/nigsdtm/srv/portal/mysite/wsgi.py' cannot be loaded as Python module.
[Wed Mar 11 06:31:32.669026 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] mod_wsgi (pid=14849): Exception occurred processing WSGI script '/home/nigsdtm/srv/portal/mysite/wsgi.py'.
[Wed Mar 11 06:31:32.669734 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] Traceback (most recent call last):
[Wed Mar 11 06:31:32.669779 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] File "/home/nigsdtm/srv/portal/mysite/wsgi.py", line 16, in <module>
[Wed Mar 11 06:31:32.669783 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] application = get_wsgi_application()
[Wed Mar 11 06:31:32.669789 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] File "/usr/local/lib/python3.5/dist-packages/django/core/wsgi.py", line 12, in get_wsgi_application
[Wed Mar 11 06:31:32.669792 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] django.setup(set_prefix=False)
[Wed Mar 11 06:31:32.669809 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] File "/usr/local/lib/python3.5/dist-packages/django/__init__.py", line 24, in setup
[Wed Mar 11 06:31:32.669812 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] apps.populate(settings.INSTALLED_APPS)
[Wed Mar 11 06:31:32.669817 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] File "/usr/local/lib/python3.5/dist-packages/django/apps/registry.py", line 112, in populate
[Wed Mar 11 06:31:32.669820 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] app_config.import_models()
[Wed Mar 11 06:31:32.669824 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] File "/usr/local/lib/python3.5/dist-packages/django/apps/config.py", line 198, in import_models
[Wed Mar 11 06:31:32.669827 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] self.models_module = import_module(models_module_name)
[Wed Mar 11 06:31:32.669832 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
[Wed Mar 11 06:31:32.669834 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] return _bootstrap._gcd_import(name[level:], package, level)
[Wed Mar 11 06:31:32.669839 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] File "<frozen importlib._bootstrap>", line 986, in _gcd_import
[Wed Mar 11 06:31:32.669843 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] File "<frozen importlib._bootstrap>", line 969, in _find_and_load
[Wed Mar 11 06:31:32.669848 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
[Wed Mar 11 06:31:32.669852 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
[Wed Mar 11 06:31:32.669857 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] File "<frozen importlib._bootstrap_external>", line 665, in exec_module
[Wed Mar 11 06:31:32.669861 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
[Wed Mar 11 06:31:32.669866 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] File "/usr/local/lib/python3.5/dist-packages/polls/models.py", line 14, in <module>
[Wed Mar 11 06:31:32.669869 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] class Choice(models.Model):
[Wed Mar 11 06:31:32.669873 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] File "/usr/local/lib/python3.5/dist-packages/polls/models.py", line 15, in Choice
[Wed Mar 11 06:31:32.669886 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] question = models.ForeignKey(Question)
[Wed Mar 11 06:31:32.669900 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] TypeError: __init__() missing 1 required positional argument: 'on_delete'
[Wed Mar 11 06:31:47.868251 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] mod_wsgi (pid=15027): Target WSGI script '/home/nigsdtm/srv/portal/mysite/wsgi.py' cannot be loaded as Python module.
[Wed Mar 11 06:31:47.868326 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] mod_wsgi (pid=15027): Exception occurred processing WSGI script '/home/nigsdtm/srv/portal/mysite/wsgi.py'.
[Wed Mar 11 06:31:47.869029 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] Traceback (most recent call last):
[Wed Mar 11 06:31:47.869078 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] File "/home/nigsdtm/srv/portal/mysite/wsgi.py", line 16, in <module>
[Wed Mar 11 06:31:47.869082 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] application = get_wsgi_application()
[Wed Mar 11 06:31:47.869087 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] File "/usr/local/lib/python3.5/dist-packages/django/core/wsgi.py", line 12, in get_wsgi_application
[Wed Mar 11 06:31:47.869090 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] django.setup(set_prefix=False)
[Wed Mar 11 06:31:47.869098 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] File "/usr/local/lib/python3.5/dist-packages/django/__init__.py", line 24, in setup
[Wed Mar 11 06:31:47.869101 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] apps.populate(settings.INSTALLED_APPS)
[Wed Mar 11 06:31:47.869105 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] File "/usr/local/lib/python3.5/dist-packages/django/apps/registry.py", line 112, in populate
[Wed Mar 11 06:31:47.869108 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] app_config.import_models()
[Wed Mar 11 06:31:47.869112 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] File "/usr/local/lib/python3.5/dist-packages/django/apps/config.py", line 198, in import_models
[Wed Mar 11 06:31:47.869115 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] self.models_module = import_module(models_module_name)
[Wed Mar 11 06:31:47.869119 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
[Wed Mar 11 06:31:47.869122 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] return _bootstrap._gcd_import(name[level:], package, level)
[Wed Mar 11 06:31:47.869127 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] File "<frozen importlib._bootstrap>", line 986, in _gcd_import
[Wed Mar 11 06:31:47.869132 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] File "<frozen importlib._bootstrap>", line 969, in _find_and_load
[Wed Mar 11 06:31:47.869136 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
[Wed Mar 11 06:31:47.869141 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
[Wed Mar 11 06:31:47.869146 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] File "<frozen importlib._bootstrap_external>", line 665, in exec_module
[Wed Mar 11 06:31:47.869158 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
[Wed Mar 11 06:31:47.869163 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] File "/usr/local/lib/python3.5/dist-packages/polls/models.py", line 14, in <module>
[Wed Mar 11 06:31:47.869166 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] class Choice(models.Model):
[Wed Mar 11 06:31:47.869170 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] File "/usr/local/lib/python3.5/dist-packages/polls/models.py", line 15, in Choice
[Wed Mar 11 06:31:47.869172 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] question = models.ForeignKey(Question)
[Wed Mar 11 06:31:47.869186 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] TypeError: __init__() missing 1 required positional argument: 'on_delete'
[Wed Mar 11 06:31:48.530646 2020] [wsgi:error] [pid 15027:tid 140380018607872] [remote 10.150.29.220:42180] mod_wsgi (pid=15027): Target WSGI script '/home/nigsdtm/srv/portal/mysite/wsgi.py' cannot be loaded as Python module.
[Wed Mar 11 06:31:48.530748 2020] [wsgi:error] [pid 15027:tid 140380018607872] [remote 10.150.29.220:42180] mod_wsgi (pid=15027): Exception occurred processing WSGI script '/home/nigsdtm/srv/portal/mysite/wsgi.py'.
[Wed Mar 11 06:31:48.530861 2020] [wsgi:error] [pid 15027:tid 140380018607872] [remote 10.150.29.220:42180] Traceback (most recent call last):
[Wed Mar 11 06:31:48.530888 2020] [wsgi:error] [pid 15027:tid 140380018607872] [remote 10.150.29.220:42180] File "/home/nigsdtm/srv/portal/mysite/wsgi.py", line 16, in <module>
[Wed Mar 11 06:31:48.530891 2020] [wsgi:error] [pid 15027:tid 140380018607872] [remote 10.150.29.220:42180] application = get_wsgi_application()
[Wed Mar 11 06:31:48.530897 2020] [wsgi:error] [pid 15027:tid 140380018607872] [remote 10.150.29.220:42180] File "/usr/local/lib/python3.5/dist-packages/django/core/wsgi.py", line 12, in get_wsgi_application
[Wed Mar 11 06:31:48.530897 2020] [wsgi:error] [pid 15027:tid 140380018607872] [remote 10.150.29.220:42180] File "/usr/local/lib/python3.5/dist-packages/django/core/wsgi.py", line 12, in get_wsgi_application
[Wed Mar 11 06:31:48.530899 2020] [wsgi:error] [pid 15027:tid 140380018607872] [remote 10.150.29.220:42180] django.setup(set_prefix=False)
[Wed Mar 11 06:31:48.530904 2020] [wsgi:error] [pid 15027:tid 140380018607872] [remote 10.150.29.220:42180] File "/usr/local/lib/python3.5/dist-packages/django/__init__.py", line 24, in setup
[Wed Mar 11 06:31:48.530907 2020] [wsgi:error] [pid 15027:tid 140380018607872] [remote 10.150.29.220:42180] apps.populate(settings.INSTALLED_APPS)
[Wed Mar 11 06:31:48.530911 2020] [wsgi:error] [pid 15027:tid 140380018607872] [remote 10.150.29.220:42180] File "/usr/local/lib/python3.5/dist-packages/django/apps/registry.py", line 81, in populate
[Wed Mar 11 06:31:48.530914 2020] [wsgi:error] [pid 15027:tid 140380018607872] [remote 10.150.29.220:42180] raise RuntimeError("populate() isn't reentrant")
[Wed Mar 11 06:31:48.530927 2020] [wsgi:error] [pid 15027:tid 140380018607872] [remote 10.150.29.220:42180] RuntimeError: populate() isn't reentrant
This is my apache2 config file:
Listen 80
<VirtualHost *:80>
ServerAdmin alexandru.bran#nokia.com
ServerName app.gdceur.eecloud.dynamic.nsn-net.net
DocumentRoot /home/nigsdtm/srv
Alias /static /home/nigsdtm/srv/portal/mysite/static
<Directory "/home/nigsdtm/srv/portal/mysite/static">
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/portal_error.log
CustomLog ${APACHE_LOG_DIR}/portal_access.log combined
WSGIDaemonProcess mysite python-home=/home/nigsdtm/srv/portal/ python-path=/home/nigsdtm/srv/portal/venv
WSGIProcessGroup mysite
WSGIScriptAlias / /home/nigsdtm/srv/portal/mysite/wsgi.py
<Directory /home/nigsdtm/srv/portal/mysite>
<Files wsgi.py>
Allow from all
</Files>
</Directory>
</VirtualHost>
This is my wsgi file:
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
application = get_wsgi_application()
Project folder name (where manage.py is) is called 'portal'
Folder containing wsgi: 'mysite'
App works if I run server from python environment.
I am running Django 2.1.15 with Python 3.5.2
Could you please give me a hint?
Thanks,
Alexandru
I see this line of error:
TypeError: __init__() missing 1 required positional argument: 'on_delete'
This one I recognized as a missing on_delete statement in a ForeignKey attribute.
According to Django2 changelog:
The on_delete argument for ForeignKey and OneToOneField is now required in models and migrations. Consider squashing migrations so that you have fewer of them to update.
You might have developed your application on Django1 and trying to deploy it with Django2.
You should check that you installed the same dependencies on your production server than on your development machine.
I'm tryign to get a Django application with Python 3.7 working with CentOS 7 and Apache (Mod WSGI). I have a project with a virtual environment set up. How do I turn off SqlLite? I'm not and don't intend to ever use it. I tried running
(dentalenv) [root#server Python-3.7.2]# sudo yum install libsqlite3-dev
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.us-midwest-1.nexcess.net
* epel: mirror.steadfastnet.com
* extras: mirror.us-midwest-1.nexcess.net
* updates: mirror.us-midwest-1.nexcess.net
No package libsqlite3-dev available.
Error: Nothing to do
to install it and then restarting my Apache server. I even rebuilt Python, but I still get the below error, "ModuleNotFoundError: No module named '_sqlite3'"
[Wed Feb 20 04:03:06.627020 2019] [wsgi:error] [pid 11885] Traceback (most recent call last):
[Wed Feb 20 04:03:06.627285 2019] [wsgi:error] [pid 11885] File "/var/www/html/dental/wsgi.py", line 25, in <module>
[Wed Feb 20 04:03:06.627323 2019] [wsgi:error] [pid 11885] application = get_wsgi_application()
[Wed Feb 20 04:03:06.627353 2019] [wsgi:error] [pid 11885] File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
[Wed Feb 20 04:03:06.627378 2019] [wsgi:error] [pid 11885] django.setup(set_prefix=False)
[Wed Feb 20 04:03:06.627405 2019] [wsgi:error] [pid 11885] File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
[Wed Feb 20 04:03:06.627429 2019] [wsgi:error] [pid 11885] apps.populate(settings.INSTALLED_APPS)
[Wed Feb 20 04:03:06.627467 2019] [wsgi:error] [pid 11885] File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/apps/registry.py", line 112, in populate
[Wed Feb 20 04:03:06.627493 2019] [wsgi:error] [pid 11885] app_config.import_models()
[Wed Feb 20 04:03:06.627520 2019] [wsgi:error] [pid 11885] File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/apps/config.py", line 198, in import_models
[Wed Feb 20 04:03:06.627544 2019] [wsgi:error] [pid 11885] self.models_module = import_module(models_module_name)
[Wed Feb 20 04:03:06.627571 2019] [wsgi:error] [pid 11885] File "/var/www/html/dentalenv/lib/python3.7/importlib/__init__.py", line 127, in import_module
[Wed Feb 20 04:03:06.627608 2019] [wsgi:error] [pid 11885] return _bootstrap._gcd_import(name[level:], package, level)
[Wed Feb 20 04:03:06.627636 2019] [wsgi:error] [pid 11885] File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
[Wed Feb 20 04:03:06.627666 2019] [wsgi:error] [pid 11885] File "<frozen importlib._bootstrap>", line 983, in _find_and_load
[Wed Feb 20 04:03:06.627695 2019] [wsgi:error] [pid 11885] File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
[Wed Feb 20 04:03:06.627724 2019] [wsgi:error] [pid 11885] File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
[Wed Feb 20 04:03:06.627754 2019] [wsgi:error] [pid 11885] File "<frozen importlib._bootstrap_external>", line 728, in exec_module
[Wed Feb 20 04:03:06.627783 2019] [wsgi:error] [pid 11885] File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
[Wed Feb 20 04:03:06.627812 2019] [wsgi:error] [pid 11885] File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/contrib/auth/models.py", line 2, in <module>
[Wed Feb 20 04:03:06.627835 2019] [wsgi:error] [pid 11885] from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
[Wed Feb 20 04:03:06.627861 2019] [wsgi:error] [pid 11885] File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/contrib/auth/base_user.py", line 47, in <module>
[Wed Feb 20 04:03:06.627884 2019] [wsgi:error] [pid 11885] class AbstractBaseUser(models.Model):
[Wed Feb 20 04:03:06.627910 2019] [wsgi:error] [pid 11885] File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/db/models/base.py", line 101, in __new__
[Wed Feb 20 04:03:06.627933 2019] [wsgi:error] [pid 11885] new_class.add_to_class('_meta', Options(meta, app_label))
[Wed Feb 20 04:03:06.627958 2019] [wsgi:error] [pid 11885] File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/db/models/base.py", line 305, in add_to_class
[Wed Feb 20 04:03:06.627981 2019] [wsgi:error] [pid 11885] value.contribute_to_class(cls, name)
[Wed Feb 20 04:03:06.628008 2019] [wsgi:error] [pid 11885] File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/db/models/options.py", line 203, in contribute_to_class
[Wed Feb 20 04:03:06.628031 2019] [wsgi:error] [pid 11885] self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
[Wed Feb 20 04:03:06.628058 2019] [wsgi:error] [pid 11885] File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/db/__init__.py", line 33, in __getattr__
[Wed Feb 20 04:03:06.628081 2019] [wsgi:error] [pid 11885] return getattr(connections[DEFAULT_DB_ALIAS], item)
[Wed Feb 20 04:03:06.628107 2019] [wsgi:error] [pid 11885] File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/db/utils.py", line 202, in __getitem__
[Wed Feb 20 04:03:06.628132 2019] [wsgi:error] [pid 11885] backend = load_backend(db['ENGINE'])
[Wed Feb 20 04:03:06.628159 2019] [wsgi:error] [pid 11885] File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/db/utils.py", line 110, in load_backend
[Wed Feb 20 04:03:06.628193 2019] [wsgi:error] [pid 11885] return import_module('%s.base' % backend_name)
[Wed Feb 20 04:03:06.628222 2019] [wsgi:error] [pid 11885] File "/var/www/html/dentalenv/lib/python3.7/importlib/__init__.py", line 127, in import_module
[Wed Feb 20 04:03:06.628243 2019] [wsgi:error] [pid 11885] return _bootstrap._gcd_import(name[level:], package, level)
[Wed Feb 20 04:03:06.628264 2019] [wsgi:error] [pid 11885] File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py", line 10, in <module>
[Wed Feb 20 04:03:06.628283 2019] [wsgi:error] [pid 11885] from sqlite3 import dbapi2 as Database
[Wed Feb 20 04:03:06.628304 2019] [wsgi:error] [pid 11885] File "/usr/local/lib/python3.7/sqlite3/__init__.py", line 23, in <module>
[Wed Feb 20 04:03:06.628323 2019] [wsgi:error] [pid 11885] from sqlite3.dbapi2 import *
[Wed Feb 20 04:03:06.628344 2019] [wsgi:error] [pid 11885] File "/usr/local/lib/python3.7/sqlite3/dbapi2.py", line 27, in <module>
[Wed Feb 20 04:03:06.628369 2019] [wsgi:error] [pid 11885] from _sqlite3 import *
[Wed Feb 20 04:03:06.628408 2019] [wsgi:error] [pid 11885] ModuleNotFoundError: No module named '_sqlite3'
[Wed Feb 20 04:03:09.130480 2019] [wsgi:error] [pid 11885] [remote 207.181.224.155:58106] mod_wsgi (pid=11885): Target WSGI script '/var/www/html/dental/wsgi.py' does not contain WSGI application 'application'.
I have setup a Django project with Apache2 and mod_wsgi on Ubuntu 16.04 instance of AWS. Now I am getting urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetErr or(104, 'Connection reset by peer')) error when I try to access mysite.
I have tried almost everything suggested on stackoverflow and other link. but get no luck.
[Mon Jan 28 21:02:52.263398 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] Traceback (most recent call last):
[Mon Jan 28 21:02:52.263457 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] File "/var/www/env/lib/python3.6/site-packages/urllib3/connectionpool.py", line 600, in urlopen
[Mon Jan 28 21:02:52.263537 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] chunked=chunked)
[Mon Jan 28 21:02:52.263613 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] File "/var/www/env/lib/python3.6/site-packages/urllib3/connectionpool.py", line 384, in _make_request
[Mon Jan 28 21:02:52.263655 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] six.raise_from(e, None)
[Mon Jan 28 21:02:52.263707 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] File "<string>", line 2, in raise_from
[Mon Jan 28 21:02:52.263760 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] File "/var/www/env/lib/python3.6/site-packages/urllib3/connectionpool.py", line 380, in _make_request
[Mon Jan 28 21:02:52.263799 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] httplib_response = conn.getresponse()
[Mon Jan 28 21:02:52.263851 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] File "/usr/lib/python3.6/http/client.py", line 1331, in getresponse
[Mon Jan 28 21:02:52.263903 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] response.begin()
[Mon Jan 28 21:02:52.263943 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] File "/usr/lib/python3.6/http/client.py", line 297, in begin
[Mon Jan 28 21:02:52.263995 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] version, status, reason = self._read_status()
[Mon Jan 28 21:02:52.264032 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] File "/usr/lib/python3.6/http/client.py", line 258, in _read_status
[Mon Jan 28 21:02:52.264086 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
[Mon Jan 28 21:02:52.264129 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] File "/usr/lib/python3.6/socket.py", line 586, in readinto
[Mon Jan 28 21:02:52.264165 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] return self._sock.recv_into(b)
[Mon Jan 28 21:02:52.264200 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] ConnectionResetError: [Errno 104] Connection reset by peer
[Mon Jan 28 21:02:52.264234 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898]
[Mon Jan 28 21:02:52.264268 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] During handling of the above exception, another exception occurred:
[Mon Jan 28 21:02:52.302940 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898]
[Mon Jan 28 21:02:52.302961 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] Traceback (most recent call last):
[Mon Jan 28 21:02:52.302991 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] File "/var/www/env/lib/python3.6/site-packages/django/core/handlers/except ion.py", line 34, in inner
[Mon Jan 28 21:02:52.302994 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] response = get_response(request)
[Mon Jan 28 21:02:52.302996 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] File "/var/www/env/lib/python3.6/site-packages/django/core/handlers/base.p y", line 126, in _get_response
[Mon Jan 28 21:02:52.302999 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] response = self.process_exception_by_middleware(e, request)
[Mon Jan 28 21:02:52.303001 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] File "/var/www/env/lib/python3.6/site-packages/django/core/handlers/base.p y", line 124, in _get_response
[Mon Jan 28 21:02:52.303004 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] response = wrapped_callback(request, *callback_args, **callback_kwargs)
[Mon Jan 28 21:02:52.303006 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] File "/var/www/env/lib/python3.6/site-packages/django/views/decorators/csr f.py", line 54, in wrapped_view
[Mon Jan 28 21:02:52.303009 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] return view_func(*args, **kwargs)
[Mon Jan 28 21:02:52.303011 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] File "/home/jshree/Dscrapper/soqqlesocial/data_scrapper/views.py", line 63 , in request_page
[Mon Jan 28 21:02:52.303014 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] twitter.scrap_tweets(rDate, rDatePre, uName, lName)
[Mon Jan 28 21:02:52.303017 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] File "/home/jshree/Dscrapper/soqqlesocial/twitter.py", line 48, in scrap_t weets
[Mon Jan 28 21:02:52.303019 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] drw = webdriver.Chrome(executable_path='/usr/bin/chromedriver', options= options)
[Mon Jan 28 21:02:52.303021 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] File "/var/www/env/lib/python3.6/site-packages/selenium/webdriver/chrome/w ebdriver.py", line 81, in __init__
[Mon Jan 28 21:02:52.303024 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] desired_capabilities=desired_capabilities)
[Mon Jan 28 21:02:52.303026 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] File "/var/www/env/lib/python3.6/site-packages/selenium/webdriver/remote/w ebdriver.py", line 157, in __init__
[Mon Jan 28 21:02:52.303029 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] self.start_session(capabilities, browser_profile)
[Mon Jan 28 21:02:52.303031 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] File "/var/www/env/lib/python3.6/site-packages/selenium/webdriver/remote/w ebdriver.py", line 252, in start_session
[Mon Jan 28 21:02:52.303034 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] response = self.execute(Command.NEW_SESSION, parameters)
[Mon Jan 28 21:02:52.303036 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] File "/var/www/env/lib/python3.6/site-packages/selenium/webdriver/remote/w ebdriver.py", line 319, in execute
[Mon Jan 28 21:02:52.303038 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] response = self.command_executor.execute(driver_command, params)
[Mon Jan 28 21:02:52.303041 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] File "/var/www/env/lib/python3.6/site-packages/selenium/webdriver/remote/r emote_connection.py", line 374, in execute
[Mon Jan 28 21:02:52.303043 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] return self._request(command_info[0], url, body=data)
[Mon Jan 28 21:02:52.303048 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] File "/var/www/env/lib/python3.6/site-packages/selenium/webdriver/remote/r emote_connection.py", line 397, in _request
[Mon Jan 28 21:02:52.303051 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] resp = self._conn.request(method, url, body=body, headers=headers)
[Mon Jan 28 21:02:52.303053 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] File "/var/www/env/lib/python3.6/site-packages/urllib3/request.py", line 7 2, in request
[Mon Jan 28 21:02:52.303056 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] **urlopen_kw)
[Mon Jan 28 21:02:52.303058 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] File "/var/www/env/lib/python3.6/site-packages/urllib3/request.py", line 1 50, in request_encode_body
[Mon Jan 28 21:02:52.303060 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] return self.urlopen(method, url, **extra_kw)
[Mon Jan 28 21:02:52.303063 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] File "/var/www/env/lib/python3.6/site-packages/urllib3/poolmanager.py", li ne 323, in urlopen
[Mon Jan 28 21:02:52.303065 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] response = conn.urlopen(method, u.request_uri, **kw)
[Mon Jan 28 21:02:52.303067 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] File "/var/www/env/lib/python3.6/site-packages/urllib3/connectionpool.py", line 638, in urlopen
[Mon Jan 28 21:02:52.303070 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] _stacktrace=sys.exc_info()[2])
[Mon Jan 28 21:02:52.303072 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] File "/var/www/env/lib/python3.6/site-packages/urllib3/util/retry.py", lin e 367, in increment
[Mon Jan 28 21:02:52.303075 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] raise six.reraise(type(error), error, _stacktrace)
[Mon Jan 28 21:02:52.303077 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] File "/var/www/env/lib/python3.6/site-packages/urllib3/packages/six.py", l ine 685, in reraise
[Mon Jan 28 21:02:52.303079 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] raise value.with_traceback(tb)
[Mon Jan 28 21:02:52.303082 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] File "/var/www/env/lib/python3.6/site-packages/urllib3/connectionpool.py", line 600, in urlopen
[Mon Jan 28 21:02:52.303084 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] chunked=chunked)
[Mon Jan 28 21:02:52.303086 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] File "/var/www/env/lib/python3.6/site-packages/urllib3/connectionpool.py", line 384, in _make_request
[Mon Jan 28 21:02:52.303089 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] six.raise_from(e, None)
[Mon Jan 28 21:02:52.303091 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] File "<string>", line 2, in raise_from
[Mon Jan 28 21:02:52.303093 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] File "/var/www/env/lib/python3.6/site-packages/urllib3/connectionpool.py", line 380, in _make_request
[Mon Jan 28 21:02:52.303096 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] httplib_response = conn.getresponse()
[Mon Jan 28 21:02:52.303098 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] File "/usr/lib/python3.6/http/client.py", line 1331, in getresponse
[Mon Jan 28 21:02:52.303100 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] response.begin()
[Mon Jan 28 21:02:52.303105 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] File "/usr/lib/python3.6/http/client.py", line 297, in begin
[Mon Jan 28 21:02:52.303107 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] version, status, reason = self._read_status()
[Mon Jan 28 21:02:52.303110 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] File "/usr/lib/python3.6/http/client.py", line 258, in _read_status
[Mon Jan 28 21:02:52.303112 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
[Mon Jan 28 21:02:52.303114 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] File "/usr/lib/python3.6/socket.py", line 586, in readinto
[Mon Jan 28 21:02:52.303117 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] return self._sock.recv_into(b)
[Mon Jan 28 21:02:52.303124 2019] [wsgi:error] [pid 27292:tid 140652916205312] [remote 172.31.25.223:61898] urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetErr or(104, 'Connection reset by peer'))
update
I have used request-timeout flag in apache conf file by which I have got rid of this error but still getting 504 Gateway Time-out error page after a some time of wait. Any idea to get rid of this or handle it.
I'm trying to configure the WSGI in Apache to work with Django but it's not working, when I go to domain.com it gives me an error 500.
But If I start Django using:
python manage.py runserver domain.com:8000
When I go to domain.com:8000 works perfectly so I think It's something about apache and WSGI.
Here you have my WSGI script:
import os
import sys
sys.path.append('/var/www/domain/')
os.environ['DJANGO_SETTINGS_MODULE'] = 'domain.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
My VirtualHost configuration:
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName www.domain.com
ServerAdmin info#domain.com
ServerAlias domain.com
DocumentRoot /var/www/domain
WSGIScriptAlias / /var/www/domain/domain.wsgi
#Alias /static/ /var/www/domain/static/
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
I'm using Ubuntu 14.04. I tried looking at logs but I have no idea what's wrong.
Logs:
[Thu Sep 25 10:15:09.549670 2014] [:error] [pid 17141] [client 88.12.185.72:65477] mod_wsgi (pid=17141): Exception occurred processing WSGI script '/var/www/domain/domain.wsgi'.
[Thu Sep 25 10:15:09.549722 2014] [:error] [pid 17141] [client 88.12.185.72:65477] Traceback (most recent call last):
[Thu Sep 25 10:15:09.549747 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 187, in __call__
[Thu Sep 25 10:15:09.549880 2014] [:error] [pid 17141] [client 88.12.185.72:65477] response = self.get_response(request)
[Thu Sep 25 10:15:09.549899 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 199, in get_response
[Thu Sep 25 10:15:09.550029 2014] [:error] [pid 17141] [client 88.12.185.72:65477] response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
[Thu Sep 25 10:15:09.550048 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 236, in handle_uncaught_exception
[Thu Sep 25 10:15:09.550075 2014] [:error] [pid 17141] [client 88.12.185.72:65477] return debug.technical_500_response(request, *exc_info)
[Thu Sep 25 10:15:09.550091 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/views/debug.py", line 91, in technical_500_response
[Thu Sep 25 10:15:09.550492 2014] [:error] [pid 17141] [client 88.12.185.72:65477] html = reporter.get_traceback_html()
[Thu Sep 25 10:15:09.550513 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/views/debug.py", line 350, in get_traceback_html
[Thu Sep 25 10:15:09.550539 2014] [:error] [pid 17141] [client 88.12.185.72:65477] return t.render(c)
[Thu Sep 25 10:15:09.550554 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 148, in render
[Thu Sep 25 10:15:09.550984 2014] [:error] [pid 17141] [client 88.12.185.72:65477] return self._render(context)
[Thu Sep 25 10:15:09.551006 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 142, in _render
[Thu Sep 25 10:15:09.551034 2014] [:error] [pid 17141] [client 88.12.185.72:65477] return self.nodelist.render(context)
[Thu Sep 25 10:15:09.551048 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 844, in render
[Thu Sep 25 10:15:09.551071 2014] [:error] [pid 17141] [client 88.12.185.72:65477] bit = self.render_node(node, context)
[Thu Sep 25 10:15:09.551084 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/template/debug.py", line 80, in render_node
[Thu Sep 25 10:15:09.551174 2014] [:error] [pid 17141] [client 88.12.185.72:65477] return node.render(context)
[Thu Sep 25 10:15:09.551192 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/template/debug.py", line 90, in render
[Thu Sep 25 10:15:09.551217 2014] [:error] [pid 17141] [client 88.12.185.72:65477] output = self.filter_expression.resolve(context)
[Thu Sep 25 10:15:09.551231 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 624, in resolve
[Thu Sep 25 10:15:09.551268 2014] [:error] [pid 17141] [client 88.12.185.72:65477] new_obj = func(obj, *arg_vals)
[Thu Sep 25 10:15:09.551284 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/template/defaultfilters.py", line 769, in date
[Thu Sep 25 10:15:09.551595 2014] [:error] [pid 17141] [client 88.12.185.72:65477] return format(value, arg)
[Thu Sep 25 10:15:09.551615 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/utils/dateformat.py", line 343, in format
[Thu Sep 25 10:15:09.551759 2014] [:error] [pid 17141] [client 88.12.185.72:65477] return df.format(format_string)
[Thu Sep 25 10:15:09.551778 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/utils/dateformat.py", line 35, in format
[Thu Sep 25 10:15:09.551817 2014] [:error] [pid 17141] [client 88.12.185.72:65477] pieces.append(force_text(getattr(self, piece)()))
[Thu Sep 25 10:15:09.551834 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/utils/dateformat.py", line 268, in r
[Thu Sep 25 10:15:09.551857 2014] [:error] [pid 17141] [client 88.12.185.72:65477] return self.format('D, j M Y H:i:s O')
[Thu Sep 25 10:15:09.551871 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/utils/dateformat.py", line 35, in format
[Thu Sep 25 10:15:09.551892 2014] [:error] [pid 17141] [client 88.12.185.72:65477] pieces.append(force_text(getattr(self, piece)()))
[Thu Sep 25 10:15:09.551907 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/utils/encoding.py", line 85, in force_text
[Thu Sep 25 10:15:09.552021 2014] [:error] [pid 17141] [client 88.12.185.72:65477] s = six.text_type(s)
[Thu Sep 25 10:15:09.552039 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 144, in __text_cast
[Thu Sep 25 10:15:09.552276 2014] [:error] [pid 17141] [client 88.12.185.72:65477] return func(*self.__args, **self.__kw)
[Thu Sep 25 10:15:09.552297 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/__init__.py", line 83, in ugettext
[Thu Sep 25 10:15:09.552412 2014] [:error] [pid 17141] [client 88.12.185.72:65477] return _trans.ugettext(message)
[Thu Sep 25 10:15:09.552431 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 325, in ugettext
[Thu Sep 25 10:15:09.552686 2014] [:error] [pid 17141] [client 88.12.185.72:65477] return do_translate(message, 'ugettext')
[Thu Sep 25 10:15:09.552706 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 306, in do_translate
[Thu Sep 25 10:15:09.552731 2014] [:error] [pid 17141] [client 88.12.185.72:65477] _default = translation(settings.LANGUAGE_CODE)
[Thu Sep 25 10:15:09.552746 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 209, in translation
[Thu Sep 25 10:15:09.552768 2014] [:error] [pid 17141] [client 88.12.185.72:65477] default_translation = _fetch(settings.LANGUAGE_CODE)
[Thu Sep 25 10:15:09.552782 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 189, in _fetch
[Thu Sep 25 10:15:09.552804 2014] [:error] [pid 17141] [client 88.12.185.72:65477] "The translation infrastructure cannot be initialized before the "
[Thu Sep 25 10:15:09.552830 2014] [:error] [pid 17141] [client 88.12.185.72:65477] AppRegistryNotReady: The translation infrastructure cannot be initialized before the apps registry is ready. Check that you don't make non-lazy gettext calls at import time.
Anyone knows what I'm doing wrong?
Thanks
I discover that the version of Django in my production server is 1.7.0 and in Development server is 1.6.4. After downgrade Django works fine.
sudo pip install django==1.6.4