小编Aud*_*992的帖子

AWS 目标 WSGI 脚本“/opt/python/current/app/core/wsgi.py”无法作为 Python 模块加载

我对 AWS+Django+React 有问题。我做这个教程https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-django.html。当我写“eb open”时,我遇到了一些麻烦“读取/opt/python/current/app/webpack-stats.json时出错。你确定webpack生成了文件并且路径正确吗?”。但是,当我在虚拟环境中本地运行项目时,一切正常。

错误 1 ​​图像 错误 2 图像

我的代码:

设置.py

ALLOWED_HOSTS = ['django-decor-env.ffp8hmcfus.us-west-2.elasticbeanstalk.com', '*']
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
TEMPLATES = [
{
    'BACKEND': 'django.template.backends.django.DjangoTemplates',
    'DIRS': ['core/templates'],
    'APP_DIRS': True,
    'OPTIONS': {
        'context_processors': [
            'django.template.context_processors.debug',
            'django.template.context_processors.request',
            'django.contrib.auth.context_processors.auth',
            'django.contrib.messages.context_processors.messages',
        ],
    },
},
]
STATIC_URL = '/static/'
STATIC_ROOT = "core/staticfiles" - update path.
STATICFILES_DIRS = [
   os.path.join(BASE_DIR, 'core/static'),
]
MEDIA_URL = '/media/'
MEDIA_ROOT = BASE_DIR

# Webpack config
WEBPACK_LOADER = {
'DEFAULT': {
    'CACHE': not DEBUG,
    'BUNDLE_DIR_NAME': '/',  # must end …
Run Code Online (Sandbox Code Playgroud)

apache django mod-wsgi amazon-web-services

5
推荐指数
1
解决办法
1654
查看次数

标签 统计

amazon-web-services ×1

apache ×1

django ×1

mod-wsgi ×1