简体   繁体   中英

Internal Server Error while deployoing Django 4.1 on Heroku

Please find given below my error log

Requirements.txt

asgiref==3.5.2'
astroid==2.11.7
certifi==2022.9.14
cffi==1.15.1
charset-normalizer==2.1.1
colorama==0.4.5
cryptography==38.0.1
defusedxml==0.7.1
dill==0.3.5.1
Django==4.1
django-allauth==0.51.0
django-crispy-forms==1.14.0
django-tinymce4-lite==1.8.0
gunicorn==20.1.0
idna==3.4
isort==5.10.1
jsmin==3.0.1
lazy-object-proxy==1.7.1
mccabe==0.7.0
oauthlib==3.2.1
Pillow==9.2.0
platformdirs==2.5.2
psycopg2-binary==2.9.3
pycparser==2.21
PyJWT==2.5.0
pylint==2.14.5
python3-openid==3.2.0
requests==2.28.1
requests-oauthlib==1.3.1
sqlparse==0.4.2
tomli==2.0.1
tomlkit==0.11.1
types-cryptography==3.3.23
typing_extensions==4.3.0
tzdata==2022.1
urllib3==1.26.12
whitenoise==6.2.0
wrapt==1.14.1
2022-09-23T13:49:34.422160+00:00 app[web.1]:   File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
2022-09-23T13:49:34.422160+00:00 app[web.1]:   File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
2022-09-23T13:49:34.422160+00:00 app[web.1]:   File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
2022-09-23T13:49:34.422160+00:00 app[web.1]:   File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
2022-09-23T13:49:34.422160+00:00 app[web.1]:   File "<frozen importlib._bootstrap_external>", line 850, in exec_module
2022-09-23T13:49:34.422161+00:00 app[web.1]:   File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
2022-09-23T13:49:34.422161+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/tinymce/urls.py", line 1, in <module>
2022-09-23T13:49:34.422161+00:00 app[web.1]:     from django.conf.urls import url
2022-09-23T13:49:34.422161+00:00 app[web.1]: ImportError: cannot import name 'url' from 'django.conf.urls' (/app/.heroku/python/lib/python3.9/site-packages/django/conf/urls/__init__.py)
2022-09-23T13:49:34.422162+00:00 app[web.1]: 10.1.88.83 - - [23/Sep/2022:13:49:34 +0000] "GET / HTTP/1.1" 500 0 "-" "-"
2022-09-23T13:50:02.988981+00:00 app[web.1]: [2022-09-23 13:50:02 +0000] [10] [ERROR] Error handling request /
2022-09-23T13:50:02.989014+00:00 app[web.1]: Traceback (most recent call last):
2022-09-23T13:50:02.989015+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/django/core/handlers/exception.py", line 55, in inner
2022-09-23T13:50:02.989015+00:00 app[web.1]:     response = get_response(request)
2022-09-23T13:50:02.989017+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
2022-09-23T13:50:02.989017+00:00 app[web.1]:     callback, callback_args, callback_kwargs = self.resolve_request(request)
2022-09-23T13:50:02.989018+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/django/core/handlers/base.py", line 313, in resolve_request
2022-09-23T13:50:02.989018+00:00 app[web.1]:     resolver_match = resolver.resolve(request.path_info)
2022-09-23T13:50:02.989018+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/django/urls/resolvers.py", line 638, in resolve
2022-09-23T13:50:02.989018+00:00 app[web.1]:     for pattern in self.url_patterns:
2022-09-23T13:50:02.989019+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/django/utils/functional.py", line 57, in __get__
2022-09-23T13:50:02.989019+00:00 app[web.1]:     res = instance.__dict__[self.name] = self.func(instance)
2022-09-23T13:50:02.989019+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/django/urls/resolvers.py", line 690, in url_patterns
2022-09-23T13:50:02.989019+00:00 app[web.1]:     patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
2022-09-23T13:50:02.989020+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/django/utils/functional.py", line 57, in __get__
2022-09-23T13:50:02.989020+00:00 app[web.1]:     res = instance.__dict__[self.name] = self.func(instance)
2022-09-23T13:50:02.989021+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/django/urls/resolvers.py", line 683, in urlconf_module
2022-09-23T13:50:02.989021+00:00 app[web.1]:     return import_module(self.urlconf_name)
2022-09-23T13:50:02.989021+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.9/importlib/__init__.py", line 127, in import_module
2022-09-23T13:50:02.989021+00:00 app[web.1]:     return _bootstrap._gcd_import(name[level:], package, level)
2022-09-23T13:50:02.989021+00:00 app[web.1]:   File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
2022-09-23T13:50:02.989022+00:00 app[web.1]:   File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
2022-09-23T13:50:02.989022+00:00 app[web.1]:   File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
2022-09-23T13:50:02.989022+00:00 app[web.1]:   File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
2022-09-23T13:50:02.989022+00:00 app[web.1]:   File "<frozen importlib._bootstrap_external>", line 850, in exec_module
2022-09-23T13:50:02.989022+00:00 app[web.1]:   File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
2022-09-23T13:50:02.989023+00:00 app[web.1]:   File "/app/blog/urls.py", line 34, in <module>
2022-09-23T13:50:02.989023+00:00 app[web.1]:     path('tinymce/', include('tinymce.urls')),
2022-09-23T13:50:02.989023+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/django/urls/conf.py", line 38, in include
2022-09-23T13:50:02.989023+00:00 app[web.1]:     urlconf_module = import_module(urlconf_module)
2022-09-23T13:50:02.989023+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.9/importlib/__init__.py", line 127, in import_module
2022-09-23T13:50:02.989024+00:00 app[web.1]:     return _bootstrap._gcd_import(name[level:], package, level)
2022-09-23T13:50:02.989024+00:00 app[web.1]:   File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
2022-09-23T13:50:02.989024+00:00 app[web.1]:   File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
2022-09-23T13:50:02.989024+00:00 app[web.1]:   File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
2022-09-23T13:50:02.989024+00:00 app[web.1]:   File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
2022-09-23T13:50:02.989024+00:00 app[web.1]:   File "<frozen importlib._bootstrap_external>", line 850, in exec_module
2022-09-23T13:50:02.989024+00:00 app[web.1]:   File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
2022-09-23T13:50:02.989025+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/tinymce/urls.py", line 1, in <module>

I have tried importing from django.urls import include, re_path, however that could not solve my problem as it have solved for many in other threads..

Given below is my url file.. before if..

from django.conf import settings
from django.conf.urls.static import static 
from django.contrib import admin
from django.urls import path, include
from posts.views import (
    index, blog, post, search,
    post_update, post_delete, post_create)


urlpatterns = [
    path('admin/', admin.site.urls),
    path('', index),
    path('blog/', blog, name='post-list'),
    path('search/',search, name='search'),
    path('create/', post_create, name='post-create'),
    path('post/<id>/', post, name='post-detail'),
    path('post/<id>/update/', post_update, name='post-update'),
    path('post/<id>/delete/', post_delete, name='post-delete'),
    path('tinymce/', include('tinymce.urls')),
    path('accounts/', include('allauth.urls'))
]

I have been facing this problem while deploying my app on heroku, anyone can help on this?

The problem seems to be coming from tinymce, and it doesn't look like django-tinymce4-lite supports Django 4+ yet ( https://pypi.org/project/django-tinymce4-lite/ ).

The django-tinymce==3.5.0 package supports Django 4.0 and 4.1 ( https://pypi.org/project/django-tinymce/ ). You might want to try that...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM