aws elestic beanstak deployment error

hello,
I am trying to delpoy my website, after following the documentation and deploying it I get health erorr.

what I did:

  • collected static
  • made requirements.txt
  • zipped the code like so:
    image
  • added the static handling at the urls,
urlpatterns = [
    path('admin/', admin.site.urls),
    path("",include("main_website.urls")),

] + static(settings.MEDIA_URL,document_root=settings.MEDIA_ROOT) \
    + static(settings.STATIC_URL,document_root=settings.STATIC_ROOT)

while ben_gurion_bkal is the main folder (the one that contains the wsgi file) and main_website is the one and only application.

the logs:
https://drive.google.com/drive/folders/10BV20UJajuziClZufJQ1diLBVFkuZeOT?usp=sharing

aws:

thanks in advance

Hi eyalyakir159,

Looking at the web std out logs, the first section is what you need to be concerned about:

Oct 21 11:55:30 ip-172-31-40-9 web: [2021-10-21 11:55:30 +0000] [3491] [INFO] Starting gunicorn 20.1.0
Oct 21 11:55:30 ip-172-31-40-9 web: [2021-10-21 11:55:30 +0000] [3491] [INFO] Listening at: http://127.0.0.1:8000 (3491)
Oct 21 11:55:30 ip-172-31-40-9 web: [2021-10-21 11:55:30 +0000] [3491] [INFO] Using worker: gthread
Oct 21 11:55:30 ip-172-31-40-9 web: [2021-10-21 11:55:30 +0000] [3546] [INFO] Booting worker with pid: 3546
Oct 21 11:55:30 ip-172-31-40-9 web: [2021-10-21 11:55:30 +0000] [3546] [ERROR] Exception in worker process
Oct 21 11:55:30 ip-172-31-40-9 web: Traceback (most recent call last):
Oct 21 11:55:30 ip-172-31-40-9 web: File "/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
Oct 21 11:55:30 ip-172-31-40-9 web: worker.init_process()
Oct 21 11:55:30 ip-172-31-40-9 web: File "/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/gunicorn/workers/gthread.py", line 92, in init_process
Oct 21 11:55:30 ip-172-31-40-9 web: super().init_process()
Oct 21 11:55:30 ip-172-31-40-9 web: File "/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/gunicorn/workers/base.py", line 134, in init_process
Oct 21 11:55:30 ip-172-31-40-9 web: self.load_wsgi()
Oct 21 11:55:30 ip-172-31-40-9 web: File "/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
Oct 21 11:55:30 ip-172-31-40-9 web: self.wsgi = self.app.wsgi()
Oct 21 11:55:30 ip-172-31-40-9 web: File "/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/gunicorn/app/base.py", line 67, in wsgi
Oct 21 11:55:30 ip-172-31-40-9 web: self.callable = self.load()
Oct 21 11:55:30 ip-172-31-40-9 web: File "/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
Oct 21 11:55:30 ip-172-31-40-9 web: return self.load_wsgiapp()
Oct 21 11:55:30 ip-172-31-40-9 web: File "/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
Oct 21 11:55:30 ip-172-31-40-9 web: return util.import_app(self.app_uri)
Oct 21 11:55:30 ip-172-31-40-9 web: File "/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/gunicorn/util.py", line 359, in import_app
Oct 21 11:55:30 ip-172-31-40-9 web: mod = importlib.import_module(module)
Oct 21 11:55:30 ip-172-31-40-9 web: File "/usr/lib64/python3.8/importlib/__init__.py", line 127, in import_module
Oct 21 11:55:30 ip-172-31-40-9 web: return _bootstrap._gcd_import(name[level:], package, level)
Oct 21 11:55:30 ip-172-31-40-9 web: File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
Oct 21 11:55:30 ip-172-31-40-9 web: File "<frozen importlib._bootstrap>", line 991, in _find_and_load
Oct 21 11:55:30 ip-172-31-40-9 web: File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
Oct 21 11:55:30 ip-172-31-40-9 web: ModuleNotFoundError: No module named 'application'

What that’s saying is that when gunicorn attempts to run your application, it can’t find the module named application.

How are you configuring the application to run? Depending on where you’re running it from you may need to include a prefix of ben_gurion_bkal

sorry for not understaind, its my first time lunching an application.
what do you mean configuring the application to run?
if I got it right, the wsgi file should do the job,


which is at ben_gurion_bkal\wsgi.py.
and at django config I call it like so

The django.config file is what I was referring to.

I think the AWS docs may be wrong. The django docs indicate you don’t have to specify the :application

Try:

WSGIPath: ben_gurion_bkal.wsgi

Admittedly, I haven’t worked with EBS before, so I’m not 100% sure.

Thank you so much!!!
cant explain how happy I am now :slight_smile:

another question about aws.
when I deploy my application my code looks like so:
image
when the db is a file containing some basic stuff, say the admin user, the upload folder is empty (when user uploads stuff it goes there) and the rest is the static code.
after i deploy my code how can i acsses the db/files from aws? say I want to dowlond the db and change it and then reupload it?
basicly how can I acsses the server files
thanks!

That’s an AWS question which is outside of my knowledge base. You’ll be better suited looking for a forum that’s tailored to their services for that particular question, unless someone else here has knowledge about it.

Hi Tim,

For me is very hard to access to the EB files , y advice you to a external database like mysql o postgres. And alternative can be this library
django-s3-sqlite, but only if you a very slow traffic.

Regars,