python - Deploying Django to AWS - WSGIPath refers to a file that does not exist -
i've been struggling getting django , aws work together. i'm following tutorial here:
https://realpython.com/blog/python/deploying-a-django-app-to-aws-elastic-beanstalk/
i've been following tutorial steps, including using "eb option" command change wsgipath, keep getting error:
"error: wsgipath refers file not exist."
as far can tell i've been doing according tutorial.
the relevant part of config file looks this:
numprocesses: '1' numthreads: '15' staticfiles: /static/=static/ wsgipath: iotd/iotd/wsgi.py
what doing wrong?
i have read realpython blog post referred to. refer aws tutorial. written deployment of bare bones django project , can found at:
i found useful work through, , learned great deal fixing error have identified. of course fix related own implementation of tutorial, followed step-by-step. have read other posts talk issue, solution stated here not provided in posts, far can tell.
an abbreviated version of tutorial follows provide context comments made here. abbreviated version begins after creating/activating virtual environment, before activation.
$ mkdir ed_django_app $ . venv/scripts/activate (venv)[~eb_django_app]$ django-admin startproject django_eb (venv)[~eb_django_app/django_eb]$ python manage.py migrate (venv)[~eb_django_app/django_eb]$ python manage.py runserver (venv)[~eb_django_app]$ pip freeze > requirements.txt (venv)[~eb_django_app]$ deactivate [~eb_django_app]$ eb init –region us-east-1
after "eb init" command .elasticbeanstalk directory, along files, created in initialization process. in directory find config.yml file. contents are:
branch-defaults: default: environment: eb-django-dev global: application_name: eb_django_app default_ec2_keyname: myec2keyname default_platform: python 2.7 default_region: us-east-1 profile: eb-cli sc: null
the tutorial directs developer create directory called .ebextensions , create 01-eb_django.config file:
option_settings: "aws:elasticbeanstalk:application:environment": django_settings_module: "django_eb.settings" pythonpath: "/opt/python/current/app/django_eb:$pythonpath" "aws:elasticbeanstalk:container:python": wsgipath: "django_eb/django_eb/wsgi.py"
this yaml , indentation matters. @ least 1 space indent. in case there 2 spaces of indent @ each level. wsgipath set correctly. important make sure directory structure same indicated in tutorial.
in tutorial "eb create" command issued, , noted, following arises:
error: wsgipath refers file not exist
the problem identified existed in config.yml there key-pair application_name:
global: application_name: eb_django_app
it changed to:
global: application_name: django_eb
this resolved error me.
Comments
Post a Comment