【发布时间】:2019-10-31 04:04:48
【问题描述】:
所以我收到以下错误:
ModuleNotFoundError: No module named 'tinymce'
尝试将我的 Django 应用程序部署到 Azure 时。当我在本地对其进行测试时,它工作得很好,但在 Azure 上就崩溃了。
我已经完成了 pip freeze > requirements.txt 并验证了 django-tinymce 在该列表中,我已经重新启动了我的服务器并重新同步了我的 GitHub 项目。 TinyMce 已添加到 INSTALLED_APPS 中。
以下是一些代码部分以及错误:
settings.py:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'main',
'cpu',
'django_cron',
'tinymce',
]
#...
TINYMCE_DEFAULT_CONFIG = {
'height': 360,
'width': 1120,
'cleanup_on_startup': True,
'custom_undo_redo_levels': 20,
'selector': 'textarea',
'theme': 'modern',
'plugins': '''
textcolor save link image media preview codesample contextmenu
table code lists fullscreen insertdatetime nonbreaking
contextmenu directionality searchreplace wordcount visualblocks
visualchars code fullscreen autolink lists charmap print hr
anchor pagebreak
''',
'toolbar1': '''
fullscreen preview bold italic underline | fontselect,
fontsizeselect | forecolor backcolor | alignleft alignright |
aligncenter alignjustify | indent outdent | bullist numlist table |
| link image media | codesample |
''',
'toolbar2': '''
visualblocks visualchars |
charmap hr pagebreak nonbreaking anchor | code |
''',
'contextmenu': 'formats | link image',
'menubar': True,
'statusbar': True,
}
来自 Azure 的错误:
[2019-10-29 11:27:45 +0000] [44] [ERROR] Exception in worker process
2019-10-29T11:27:45.252815138Z Traceback (most recent call last):
2019-10-29T11:27:45.252820439Z File "/opt/python/3.7.4/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2019-10-29T11:27:45.252824939Z worker.init_process()
2019-10-29T11:27:45.252837239Z File "/opt/python/3.7.4/lib/python3.7/site-packages/gunicorn/workers/base.py", line 129, in init_process
2019-10-29T11:27:45.252841739Z self.load_wsgi()
2019-10-29T11:27:45.252845439Z File "/opt/python/3.7.4/lib/python3.7/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
2019-10-29T11:27:45.252849239Z self.wsgi = self.app.wsgi()
2019-10-29T11:27:45.252852939Z File "/opt/python/3.7.4/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
2019-10-29T11:27:45.252856839Z self.callable = self.load()
2019-10-29T11:27:45.252860539Z File "/opt/python/3.7.4/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
2019-10-29T11:27:45.252864339Z return self.load_wsgiapp()
2019-10-29T11:27:45.252868039Z File "/opt/python/3.7.4/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
2019-10-29T11:27:45.252871939Z return util.import_app(self.app_uri)
2019-10-29T11:27:45.252875739Z File "/opt/python/3.7.4/lib/python3.7/site-packages/gunicorn/util.py", line 350, in import_app
2019-10-29T11:27:45.252879539Z __import__(module)
2019-10-29T11:27:45.252883139Z File "/home/site/wwwroot/pcbuilder/wsgi.py", line 16, in
2019-10-29T11:27:45.252887439Z application = get_wsgi_application()
2019-10-29T11:27:45.252891139Z File "/antenv/lib/python3.7/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
2019-10-29T11:27:45.252894939Z django.setup(set_prefix=False)
2019-10-29T11:27:45.252898639Z File "/antenv/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
2019-10-29T11:27:45.252902539Z apps.populate(settings.INSTALLED_APPS)
2019-10-29T11:27:45.252906239Z File "/antenv/lib/python3.7/site-packages/django/apps/registry.py", line 91, in populate
2019-10-29T11:27:45.252910039Z app_config = AppConfig.create(entry)
2019-10-29T11:27:45.252914039Z File "/antenv/lib/python3.7/site-packages/django/apps/config.py", line 90, in create
2019-10-29T11:27:45.252918039Z module = import_module(entry)
2019-10-29T11:27:45.252921639Z File "/opt/python/3.7.4/lib/python3.7/importlib/__init__.py", line 127, in import_module
2019-10-29T11:27:45.252925539Z return _bootstrap._gcd_import(name[level:], package, level)
2019-10-29T11:27:45.252929339Z ModuleNotFoundError: No module named 'tinymce'
点冻结:
astroid==2.3.1
beautifulsoup4==4.8.1
bs4==0.0.1
colorama==0.4.1
Django==2.2.6
django-background-tasks==1.2.0
django-classy-tags==0.9.0
django-cms==3.7.0
django-common-helpers==0.9.2
django-compat==1.0.15
django-cron==0.5.1
django-formtools==2.1
django-sekizai==1.0.0
django-tinymce==2.8.0
django-treebeard==4.3
djangocms-admin-style==1.4.0
djangocms-attributes-field==1.1.0
djangocms-icon==1.4.1
isort==4.3.21
lazy-object-proxy==1.4.2
mccabe==0.6.1
mysql==0.0.2
mysql-connector-python==8.0.18
mysqlclient==1.4.4
protobuf==3.10.0
pylint==2.4.2
PyMySQL==0.9.3
pytz==2019.3
selenium==3.141.0
six==1.12.0
soupsieve==1.9.4
sqlparse==0.3.0
style==1.1.0
update==0.0.1
urllib3==1.25.6
wrapt==1.11.2
【问题讨论】:
-
你的部署过程是什么?
-
@absolutelydevastated 我将更改提交到 GitHub 主服务器,然后等待 Azure 重新部署。它只是处理更改。我之前在 Azure 根据我的 requirements.txt 更新 pip 方面取得了成功,所以我不知道为什么会出现这个问题。
-
你试过手动
pip install -r requirements.txt吗? -
@SamCreamer 是的,我做到了
标签: python django python-3.x