ModuleNotFoundError on AWS lightsail for WSGI (SOLVED)

I created a Django instance in AWS lightsail. I went through this tutorial:
I did not use the tutorial django project from the tutorial, I used my own django project

Django running with WSGI on Apache gives me the error:

No module named 'statistics.models_es'; 'statistics' is not a package

statistics is one of the apps in my project. My project folder does not seem to be in the paths where django is looking for apps.

I have the line


in my

When I execute python3 shell and then execute the line from statistics.models_es import StatisticsClick, everything works fine.

Does somebody have an idea what goes wrong with adding the path to wsgi / apache?

Thank you!

Ok, found the problem:

I had to replace the sys.path.append in my with

sys.path.insert(0, '/opt/bitnami/apps/django/django_projects/my_app')

There seems to be another package named “statistics”.

Maybe this should be changed in the tutorial at

Found the solution here:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.