Miserlou/Zappa

No Module Named django.utils

tawanda14 opened this issue · 1 comments

Context

Hi I am trying to deploy Zappa to aws lambda, but i am getting the following issue and have no idea how to solve it
[1602062023852] Failed to find library...right filename?
[1602062023856] No module named 'django.utils': ModuleNotFoundError
Traceback (most recent call last):
File "/var/task/handler.py", line 509, in lambda_handler
return LambdaHandler.lambda_handler(event, context)
File "/var/task/handler.py", line 237, in lambda_handler
handler = cls()
File "/var/task/handler.py", line 143, in init
wsgi_app_function = get_django_wsgi(self.settings.DJANGO_SETTINGS)
File "/var/task/zappa/ext/django_zappa.py", line 9, in get_django_wsgi
from django.core.wsgi import get_wsgi_application
File "/tmp/sendit_django/django/init.py", line 1, in
from django.utils.version import get_version
ModuleNotFoundError: No module named 'django.utils'

I am running Python 3.6 in a virtual environment with Zappa 0.45.1

Expected Behavior

Ideally, it should deploy without any problems

Actual Behavior

[1602062023852] Failed to find library...right filename?
[1602062023856] No module named 'django.utils': ModuleNotFoundError
Traceback (most recent call last):
File "/var/task/handler.py", line 509, in lambda_handler
return LambdaHandler.lambda_handler(event, context)
File "/var/task/handler.py", line 237, in lambda_handler
handler = cls()
File "/var/task/handler.py", line 143, in init
wsgi_app_function = get_django_wsgi(self.settings.DJANGO_SETTINGS)
File "/var/task/zappa/ext/django_zappa.py", line 9, in get_django_wsgi
from django.core.wsgi import get_wsgi_application
File "/tmp/sendit_django/django/init.py", line 1, in
from django.utils.version import get_version
ModuleNotFoundError: No module named 'django.utils'

Your Environment

  • Zappa version used: 0.45.1

  • Operating System and Python version: Mac OS

  • The output of pip freeze:

  • Link to your project (optional):
    aioredis==1.3.1
    amqp==2.5.2
    argcomplete==1.9.2
    asgiref==3.2.7
    async-timeout==3.0.1
    attrs==19.3.0
    autobahn==20.4.3
    Automat==20.2.0
    autopep8==1.5.2
    Babel==2.8.0
    base58==0.2.4
    billiard==3.6.3.0
    boto3==1.14.20
    botocore==1.17.20
    celery==5.0.0
    certifi==2020.4.5.1
    cffi==1.14.0
    cfn-flip==1.2.3
    channels==2.4.0
    channels-redis==2.4.2
    chardet==3.0.4
    click==7.1.2
    click-didyoumean==0.0.3
    click-repl==0.1.6
    constantly==15.1.0
    coreapi==2.3.3
    coreschema==0.0.4
    cryptography==2.9.2
    daphne==2.5.0
    decorator==4.4.2
    defusedxml==0.6.0
    dj-rest-auth==1.0.9
    Django==2.2.12
    django-allauth==0.42.0
    django-celery-beat==2.0.0
    django-cors-headers==3.2.1
    django-extensions==3.0.2
    django-rest-passwordreset==1.1.0
    django-rest-swagger==2.2.0
    django-timezone-field==4.0
    djangorestframework==3.11.0
    djangorestframework-simplejwt==4.4.0
    docopt==0.6.2
    docutils==0.15.2
    durationpy==0.5
    ffmpeg==1.4
    future==0.16.0
    gunicorn==20.0.4
    hashids==1.2.0
    hiredis==1.0.1
    hjson==3.0.1
    hyperlink==19.0.0
    idna==2.9
    imageio==2.9.0
    imageio-ffmpeg==0.4.2
    importlib-metadata==1.6.0
    incremental==17.5.0
    isort==4.3.21
    itypes==1.2.0
    Jinja2==2.11.2
    jmespath==0.9.3
    kappa==0.6.0
    kombu==4.6.8
    lambda-packages==0.19.0
    MarkupSafe==1.1.1
    more-itertools==8.4.0
    moviepy==1.0.3
    msgpack==0.6.2
    numpy==1.19.1
    oauthlib==3.1.0
    openapi-codec==1.3.2
    packaging==20.4
    Pillow==7.1.2
    pip-api==0.0.14
    pip-tools==5.3.1
    pipreqs==0.4.10
    placebo==0.9.0
    pluggy==0.13.1
    proglog==0.1.9
    prompt-toolkit==3.0.7
    psycopg2-binary==2.8.5
    py==1.8.2
    pyasn1==0.4.8
    pyasn1-modules==0.2.8
    pycodestyle==2.5.0
    pycparser==2.20
    PyHamcrest==2.0.2
    PyJWT==1.7.1
    PyMySQL==0.10.1
    pyOpenSSL==19.1.0
    pyparsing==2.4.7
    pytest==5.4.3
    pytest-django==3.9.0
    python-crontab==2.5.1
    python-dateutil==2.6.1
    python-slugify==1.2.4
    python3-openid==3.1.0
    pytz==2020.1
    PyYAML==3.12
    redis==3.4.1
    requests==2.23.0
    requests-oauthlib==1.3.0
    s3transfer==0.3.3
    service-identity==18.1.0
    simplejson==3.17.2
    six==1.14.0
    sqlparse==0.3.1
    stripe==2.48.0
    text-unidecode==1.3
    toml==0.10.1
    tqdm==4.50.0
    troposphere==2.6.2
    Twisted==20.3.0
    txaio==20.4.1
    Unidecode==1.1.1
    uritemplate==3.0.1
    urllib3==1.25.9
    vine==1.3.0
    wcwidth==0.2.4
    Werkzeug==0.12
    wsgi-request-logger==0.4.6
    yarg==0.1.9
    zappa==0.45.1
    zipp==3.1.0
    zope.interface==5.1.0

  • Your zappa_settings.json:

{
"dev": {
"django_settings": "api.settings",
"profile_name": "default",
"project_name": "sendit_django",
"runtime": "python3.6",
"s3_bucket": "",
"aws_region": "af-south-1",
"slim_handler": true,
"environment_variables": {
"SQL_USER": "",
"SQL_PASSWORD": "",
"SQL_ENGINE": "",
"SQL_DATABASE": "",
"SQL_HOST": "",
"SQL_PORT": ""
},
"memory_size": 512
}
}

Fixed the issue by upgrading django